| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/memory/ptr_util.h" | 11 #include "base/memory/ptr_util.h" |
| 12 #include "cc/tiles/tile.h" | 12 #include "cc/tiles/tile.h" |
| 13 #include "cc/trees/layer_tree_impl.h" | 13 #include "cc/trees/layer_tree_impl.h" |
| 14 | 14 |
| 15 namespace cc { | 15 namespace cc { |
| 16 | 16 |
| 17 FakePictureLayerImpl::FakePictureLayerImpl( | 17 FakePictureLayerImpl::FakePictureLayerImpl( |
| 18 LayerTreeImpl* tree_impl, | 18 LayerTreeImpl* tree_impl, |
| 19 int id, | 19 int id, |
| 20 scoped_refptr<RasterSource> raster_source, | 20 scoped_refptr<RasterSource> raster_source, |
| 21 bool is_mask) | 21 bool is_mask) |
| 22 : PictureLayerImpl(tree_impl, id, is_mask), | 22 : PictureLayerImpl(tree_impl, id, is_mask), |
| 23 append_quads_count_(0), | 23 append_quads_count_(0), |
| 24 did_become_active_call_count_(0), | 24 did_become_active_call_count_(0), |
| 25 has_valid_tile_priorities_(false), | 25 has_valid_tile_priorities_(false), |
| 26 use_set_valid_tile_priorities_flag_(false), | 26 use_set_valid_tile_priorities_flag_(false), |
| 27 release_resources_count_(0) { | 27 release_resources_count_(0) { |
| 28 SetElementId(NextElementId()); |
| 28 SetBounds(raster_source->GetSize()); | 29 SetBounds(raster_source->GetSize()); |
| 29 SetRasterSourceOnPending(raster_source, Region()); | 30 SetRasterSourceOnPending(raster_source, Region()); |
| 30 } | 31 } |
| 31 | 32 |
| 32 FakePictureLayerImpl::FakePictureLayerImpl( | 33 FakePictureLayerImpl::FakePictureLayerImpl( |
| 33 LayerTreeImpl* tree_impl, | 34 LayerTreeImpl* tree_impl, |
| 34 int id, | 35 int id, |
| 35 scoped_refptr<RasterSource> raster_source, | 36 scoped_refptr<RasterSource> raster_source, |
| 36 bool is_mask, | 37 bool is_mask, |
| 37 const gfx::Size& layer_bounds) | 38 const gfx::Size& layer_bounds) |
| 38 : PictureLayerImpl(tree_impl, id, is_mask), | 39 : PictureLayerImpl(tree_impl, id, is_mask), |
| 39 append_quads_count_(0), | 40 append_quads_count_(0), |
| 40 did_become_active_call_count_(0), | 41 did_become_active_call_count_(0), |
| 41 has_valid_tile_priorities_(false), | 42 has_valid_tile_priorities_(false), |
| 42 use_set_valid_tile_priorities_flag_(false), | 43 use_set_valid_tile_priorities_flag_(false), |
| 43 release_resources_count_(0) { | 44 release_resources_count_(0) { |
| 45 SetElementId(NextElementId()); |
| 44 SetBounds(layer_bounds); | 46 SetBounds(layer_bounds); |
| 45 SetRasterSourceOnPending(raster_source, Region()); | 47 SetRasterSourceOnPending(raster_source, Region()); |
| 46 } | 48 } |
| 47 | 49 |
| 48 FakePictureLayerImpl::FakePictureLayerImpl(LayerTreeImpl* tree_impl, | 50 FakePictureLayerImpl::FakePictureLayerImpl(LayerTreeImpl* tree_impl, |
| 49 int id, | 51 int id, |
| 50 bool is_mask) | 52 bool is_mask) |
| 51 : PictureLayerImpl(tree_impl, id, is_mask), | 53 : PictureLayerImpl(tree_impl, id, is_mask), |
| 52 append_quads_count_(0), | 54 append_quads_count_(0), |
| 53 did_become_active_call_count_(0), | 55 did_become_active_call_count_(0), |
| 54 has_valid_tile_priorities_(false), | 56 has_valid_tile_priorities_(false), |
| 55 use_set_valid_tile_priorities_flag_(false), | 57 use_set_valid_tile_priorities_flag_(false), |
| 56 release_resources_count_(0) {} | 58 release_resources_count_(0) { |
| 59 SetElementId(NextElementId()); |
| 60 } |
| 57 | 61 |
| 58 std::unique_ptr<LayerImpl> FakePictureLayerImpl::CreateLayerImpl( | 62 std::unique_ptr<LayerImpl> FakePictureLayerImpl::CreateLayerImpl( |
| 59 LayerTreeImpl* tree_impl) { | 63 LayerTreeImpl* tree_impl) { |
| 60 return base::WrapUnique(new FakePictureLayerImpl(tree_impl, id(), is_mask_)); | 64 return base::WrapUnique(new FakePictureLayerImpl(tree_impl, id(), is_mask_)); |
| 61 } | 65 } |
| 62 | 66 |
| 63 void FakePictureLayerImpl::PushPropertiesTo(LayerImpl* layer_impl) { | 67 void FakePictureLayerImpl::PushPropertiesTo(LayerImpl* layer_impl) { |
| 64 FakePictureLayerImpl* picture_layer_impl = | 68 FakePictureLayerImpl* picture_layer_impl = |
| 65 static_cast<FakePictureLayerImpl*>(layer_impl); | 69 static_cast<FakePictureLayerImpl*>(layer_impl); |
| 66 picture_layer_impl->fixed_tile_size_ = fixed_tile_size_; | 70 picture_layer_impl->fixed_tile_size_ = fixed_tile_size_; |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 214 | 218 |
| 215 return CountTilesRequired(&PictureLayerTiling::IsTileRequiredForDraw); | 219 return CountTilesRequired(&PictureLayerTiling::IsTileRequiredForDraw); |
| 216 } | 220 } |
| 217 | 221 |
| 218 void FakePictureLayerImpl::ReleaseResources() { | 222 void FakePictureLayerImpl::ReleaseResources() { |
| 219 PictureLayerImpl::ReleaseResources(); | 223 PictureLayerImpl::ReleaseResources(); |
| 220 ++release_resources_count_; | 224 ++release_resources_count_; |
| 221 } | 225 } |
| 222 | 226 |
| 223 } // namespace cc | 227 } // namespace cc |
| OLD | NEW |