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

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

Issue 2688673003: cc: Distinguish single texture mask from normal masks (Closed)
Patch Set: 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
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 bool is_mask = false;
25 return base::WrapUnique(new FakePictureLayerImpl(tree_impl, id, is_mask)); 25 bool is_single_texture_mask = false;
26 return base::WrapUnique(new FakePictureLayerImpl(tree_impl, id, is_mask,
27 is_single_texture_mask));
26 } 28 }
27 29
28 static std::unique_ptr<FakePictureLayerImpl> CreateMask( 30 static std::unique_ptr<FakePictureLayerImpl> CreateMask(
29 LayerTreeImpl* tree_impl, 31 LayerTreeImpl* tree_impl,
30 int id) { 32 int id) {
31 bool is_mask = true; 33 bool is_mask = true;
32 return base::WrapUnique(new FakePictureLayerImpl(tree_impl, id, is_mask)); 34 bool is_single_texture_mask = false;
35 return base::WrapUnique(new FakePictureLayerImpl(tree_impl, id, is_mask,
36 is_single_texture_mask));
37 }
38
39 static std::unique_ptr<FakePictureLayerImpl> CreateSingleTextureMask(
40 LayerTreeImpl* tree_impl,
41 int id) {
42 bool is_mask = true;
43 bool is_single_texture_mask = true;
44 return base::WrapUnique(new FakePictureLayerImpl(tree_impl, id, is_mask,
45 is_single_texture_mask));
33 } 46 }
34 47
35 // Create layer from a raster source that covers the entire layer. 48 // Create layer from a raster source that covers the entire layer.
36 static std::unique_ptr<FakePictureLayerImpl> CreateWithRasterSource( 49 static std::unique_ptr<FakePictureLayerImpl> CreateWithRasterSource(
37 LayerTreeImpl* tree_impl, 50 LayerTreeImpl* tree_impl,
38 int id, 51 int id,
39 scoped_refptr<RasterSource> raster_source) { 52 scoped_refptr<RasterSource> raster_source) {
40 bool is_mask = false; 53 bool is_mask = false;
41 return base::WrapUnique( 54 bool is_single_texture_mask = false;
42 new FakePictureLayerImpl(tree_impl, id, raster_source, is_mask)); 55 return base::WrapUnique(new FakePictureLayerImpl(
56 tree_impl, id, raster_source, is_mask, is_single_texture_mask));
43 } 57 }
44 58
45 // Create layer from a raster source that only covers part of the layer. 59 // Create layer from a raster source that only covers part of the layer.
46 static std::unique_ptr<FakePictureLayerImpl> CreateWithPartialRasterSource( 60 static std::unique_ptr<FakePictureLayerImpl> CreateWithPartialRasterSource(
47 LayerTreeImpl* tree_impl, 61 LayerTreeImpl* tree_impl,
48 int id, 62 int id,
49 scoped_refptr<RasterSource> raster_source, 63 scoped_refptr<RasterSource> raster_source,
50 const gfx::Size& layer_bounds) { 64 const gfx::Size& layer_bounds) {
51 bool is_mask = false; 65 bool is_mask = false;
52 return base::WrapUnique(new FakePictureLayerImpl( 66 bool is_single_texture_mask = false;
53 tree_impl, id, raster_source, is_mask, layer_bounds)); 67 return base::WrapUnique(
68 new FakePictureLayerImpl(tree_impl, id, raster_source, is_mask,
69 is_single_texture_mask, layer_bounds));
54 } 70 }
55 71
56 // Create layer from a raster source that covers the entire layer and is a 72 // Create layer from a raster source that covers the entire layer and is a
57 // mask. 73 // mask.
58 static std::unique_ptr<FakePictureLayerImpl> CreateMaskWithRasterSource( 74 static std::unique_ptr<FakePictureLayerImpl> CreateMaskWithRasterSource(
59 LayerTreeImpl* tree_impl, 75 LayerTreeImpl* tree_impl,
60 int id, 76 int id,
61 scoped_refptr<RasterSource> raster_source) { 77 scoped_refptr<RasterSource> raster_source) {
62 bool is_mask = true; 78 bool is_mask = true;
63 return base::WrapUnique( 79 bool is_single_texture_mask = false;
64 new FakePictureLayerImpl(tree_impl, id, raster_source, is_mask)); 80 return base::WrapUnique(new FakePictureLayerImpl(
81 tree_impl, id, raster_source, is_mask, is_single_texture_mask));
82 }
83
84 static std::unique_ptr<FakePictureLayerImpl>
85 CreateSingleTextureMaskWithRasterSource(
86 LayerTreeImpl* tree_impl,
87 int id,
88 scoped_refptr<RasterSource> raster_source) {
89 bool is_mask = true;
90 bool is_single_texture_mask = true;
91 return base::WrapUnique(new FakePictureLayerImpl(
92 tree_impl, id, raster_source, is_mask, is_single_texture_mask));
65 } 93 }
66 94
67 std::unique_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl) override; 95 std::unique_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl) override;
68 void PushPropertiesTo(LayerImpl* layer_impl) override; 96 void PushPropertiesTo(LayerImpl* layer_impl) override;
69 void AppendQuads(RenderPass* render_pass, 97 void AppendQuads(RenderPass* render_pass,
70 AppendQuadsData* append_quads_data) override; 98 AppendQuadsData* append_quads_data) override;
71 gfx::Size CalculateTileSize(const gfx::Size& content_bounds) const override; 99 gfx::Size CalculateTileSize(const gfx::Size& content_bounds) const override;
72 100
73 void DidBecomeActive() override; 101 void DidBecomeActive() override;
74 size_t did_become_active_call_count() { 102 size_t did_become_active_call_count() {
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 void ReleaseTileResources() override; 176 void ReleaseTileResources() override;
149 177
150 bool only_used_low_res_last_append_quads() const { 178 bool only_used_low_res_last_append_quads() const {
151 return only_used_low_res_last_append_quads_; 179 return only_used_low_res_last_append_quads_;
152 } 180 }
153 181
154 protected: 182 protected:
155 FakePictureLayerImpl(LayerTreeImpl* tree_impl, 183 FakePictureLayerImpl(LayerTreeImpl* tree_impl,
156 int id, 184 int id,
157 scoped_refptr<RasterSource> raster_source, 185 scoped_refptr<RasterSource> raster_source,
158 bool is_mask);
159 FakePictureLayerImpl(LayerTreeImpl* tree_impl,
160 int id,
161 scoped_refptr<RasterSource> raster_source,
162 bool is_mask, 186 bool is_mask,
187 bool is_single_texture_mask);
188 FakePictureLayerImpl(LayerTreeImpl* tree_impl,
189 int id,
190 scoped_refptr<RasterSource> raster_source,
191 bool is_mask,
192 bool is_single_texture_mask,
163 const gfx::Size& layer_bounds); 193 const gfx::Size& layer_bounds);
164 FakePictureLayerImpl(LayerTreeImpl* tree_impl, int id, bool is_mask); 194 FakePictureLayerImpl(LayerTreeImpl* tree_impl,
195 int id,
196 bool is_mask,
197 bool is_single_texture_mask);
165 198
166 private: 199 private:
167 gfx::Size fixed_tile_size_; 200 gfx::Size fixed_tile_size_;
168 201
169 size_t append_quads_count_ = 0; 202 size_t append_quads_count_ = 0;
170 size_t did_become_active_call_count_ = 0; 203 size_t did_become_active_call_count_ = 0;
171 bool has_valid_tile_priorities_ = false; 204 bool has_valid_tile_priorities_ = false;
172 bool use_set_valid_tile_priorities_flag_ = false; 205 bool use_set_valid_tile_priorities_flag_ = false;
173 size_t release_resources_count_ = 0; 206 size_t release_resources_count_ = 0;
174 size_t release_tile_resources_count_ = 0; 207 size_t release_tile_resources_count_ = 0;
175 }; 208 };
176 209
177 } // namespace cc 210 } // namespace cc
178 211
179 #endif // CC_TEST_FAKE_PICTURE_LAYER_IMPL_H_ 212 #endif // CC_TEST_FAKE_PICTURE_LAYER_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698