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_PICTURE_LAYER_IMPL_H_ | 5 #ifndef CC_LAYERS_PICTURE_LAYER_IMPL_H_ |
6 #define CC_LAYERS_PICTURE_LAYER_IMPL_H_ | 6 #define CC_LAYERS_PICTURE_LAYER_IMPL_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 | 9 |
10 #include <map> | 10 #include <map> |
(...skipping 13 matching lines...) Expand all Loading... |
24 struct AppendQuadsData; | 24 struct AppendQuadsData; |
25 class MicroBenchmarkImpl; | 25 class MicroBenchmarkImpl; |
26 class Tile; | 26 class Tile; |
27 | 27 |
28 class CC_EXPORT PictureLayerImpl | 28 class CC_EXPORT PictureLayerImpl |
29 : public LayerImpl, | 29 : public LayerImpl, |
30 NON_EXPORTED_BASE(public PictureLayerTilingClient) { | 30 NON_EXPORTED_BASE(public PictureLayerTilingClient) { |
31 public: | 31 public: |
32 static std::unique_ptr<PictureLayerImpl> Create(LayerTreeImpl* tree_impl, | 32 static std::unique_ptr<PictureLayerImpl> Create(LayerTreeImpl* tree_impl, |
33 int id, | 33 int id, |
34 bool is_mask) { | 34 bool is_mask, |
35 return base::WrapUnique(new PictureLayerImpl(tree_impl, id, is_mask)); | 35 bool is_single_texture_mask) { |
| 36 return base::WrapUnique( |
| 37 new PictureLayerImpl(tree_impl, id, is_mask, is_single_texture_mask)); |
36 } | 38 } |
37 ~PictureLayerImpl() override; | 39 ~PictureLayerImpl() override; |
38 | 40 |
39 bool is_mask() const { return is_mask_; } | 41 bool is_mask() const { return is_mask_; } |
| 42 bool is_single_texture_mask() const { return is_single_texture_mask_; } |
40 | 43 |
41 // LayerImpl overrides. | 44 // LayerImpl overrides. |
42 const char* LayerTypeAsString() const override; | 45 const char* LayerTypeAsString() const override; |
43 std::unique_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl) override; | 46 std::unique_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl) override; |
44 void PushPropertiesTo(LayerImpl* layer) override; | 47 void PushPropertiesTo(LayerImpl* layer) override; |
45 void AppendQuads(RenderPass* render_pass, | 48 void AppendQuads(RenderPass* render_pass, |
46 AppendQuadsData* append_quads_data) override; | 49 AppendQuadsData* append_quads_data) override; |
47 void NotifyTileStateChanged(const Tile* tile) override; | 50 void NotifyTileStateChanged(const Tile* tile) override; |
48 void ResetRasterScale(); | 51 void ResetRasterScale(); |
49 void DidBeginTracing() override; | 52 void DidBeginTracing() override; |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 bool IsOnActiveOrPendingTree() const; | 95 bool IsOnActiveOrPendingTree() const; |
93 | 96 |
94 // Used for benchmarking | 97 // Used for benchmarking |
95 RasterSource* GetRasterSource() const { return raster_source_.get(); } | 98 RasterSource* GetRasterSource() const { return raster_source_.get(); } |
96 | 99 |
97 void set_is_directly_composited_image(bool is_directly_composited_image) { | 100 void set_is_directly_composited_image(bool is_directly_composited_image) { |
98 is_directly_composited_image_ = is_directly_composited_image; | 101 is_directly_composited_image_ = is_directly_composited_image; |
99 } | 102 } |
100 | 103 |
101 protected: | 104 protected: |
102 PictureLayerImpl(LayerTreeImpl* tree_impl, int id, bool is_mask); | 105 PictureLayerImpl(LayerTreeImpl* tree_impl, |
| 106 int id, |
| 107 bool is_mask, |
| 108 bool is_single_texture_mask); |
103 PictureLayerTiling* AddTiling(float contents_scale); | 109 PictureLayerTiling* AddTiling(float contents_scale); |
104 void RemoveAllTilings(); | 110 void RemoveAllTilings(); |
105 void AddTilingsForRasterScale(); | 111 void AddTilingsForRasterScale(); |
106 void AddLowResolutionTilingIfNeeded(); | 112 void AddLowResolutionTilingIfNeeded(); |
107 bool ShouldAdjustRasterScale() const; | 113 bool ShouldAdjustRasterScale() const; |
108 void RecalculateRasterScales(); | 114 void RecalculateRasterScales(); |
109 void CleanUpTilingsOnActiveLayer( | 115 void CleanUpTilingsOnActiveLayer( |
110 const std::vector<PictureLayerTiling*>& used_tilings); | 116 const std::vector<PictureLayerTiling*>& used_tilings); |
111 float MinimumContentsScale() const; | 117 float MinimumContentsScale() const; |
112 float MaximumContentsScale() const; | 118 float MaximumContentsScale() const; |
(...skipping 24 matching lines...) Expand all Loading... |
137 | 143 |
138 float raster_page_scale_; | 144 float raster_page_scale_; |
139 float raster_device_scale_; | 145 float raster_device_scale_; |
140 float raster_source_scale_; | 146 float raster_source_scale_; |
141 float raster_contents_scale_; | 147 float raster_contents_scale_; |
142 float low_res_raster_contents_scale_; | 148 float low_res_raster_contents_scale_; |
143 | 149 |
144 bool was_screen_space_transform_animating_; | 150 bool was_screen_space_transform_animating_; |
145 bool only_used_low_res_last_append_quads_; | 151 bool only_used_low_res_last_append_quads_; |
146 const bool is_mask_; | 152 const bool is_mask_; |
| 153 const bool is_single_texture_mask_; |
147 | 154 |
148 bool nearest_neighbor_; | 155 bool nearest_neighbor_; |
149 bool is_directly_composited_image_; | 156 bool is_directly_composited_image_; |
150 | 157 |
151 // Use this instead of |visible_layer_rect()| for tiling calculations. This | 158 // Use this instead of |visible_layer_rect()| for tiling calculations. This |
152 // takes external viewport and transform for tile priority into account. | 159 // takes external viewport and transform for tile priority into account. |
153 gfx::Rect viewport_rect_for_tile_priority_in_content_space_; | 160 gfx::Rect viewport_rect_for_tile_priority_in_content_space_; |
154 | 161 |
155 gfx::Size gpu_raster_max_texture_size_; | 162 gfx::Size gpu_raster_max_texture_size_; |
156 | 163 |
157 // List of tilings that were used last time we appended quads. This can be | 164 // List of tilings that were used last time we appended quads. This can be |
158 // used as an optimization not to remove tilings if they are still being | 165 // used as an optimization not to remove tilings if they are still being |
159 // drawn. Note that accessing this vector should only be done in the context | 166 // drawn. Note that accessing this vector should only be done in the context |
160 // of comparing pointers, since objects pointed to are not guaranteed to | 167 // of comparing pointers, since objects pointed to are not guaranteed to |
161 // exist. | 168 // exist. |
162 std::vector<PictureLayerTiling*> last_append_quads_tilings_; | 169 std::vector<PictureLayerTiling*> last_append_quads_tilings_; |
163 | 170 |
164 DISALLOW_COPY_AND_ASSIGN(PictureLayerImpl); | 171 DISALLOW_COPY_AND_ASSIGN(PictureLayerImpl); |
165 }; | 172 }; |
166 | 173 |
167 } // namespace cc | 174 } // namespace cc |
168 | 175 |
169 #endif // CC_LAYERS_PICTURE_LAYER_IMPL_H_ | 176 #endif // CC_LAYERS_PICTURE_LAYER_IMPL_H_ |
OLD | NEW |