summaryrefslogtreecommitdiffstats
path: root/webkit/renderer
diff options
context:
space:
mode:
authorclholgat@chromium.org <clholgat@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-10-04 00:35:13 +0000
committerclholgat@chromium.org <clholgat@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-10-04 00:35:13 +0000
commitefbdb3ac428aa1829161729189604865e606691b (patch)
treee2b465b299b54934d06c020c0ea514292841aa15 /webkit/renderer
parent18ae4320efce8e3342c3a5048569a25c4f2498ab (diff)
downloadchromium_src-efbdb3ac428aa1829161729189604865e606691b.zip
chromium_src-efbdb3ac428aa1829161729189604865e606691b.tar.gz
chromium_src-efbdb3ac428aa1829161729189604865e606691b.tar.bz2
Generic UIResourceLayer for shared resources.
Separated the UIResource management from the NinePatchLayer because we need it for other things as well. BUG=235290 Review URL: https://codereview.chromium.org/24716003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@226908 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/renderer')
-rw-r--r--webkit/renderer/compositor_bindings/web_nine_patch_layer_impl.cc31
-rw-r--r--webkit/renderer/compositor_bindings/web_nine_patch_layer_impl.h9
2 files changed, 37 insertions, 3 deletions
diff --git a/webkit/renderer/compositor_bindings/web_nine_patch_layer_impl.cc b/webkit/renderer/compositor_bindings/web_nine_patch_layer_impl.cc
index 0c64a06..80c643a 100644
--- a/webkit/renderer/compositor_bindings/web_nine_patch_layer_impl.cc
+++ b/webkit/renderer/compositor_bindings/web_nine_patch_layer_impl.cc
@@ -23,8 +23,35 @@ WebKit::WebLayer* WebNinePatchLayerImpl::layer() { return layer_.get(); }
void WebNinePatchLayerImpl::setBitmap(SkBitmap bitmap,
const WebKit::WebRect& aperture) {
- static_cast<cc::NinePatchLayer*>(layer_->layer())->SetBitmap(
- bitmap, gfx::Rect(aperture));
+ setBitmap(bitmap);
+ setAperture(aperture);
+ setBorder(WebKit::WebRect(aperture.x, aperture.y,
+ bitmap.width() - aperture.width,
+ bitmap.height() - aperture.height));
+}
+
+void WebNinePatchLayerImpl::setBitmap(SkBitmap bitmap) {
+ cc::NinePatchLayer* nine_patch =
+ static_cast<cc::NinePatchLayer*>(layer_->layer());
+ nine_patch->SetBitmap(bitmap);
+}
+
+void WebNinePatchLayerImpl::setAperture(const WebKit::WebRect& aperture) {
+ cc::NinePatchLayer* nine_patch =
+ static_cast<cc::NinePatchLayer*>(layer_->layer());
+ nine_patch->SetAperture(gfx::Rect(aperture));
+}
+
+void WebNinePatchLayerImpl::setBorder(const WebKit::WebRect& border) {
+ cc::NinePatchLayer* nine_patch =
+ static_cast<cc::NinePatchLayer*>(layer_->layer());
+ nine_patch->SetBorder(gfx::Rect(border));
+}
+
+void WebNinePatchLayerImpl::setFillCenter(bool fill_center) {
+ cc::NinePatchLayer* nine_patch =
+ static_cast<cc::NinePatchLayer*>(layer_->layer());
+ nine_patch->SetFillCenter(fill_center);
}
} // namespace webkit
diff --git a/webkit/renderer/compositor_bindings/web_nine_patch_layer_impl.h b/webkit/renderer/compositor_bindings/web_nine_patch_layer_impl.h
index 34c8eff..2a5720d 100644
--- a/webkit/renderer/compositor_bindings/web_nine_patch_layer_impl.h
+++ b/webkit/renderer/compositor_bindings/web_nine_patch_layer_impl.h
@@ -21,7 +21,14 @@ class WebNinePatchLayerImpl : public WebKit::WebNinePatchLayer {
// WebKit::WebNinePatchLayer implementation.
virtual WebKit::WebLayer* layer();
- virtual void setBitmap(SkBitmap, const WebKit::WebRect& aperture);
+
+ // TODO(ccameron): Remove setBitmap(SkBitmap, WebKit::WebRect) in favor of
+ // setBitmap(), setAperture(), and setBorder();
+ virtual void setBitmap(SkBitmap bitmap, const WebKit::WebRect& aperture);
+ virtual void setBitmap(SkBitmap bitmap);
+ virtual void setAperture(const WebKit::WebRect& aperture);
+ virtual void setBorder(const WebKit::WebRect& border);
+ virtual void setFillCenter(bool fill_center);
private:
scoped_ptr<WebLayerImpl> layer_;