OLD | NEW |
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 #include "cc/test/fake_picture_layer_impl.h" | 5 #include "cc/test/fake_picture_layer_impl.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 #include "cc/resources/tile.h" | 8 #include "cc/resources/tile.h" |
9 #include "cc/trees/layer_tree_impl.h" | 9 #include "cc/trees/layer_tree_impl.h" |
10 | 10 |
11 namespace cc { | 11 namespace cc { |
12 | 12 |
13 FakePictureLayerImpl::FakePictureLayerImpl( | 13 FakePictureLayerImpl::FakePictureLayerImpl( |
14 LayerTreeImpl* tree_impl, | 14 LayerTreeImpl* tree_impl, |
15 int id, | 15 int id, |
16 scoped_refptr<RasterSource> raster_source, | 16 scoped_refptr<RasterSource> raster_source, |
17 bool is_mask) | 17 bool is_mask) |
18 : PictureLayerImpl(tree_impl, id, is_mask), | 18 : PictureLayerImpl(tree_impl, |
| 19 id, |
| 20 is_mask, |
| 21 new LayerImpl::SyncedScrollOffset), |
19 append_quads_count_(0), | 22 append_quads_count_(0), |
20 did_become_active_call_count_(0), | 23 did_become_active_call_count_(0), |
21 has_valid_tile_priorities_(false), | 24 has_valid_tile_priorities_(false), |
22 use_set_valid_tile_priorities_flag_(false), | 25 use_set_valid_tile_priorities_flag_(false), |
23 release_resources_count_(0) { | 26 release_resources_count_(0) { |
24 SetBounds(raster_source->GetSize()); | 27 SetBounds(raster_source->GetSize()); |
25 SetContentBounds(raster_source->GetSize()); | 28 SetContentBounds(raster_source->GetSize()); |
26 SetRasterSourceOnPending(raster_source, Region()); | 29 SetRasterSourceOnPending(raster_source, Region()); |
27 } | 30 } |
28 | 31 |
29 FakePictureLayerImpl::FakePictureLayerImpl( | 32 FakePictureLayerImpl::FakePictureLayerImpl( |
30 LayerTreeImpl* tree_impl, | 33 LayerTreeImpl* tree_impl, |
31 int id, | 34 int id, |
32 scoped_refptr<RasterSource> raster_source, | 35 scoped_refptr<RasterSource> raster_source, |
33 bool is_mask, | 36 bool is_mask, |
34 const gfx::Size& layer_bounds) | 37 const gfx::Size& layer_bounds) |
35 : PictureLayerImpl(tree_impl, id, is_mask), | 38 : PictureLayerImpl(tree_impl, |
| 39 id, |
| 40 is_mask, |
| 41 new LayerImpl::SyncedScrollOffset), |
36 append_quads_count_(0), | 42 append_quads_count_(0), |
37 did_become_active_call_count_(0), | 43 did_become_active_call_count_(0), |
38 has_valid_tile_priorities_(false), | 44 has_valid_tile_priorities_(false), |
39 use_set_valid_tile_priorities_flag_(false), | 45 use_set_valid_tile_priorities_flag_(false), |
40 release_resources_count_(0) { | 46 release_resources_count_(0) { |
41 SetBounds(layer_bounds); | 47 SetBounds(layer_bounds); |
42 SetContentBounds(layer_bounds); | 48 SetContentBounds(layer_bounds); |
43 SetRasterSourceOnPending(raster_source, Region()); | 49 SetRasterSourceOnPending(raster_source, Region()); |
44 } | 50 } |
45 | 51 |
46 FakePictureLayerImpl::FakePictureLayerImpl(LayerTreeImpl* tree_impl, | 52 FakePictureLayerImpl::FakePictureLayerImpl(LayerTreeImpl* tree_impl, |
47 int id, | 53 int id, |
48 bool is_mask) | 54 bool is_mask) |
49 : PictureLayerImpl(tree_impl, id, is_mask), | 55 : FakePictureLayerImpl(tree_impl, |
| 56 id, |
| 57 is_mask, |
| 58 new LayerImpl::SyncedScrollOffset) { |
| 59 } |
| 60 |
| 61 FakePictureLayerImpl::FakePictureLayerImpl( |
| 62 LayerTreeImpl* tree_impl, |
| 63 int id, |
| 64 bool is_mask, |
| 65 scoped_refptr<LayerImpl::SyncedScrollOffset> synced_scroll_offset) |
| 66 : PictureLayerImpl(tree_impl, id, is_mask, synced_scroll_offset), |
50 append_quads_count_(0), | 67 append_quads_count_(0), |
51 did_become_active_call_count_(0), | 68 did_become_active_call_count_(0), |
52 has_valid_tile_priorities_(false), | 69 has_valid_tile_priorities_(false), |
53 use_set_valid_tile_priorities_flag_(false), | 70 use_set_valid_tile_priorities_flag_(false), |
54 release_resources_count_(0) { | 71 release_resources_count_(0) { |
55 } | 72 } |
56 | 73 |
57 scoped_ptr<LayerImpl> FakePictureLayerImpl::CreateLayerImpl( | 74 scoped_ptr<LayerImpl> FakePictureLayerImpl::CreateLayerImpl( |
58 LayerTreeImpl* tree_impl) { | 75 LayerTreeImpl* tree_impl) { |
59 return make_scoped_ptr(new FakePictureLayerImpl(tree_impl, id(), is_mask_)); | 76 return make_scoped_ptr(new FakePictureLayerImpl(tree_impl, id(), is_mask_, |
| 77 synced_scroll_offset())); |
60 } | 78 } |
61 | 79 |
62 void FakePictureLayerImpl::PushPropertiesTo(LayerImpl* layer_impl) { | 80 void FakePictureLayerImpl::PushPropertiesTo(LayerImpl* layer_impl) { |
63 FakePictureLayerImpl* picture_layer_impl = | 81 FakePictureLayerImpl* picture_layer_impl = |
64 static_cast<FakePictureLayerImpl*>(layer_impl); | 82 static_cast<FakePictureLayerImpl*>(layer_impl); |
65 picture_layer_impl->fixed_tile_size_ = fixed_tile_size_; | 83 picture_layer_impl->fixed_tile_size_ = fixed_tile_size_; |
66 PictureLayerImpl::PushPropertiesTo(layer_impl); | 84 PictureLayerImpl::PushPropertiesTo(layer_impl); |
67 } | 85 } |
68 | 86 |
69 void FakePictureLayerImpl::AppendQuads( | 87 void FakePictureLayerImpl::AppendQuads( |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
248 return CountTilesRequired( | 266 return CountTilesRequired( |
249 &PictureLayerTiling::IsTileRequiredForDrawIfVisible); | 267 &PictureLayerTiling::IsTileRequiredForDrawIfVisible); |
250 } | 268 } |
251 | 269 |
252 void FakePictureLayerImpl::ReleaseResources() { | 270 void FakePictureLayerImpl::ReleaseResources() { |
253 PictureLayerImpl::ReleaseResources(); | 271 PictureLayerImpl::ReleaseResources(); |
254 ++release_resources_count_; | 272 ++release_resources_count_; |
255 } | 273 } |
256 | 274 |
257 } // namespace cc | 275 } // namespace cc |
OLD | NEW |