diff options
author | clholgat@chromium.org <clholgat@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-10-04 00:35:13 +0000 |
---|---|---|
committer | clholgat@chromium.org <clholgat@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-10-04 00:35:13 +0000 |
commit | efbdb3ac428aa1829161729189604865e606691b (patch) | |
tree | e2b465b299b54934d06c020c0ea514292841aa15 /cc/layers/nine_patch_layer.h | |
parent | 18ae4320efce8e3342c3a5048569a25c4f2498ab (diff) | |
download | chromium_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 'cc/layers/nine_patch_layer.h')
-rw-r--r-- | cc/layers/nine_patch_layer.h | 21 |
1 files changed, 3 insertions, 18 deletions
diff --git a/cc/layers/nine_patch_layer.h b/cc/layers/nine_patch_layer.h index 5880635..dc9f81f 100644 --- a/cc/layers/nine_patch_layer.h +++ b/cc/layers/nine_patch_layer.h @@ -8,6 +8,7 @@ #include "base/memory/scoped_ptr.h" #include "cc/base/cc_export.h" #include "cc/layers/layer.h" +#include "cc/layers/ui_resource_layer.h" #include "cc/resources/ui_resource_client.h" #include "ui/gfx/rect.h" @@ -16,16 +17,12 @@ namespace cc { class LayerTreeHost; class ScopedUIResource; -class CC_EXPORT NinePatchLayer : public Layer { +class CC_EXPORT NinePatchLayer : public UIResourceLayer { public: static scoped_refptr<NinePatchLayer> Create(); - virtual bool DrawsContent() const OVERRIDE; - virtual void PushPropertiesTo(LayerImpl* layer) OVERRIDE; - virtual void SetLayerTreeHost(LayerTreeHost* host) OVERRIDE; - // |border| is the space around the center rectangular region in layer space // (known as aperture in image space). |border.x()| and |border.y()| are the // size of the left and top boundary, respectively. @@ -39,29 +36,17 @@ class CC_EXPORT NinePatchLayer : public Layer { // on the edges of the layer. The corners are unscaled, the top and bottom // rects are x-stretched to fit, and the left and right rects are // y-stretched to fit. - void SetBitmap(const SkBitmap& skbitmap, gfx::Rect aperture); - - // An alternative way of setting the resource to allow for sharing. - void SetUIResourceId(UIResourceId resource_id, gfx::Rect aperture); + void SetAperture(gfx::Rect aperture); void SetFillCenter(bool fill_center); - class UIResourceHolder { - public: - virtual UIResourceId id() = 0; - virtual ~UIResourceHolder(); - }; - private: NinePatchLayer(); virtual ~NinePatchLayer(); virtual scoped_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl) OVERRIDE; - void RecreateUIResourceHolder(); gfx::Rect border_; bool fill_center_; - scoped_ptr<UIResourceHolder> ui_resource_holder_; - SkBitmap bitmap_; // The transparent center region that shows the parent layer's contents in // image space. |