OLD | NEW |
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 <memory> | 8 #include <memory> |
9 | 9 |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
(...skipping 24 matching lines...) Expand all Loading... |
35 // aperture is in the pixel space of the bitmap resource and refers to | 35 // aperture is in the pixel space of the bitmap resource and refers to |
36 // the center patch of the ninepatch (which is unused in this | 36 // the center patch of the ninepatch (which is unused in this |
37 // implementation). We split off eight rects surrounding it and stick them | 37 // implementation). We split off eight rects surrounding it and stick them |
38 // on the edges of the layer. The corners are unscaled, the top and bottom | 38 // on the edges of the layer. The corners are unscaled, the top and bottom |
39 // rects are x-stretched to fit, and the left and right rects are | 39 // rects are x-stretched to fit, and the left and right rects are |
40 // y-stretched to fit. | 40 // y-stretched to fit. |
41 void SetAperture(const gfx::Rect& aperture); | 41 void SetAperture(const gfx::Rect& aperture); |
42 void SetFillCenter(bool fill_center); | 42 void SetFillCenter(bool fill_center); |
43 void SetNearestNeighbor(bool nearest_neighbor); | 43 void SetNearestNeighbor(bool nearest_neighbor); |
44 | 44 |
45 // |rect| is the space completely occluded by another layer in layer | |
46 // space. This can be used for example to occlude the entire window's | |
47 // content when drawing the shadow with a 9 patches layer. | |
48 void SetLayerOcclusion(const gfx::Rect& occlusion); | |
49 | |
50 private: | 45 private: |
51 NinePatchLayer(); | 46 NinePatchLayer(); |
52 ~NinePatchLayer() override; | 47 ~NinePatchLayer() override; |
53 std::unique_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl) override; | 48 std::unique_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl) override; |
54 | 49 |
55 gfx::Rect border_; | 50 gfx::Rect border_; |
56 bool fill_center_; | 51 bool fill_center_; |
57 bool nearest_neighbor_; | 52 bool nearest_neighbor_; |
58 | 53 |
59 // The transparent center region that shows the parent layer's contents in | 54 // The transparent center region that shows the parent layer's contents in |
60 // image space. | 55 // image space. |
61 gfx::Rect image_aperture_; | 56 gfx::Rect image_aperture_; |
62 | 57 |
63 // The occluded region in layer space set by SetLayerOcclusion. It is | |
64 // usually larger than |image_aperture_|. | |
65 gfx::Rect layer_occlusion_; | |
66 | |
67 DISALLOW_COPY_AND_ASSIGN(NinePatchLayer); | 58 DISALLOW_COPY_AND_ASSIGN(NinePatchLayer); |
68 }; | 59 }; |
69 | 60 |
70 } // namespace cc | 61 } // namespace cc |
71 | 62 |
72 #endif // CC_LAYERS_NINE_PATCH_LAYER_H_ | 63 #endif // CC_LAYERS_NINE_PATCH_LAYER_H_ |
OLD | NEW |