| 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 |
| 45 private: | 50 private: |
| 46 NinePatchLayer(); | 51 NinePatchLayer(); |
| 47 ~NinePatchLayer() override; | 52 ~NinePatchLayer() override; |
| 48 std::unique_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl) override; | 53 std::unique_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl) override; |
| 49 | 54 |
| 50 gfx::Rect border_; | 55 gfx::Rect border_; |
| 51 bool fill_center_; | 56 bool fill_center_; |
| 52 bool nearest_neighbor_; | 57 bool nearest_neighbor_; |
| 53 | 58 |
| 54 // The transparent center region that shows the parent layer's contents in | 59 // The transparent center region that shows the parent layer's contents in |
| 55 // image space. | 60 // image space. |
| 56 gfx::Rect image_aperture_; | 61 gfx::Rect image_aperture_; |
| 57 | 62 |
| 63 // The occluded region in layer space set by SetLayerOcclusion. It is |
| 64 // usually larger than |image_aperture_|. |
| 65 gfx::Rect layer_occlusion_; |
| 66 |
| 58 DISALLOW_COPY_AND_ASSIGN(NinePatchLayer); | 67 DISALLOW_COPY_AND_ASSIGN(NinePatchLayer); |
| 59 }; | 68 }; |
| 60 | 69 |
| 61 } // namespace cc | 70 } // namespace cc |
| 62 | 71 |
| 63 #endif // CC_LAYERS_NINE_PATCH_LAYER_H_ | 72 #endif // CC_LAYERS_NINE_PATCH_LAYER_H_ |
| OLD | NEW |