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