Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(129)

Side by Side Diff: cc/layers/nine_patch_layer.h

Issue 1122393003: CC: Plumb LayerSettings parameter for cc::Layer construction. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « cc/layers/layer_unittest.cc ('k') | cc/layers/nine_patch_layer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CC_LAYERS_NINE_PATCH_LAYER_H_ 5 #ifndef CC_LAYERS_NINE_PATCH_LAYER_H_
6 #define CC_LAYERS_NINE_PATCH_LAYER_H_ 6 #define CC_LAYERS_NINE_PATCH_LAYER_H_
7 7
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "cc/base/cc_export.h" 9 #include "cc/base/cc_export.h"
10 #include "cc/layers/layer.h" 10 #include "cc/layers/layer.h"
11 #include "cc/layers/ui_resource_layer.h" 11 #include "cc/layers/ui_resource_layer.h"
12 #include "cc/resources/ui_resource_client.h" 12 #include "cc/resources/ui_resource_client.h"
13 #include "ui/gfx/geometry/rect.h" 13 #include "ui/gfx/geometry/rect.h"
14 14
15 namespace cc { 15 namespace cc {
16 16
17 class LayerTreeHost; 17 class LayerTreeHost;
18 class ScopedUIResource; 18 class ScopedUIResource;
19 19
20 class CC_EXPORT NinePatchLayer : public UIResourceLayer { 20 class CC_EXPORT NinePatchLayer : public UIResourceLayer {
21 public: 21 public:
22 static scoped_refptr<NinePatchLayer> Create(); 22 static scoped_refptr<NinePatchLayer> Create(const LayerSettings& settings);
23 23
24 void PushPropertiesTo(LayerImpl* layer) override; 24 void PushPropertiesTo(LayerImpl* layer) override;
25 25
26 // |border| is the space around the center rectangular region in layer space 26 // |border| is the space around the center rectangular region in layer space
27 // (known as aperture in image space). |border.x()| and |border.y()| are the 27 // (known as aperture in image space). |border.x()| and |border.y()| are the
28 // size of the left and top boundary, respectively. 28 // size of the left and top boundary, respectively.
29 // |border.width()-border.x()| and |border.height()-border.y()| are the size 29 // |border.width()-border.x()| and |border.height()-border.y()| are the size
30 // of the right and bottom boundary, respectively. 30 // of the right and bottom boundary, respectively.
31 void SetBorder(const gfx::Rect& border); 31 void SetBorder(const gfx::Rect& border);
32 32
33 // aperture is in the pixel space of the bitmap resource and refers to 33 // aperture is in the pixel space of the bitmap resource and refers to
34 // the center patch of the ninepatch (which is unused in this 34 // the center patch of the ninepatch (which is unused in this
35 // implementation). We split off eight rects surrounding it and stick them 35 // implementation). We split off eight rects surrounding it and stick them
36 // on the edges of the layer. The corners are unscaled, the top and bottom 36 // on the edges of the layer. The corners are unscaled, the top and bottom
37 // rects are x-stretched to fit, and the left and right rects are 37 // rects are x-stretched to fit, and the left and right rects are
38 // y-stretched to fit. 38 // y-stretched to fit.
39 void SetAperture(const gfx::Rect& aperture); 39 void SetAperture(const gfx::Rect& aperture);
40 void SetFillCenter(bool fill_center); 40 void SetFillCenter(bool fill_center);
41 41
42 private: 42 private:
43 NinePatchLayer(); 43 explicit NinePatchLayer(const LayerSettings& settings);
44 ~NinePatchLayer() override; 44 ~NinePatchLayer() override;
45 scoped_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl) override; 45 scoped_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl) override;
46 46
47 gfx::Rect border_; 47 gfx::Rect border_;
48 bool fill_center_; 48 bool fill_center_;
49 49
50 // The transparent center region that shows the parent layer's contents in 50 // The transparent center region that shows the parent layer's contents in
51 // image space. 51 // image space.
52 gfx::Rect image_aperture_; 52 gfx::Rect image_aperture_;
53 53
54 DISALLOW_COPY_AND_ASSIGN(NinePatchLayer); 54 DISALLOW_COPY_AND_ASSIGN(NinePatchLayer);
55 }; 55 };
56 56
57 } // namespace cc 57 } // namespace cc
58 58
59 #endif // CC_LAYERS_NINE_PATCH_LAYER_H_ 59 #endif // CC_LAYERS_NINE_PATCH_LAYER_H_
OLDNEW
« no previous file with comments | « cc/layers/layer_unittest.cc ('k') | cc/layers/nine_patch_layer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698