Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(468)

Side by Side Diff: cc/test/fake_picture_layer_impl.h

Issue 2688673003: cc: Distinguish single texture mask from normal masks (Closed)
Patch Set: Rebase Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « cc/test/fake_picture_layer.cc ('k') | cc/test/fake_picture_layer_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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_TEST_FAKE_PICTURE_LAYER_IMPL_H_ 5 #ifndef CC_TEST_FAKE_PICTURE_LAYER_IMPL_H_
6 #define CC_TEST_FAKE_PICTURE_LAYER_IMPL_H_ 6 #define CC_TEST_FAKE_PICTURE_LAYER_IMPL_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 9
10 #include <memory> 10 #include <memory>
11 11
12 #include "base/memory/ptr_util.h" 12 #include "base/memory/ptr_util.h"
13 #include "cc/layers/picture_layer_impl.h" 13 #include "cc/layers/picture_layer_impl.h"
14 #include "cc/playback/raster_source.h" 14 #include "cc/playback/raster_source.h"
15 15
16 namespace cc { 16 namespace cc {
17 17
18 class FakePictureLayerImpl : public PictureLayerImpl { 18 class FakePictureLayerImpl : public PictureLayerImpl {
19 public: 19 public:
20 using TileRequirementCheck = bool (PictureLayerTiling::*)(const Tile*) const; 20 using TileRequirementCheck = bool (PictureLayerTiling::*)(const Tile*) const;
21 21
22 static std::unique_ptr<FakePictureLayerImpl> Create(LayerTreeImpl* tree_impl, 22 static std::unique_ptr<FakePictureLayerImpl> Create(LayerTreeImpl* tree_impl,
23 int id) { 23 int id) {
24 bool is_mask = false; 24 Layer::LayerMaskType mask_type = Layer::LayerMaskType::NOT_MASK;
25 return base::WrapUnique(new FakePictureLayerImpl(tree_impl, id, is_mask)); 25 return base::WrapUnique(new FakePictureLayerImpl(tree_impl, id, mask_type));
26 } 26 }
27 27
28 static std::unique_ptr<FakePictureLayerImpl> CreateMask( 28 static std::unique_ptr<FakePictureLayerImpl> CreateMask(
29 LayerTreeImpl* tree_impl, 29 LayerTreeImpl* tree_impl,
30 int id) { 30 int id) {
31 bool is_mask = true; 31 Layer::LayerMaskType mask_type = Layer::LayerMaskType::MULTI_TEXTURE_MASK;
32 return base::WrapUnique(new FakePictureLayerImpl(tree_impl, id, is_mask)); 32 return base::WrapUnique(new FakePictureLayerImpl(tree_impl, id, mask_type));
33 }
34
35 static std::unique_ptr<FakePictureLayerImpl> CreateSingleTextureMask(
36 LayerTreeImpl* tree_impl,
37 int id) {
38 Layer::LayerMaskType mask_type = Layer::LayerMaskType::SINGLE_TEXTURE_MASK;
39 return base::WrapUnique(new FakePictureLayerImpl(tree_impl, id, mask_type));
33 } 40 }
34 41
35 // Create layer from a raster source that covers the entire layer. 42 // Create layer from a raster source that covers the entire layer.
36 static std::unique_ptr<FakePictureLayerImpl> CreateWithRasterSource( 43 static std::unique_ptr<FakePictureLayerImpl> CreateWithRasterSource(
37 LayerTreeImpl* tree_impl, 44 LayerTreeImpl* tree_impl,
38 int id, 45 int id,
39 scoped_refptr<RasterSource> raster_source) { 46 scoped_refptr<RasterSource> raster_source) {
40 bool is_mask = false; 47 Layer::LayerMaskType mask_type = Layer::LayerMaskType::NOT_MASK;
41 return base::WrapUnique( 48 return base::WrapUnique(
42 new FakePictureLayerImpl(tree_impl, id, raster_source, is_mask)); 49 new FakePictureLayerImpl(tree_impl, id, raster_source, mask_type));
43 } 50 }
44 51
45 // Create layer from a raster source that only covers part of the layer. 52 // Create layer from a raster source that only covers part of the layer.
46 static std::unique_ptr<FakePictureLayerImpl> CreateWithPartialRasterSource( 53 static std::unique_ptr<FakePictureLayerImpl> CreateWithPartialRasterSource(
47 LayerTreeImpl* tree_impl, 54 LayerTreeImpl* tree_impl,
48 int id, 55 int id,
49 scoped_refptr<RasterSource> raster_source, 56 scoped_refptr<RasterSource> raster_source,
50 const gfx::Size& layer_bounds) { 57 const gfx::Size& layer_bounds) {
51 bool is_mask = false; 58 Layer::LayerMaskType mask_type = Layer::LayerMaskType::NOT_MASK;
52 return base::WrapUnique(new FakePictureLayerImpl( 59 return base::WrapUnique(new FakePictureLayerImpl(
53 tree_impl, id, raster_source, is_mask, layer_bounds)); 60 tree_impl, id, raster_source, mask_type, layer_bounds));
54 } 61 }
55 62
56 // Create layer from a raster source that covers the entire layer and is a 63 // Create layer from a raster source that covers the entire layer and is a
57 // mask. 64 // mask.
58 static std::unique_ptr<FakePictureLayerImpl> CreateMaskWithRasterSource( 65 static std::unique_ptr<FakePictureLayerImpl> CreateMaskWithRasterSource(
59 LayerTreeImpl* tree_impl, 66 LayerTreeImpl* tree_impl,
60 int id, 67 int id,
61 scoped_refptr<RasterSource> raster_source) { 68 scoped_refptr<RasterSource> raster_source) {
62 bool is_mask = true; 69 Layer::LayerMaskType mask_type = Layer::LayerMaskType::MULTI_TEXTURE_MASK;
63 return base::WrapUnique( 70 return base::WrapUnique(
64 new FakePictureLayerImpl(tree_impl, id, raster_source, is_mask)); 71 new FakePictureLayerImpl(tree_impl, id, raster_source, mask_type));
72 }
73
74 static std::unique_ptr<FakePictureLayerImpl>
75 CreateSingleTextureMaskWithRasterSource(
76 LayerTreeImpl* tree_impl,
77 int id,
78 scoped_refptr<RasterSource> raster_source) {
79 Layer::LayerMaskType mask_type = Layer::LayerMaskType::SINGLE_TEXTURE_MASK;
80 return base::WrapUnique(
81 new FakePictureLayerImpl(tree_impl, id, raster_source, mask_type));
65 } 82 }
66 83
67 std::unique_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl) override; 84 std::unique_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl) override;
68 void PushPropertiesTo(LayerImpl* layer_impl) override; 85 void PushPropertiesTo(LayerImpl* layer_impl) override;
69 void AppendQuads(RenderPass* render_pass, 86 void AppendQuads(RenderPass* render_pass,
70 AppendQuadsData* append_quads_data) override; 87 AppendQuadsData* append_quads_data) override;
71 gfx::Size CalculateTileSize(const gfx::Size& content_bounds) const override; 88 gfx::Size CalculateTileSize(const gfx::Size& content_bounds) const override;
72 89
73 void DidBecomeActive() override; 90 void DidBecomeActive() override;
74 size_t did_become_active_call_count() { 91 size_t did_become_active_call_count() {
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 void ReleaseTileResources() override; 165 void ReleaseTileResources() override;
149 166
150 bool only_used_low_res_last_append_quads() const { 167 bool only_used_low_res_last_append_quads() const {
151 return only_used_low_res_last_append_quads_; 168 return only_used_low_res_last_append_quads_;
152 } 169 }
153 170
154 protected: 171 protected:
155 FakePictureLayerImpl(LayerTreeImpl* tree_impl, 172 FakePictureLayerImpl(LayerTreeImpl* tree_impl,
156 int id, 173 int id,
157 scoped_refptr<RasterSource> raster_source, 174 scoped_refptr<RasterSource> raster_source,
158 bool is_mask); 175 Layer::LayerMaskType mask_type);
159 FakePictureLayerImpl(LayerTreeImpl* tree_impl, 176 FakePictureLayerImpl(LayerTreeImpl* tree_impl,
160 int id, 177 int id,
161 scoped_refptr<RasterSource> raster_source, 178 scoped_refptr<RasterSource> raster_source,
162 bool is_mask, 179 Layer::LayerMaskType mask_type,
163 const gfx::Size& layer_bounds); 180 const gfx::Size& layer_bounds);
164 FakePictureLayerImpl(LayerTreeImpl* tree_impl, int id, bool is_mask); 181 FakePictureLayerImpl(LayerTreeImpl* tree_impl,
182 int id,
183 Layer::LayerMaskType mask_type);
165 184
166 private: 185 private:
167 gfx::Size fixed_tile_size_; 186 gfx::Size fixed_tile_size_;
168 187
169 size_t append_quads_count_ = 0; 188 size_t append_quads_count_ = 0;
170 size_t did_become_active_call_count_ = 0; 189 size_t did_become_active_call_count_ = 0;
171 bool has_valid_tile_priorities_ = false; 190 bool has_valid_tile_priorities_ = false;
172 bool use_set_valid_tile_priorities_flag_ = false; 191 bool use_set_valid_tile_priorities_flag_ = false;
173 size_t release_resources_count_ = 0; 192 size_t release_resources_count_ = 0;
174 size_t release_tile_resources_count_ = 0; 193 size_t release_tile_resources_count_ = 0;
175 }; 194 };
176 195
177 } // namespace cc 196 } // namespace cc
178 197
179 #endif // CC_TEST_FAKE_PICTURE_LAYER_IMPL_H_ 198 #endif // CC_TEST_FAKE_PICTURE_LAYER_IMPL_H_
OLDNEW
« no previous file with comments | « cc/test/fake_picture_layer.cc ('k') | cc/test/fake_picture_layer_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698