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_IMPL_H_ | 5 #ifndef CC_LAYERS_NINE_PATCH_LAYER_IMPL_H_ |
6 #define CC_LAYERS_NINE_PATCH_LAYER_IMPL_H_ | 6 #define CC_LAYERS_NINE_PATCH_LAYER_IMPL_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
(...skipping 15 matching lines...) Expand all Loading... | |
26 public: | 26 public: |
27 static scoped_ptr<NinePatchLayerImpl> Create(LayerTreeImpl* tree_impl, | 27 static scoped_ptr<NinePatchLayerImpl> Create(LayerTreeImpl* tree_impl, |
28 int id) { | 28 int id) { |
29 return make_scoped_ptr(new NinePatchLayerImpl(tree_impl, id)); | 29 return make_scoped_ptr(new NinePatchLayerImpl(tree_impl, id)); |
30 } | 30 } |
31 ~NinePatchLayerImpl() override; | 31 ~NinePatchLayerImpl() override; |
32 | 32 |
33 // The bitmap stretches out the bounds of the layer. The following picture | 33 // The bitmap stretches out the bounds of the layer. The following picture |
34 // illustrates the parameters associated with the dimensions. | 34 // illustrates the parameters associated with the dimensions. |
35 // | 35 // |
36 // Layer space layout Bitmap space layout | 36 // Layer space layout |
37 // | 37 // |
38 // ------------------------ ~~~~~~~~~~ W ~~~~~~~~~~ | 38 // -------------------------------- |
39 // | : | : : | | 39 // | : : | |
40 // | C | : Y | | 40 // | J C | |
41 // | : | : : | | 41 // | : : | |
42 // | ------------ | :~~X~~------------ | | 42 // | ------------------ | |
43 // | | | | : | : | | 43 // | | : | | |
44 // | | | | : | : | | 44 // |~~~I~~| ------------ | | |
45 // |~~A~~| |~~B~~| H | Q | | 45 // | | | | | | |
46 // | | | | : | : | | 46 // | | | | | | |
47 // | ------------ | : ~~~~~P~~~~~ | | 47 // |~~~A~~|~~| |~~|~B~~~~| |
48 // | : | : | | 48 // | | | | | | |
49 // | D | : | | 49 // | L ------------ | | |
50 // | : | : | | 50 // | | : | | |
51 // ------------------------ ------------------------ | 51 // | ---K-------------- | |
52 // | D | | |
53 // | : | | |
54 // | : | | |
55 // -------------------------------- | |
56 // | |
57 // Bitmap space layout | |
58 // | |
59 // ~~~~~~~~~~ W ~~~~~~~~~~ | |
60 // : : | | |
61 // : Y | | |
62 // : : | | |
63 // :~~X~~------------ | | |
64 // : | : | | |
65 // : | : | | |
66 // H | Q | | |
67 // : | : | | |
68 // : ~~~~~P~~~~~ | | |
69 // : | | |
70 // : | | |
71 // : | | |
72 // ------------------------ | |
52 // | 73 // |
53 // |image_bounds| = (W, H) | 74 // |image_bounds| = (W, H) |
54 // |image_aperture| = (X, Y, P, Q) | 75 // |image_aperture| = (X, Y, P, Q) |
55 // |border| = (A, C, A + B, C + D) | 76 // |border| = (A, C, A + B, C + D) |
56 // |fill_center| indicates whether to draw the center quad or not. | 77 // |fill_center| indicates whether to draw the center quad or not. |
78 // |occlusion_rectangle| = (I, J, K, L) | |
57 void SetLayout(const gfx::Rect& image_aperture, | 79 void SetLayout(const gfx::Rect& image_aperture, |
58 const gfx::Rect& border, | 80 const gfx::Rect& border, |
59 bool fill_center, | 81 bool fill_center, |
60 bool nearest_neighbor); | 82 bool nearest_neighbor, |
83 const gfx::Rect& layer_occlusion); | |
61 | 84 |
62 scoped_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl) override; | 85 scoped_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl) override; |
63 void PushPropertiesTo(LayerImpl* layer) override; | 86 void PushPropertiesTo(LayerImpl* layer) override; |
64 | 87 |
65 void AppendQuads(RenderPass* render_pass, | 88 void AppendQuads(RenderPass* render_pass, |
66 AppendQuadsData* append_quads_data) override; | 89 AppendQuadsData* append_quads_data) override; |
67 | 90 |
68 base::DictionaryValue* LayerTreeAsJson() const override; | 91 base::DictionaryValue* LayerTreeAsJson() const override; |
69 | 92 |
70 protected: | 93 protected: |
71 NinePatchLayerImpl(LayerTreeImpl* tree_impl, int id); | 94 NinePatchLayerImpl(LayerTreeImpl* tree_impl, int id); |
72 | 95 |
73 private: | 96 private: |
74 const char* LayerTypeAsString() const override; | 97 const char* LayerTypeAsString() const override; |
75 | 98 |
76 void CheckGeometryLimitations(); | 99 void CheckGeometryLimitations(); |
77 | 100 |
101 void AppendQuadsWithOcclusion(RenderPass* render_pass, | |
aelias_OOO_until_Jul13
2016/04/20 05:54:57
These methods should be marked "const".
llandwerlin-old
2016/04/21 09:53:14
Done.
| |
102 ResourceId resource, | |
103 SharedQuadState* shared_quad_state, | |
104 std::vector<gfx::Rect>* image_rects, | |
105 std::vector<gfx::Rect>* layer_rects); | |
106 void AppendQuadsWithoutOcclusion(RenderPass* render_pass, | |
107 ResourceId resource, | |
108 SharedQuadState* shared_quad_state, | |
109 std::vector<gfx::Rect>* image_rects, | |
110 std::vector<gfx::Rect>* layer_rects); | |
111 | |
78 // The transparent center region that shows the parent layer's contents in | 112 // The transparent center region that shows the parent layer's contents in |
79 // image space. | 113 // image space. |
80 gfx::Rect image_aperture_; | 114 gfx::Rect image_aperture_; |
81 | 115 |
82 // An inset border that the patches will be mapped to. | 116 // An inset border that the patches will be mapped to. |
83 gfx::Rect border_; | 117 gfx::Rect border_; |
84 | 118 |
85 bool fill_center_; | 119 bool fill_center_; |
86 | 120 |
87 bool nearest_neighbor_; | 121 bool nearest_neighbor_; |
88 | 122 |
123 gfx::Rect layer_occlusion_; | |
124 | |
89 DISALLOW_COPY_AND_ASSIGN(NinePatchLayerImpl); | 125 DISALLOW_COPY_AND_ASSIGN(NinePatchLayerImpl); |
90 }; | 126 }; |
91 | 127 |
92 } // namespace cc | 128 } // namespace cc |
93 | 129 |
94 #endif // CC_LAYERS_NINE_PATCH_LAYER_IMPL_H_ | 130 #endif // CC_LAYERS_NINE_PATCH_LAYER_IMPL_H_ |
OLD | NEW |