| 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), | |
| 24 did_become_active_call_count_(0), | |
| 25 has_valid_tile_priorities_(false), | |
| 26 use_set_valid_tile_priorities_flag_(false), | |
| 27 release_resources_count_(0) { | |
| 28 SetBounds(raster_source->GetSize()); | 23 SetBounds(raster_source->GetSize()); |
| 29 SetRasterSourceOnPending(raster_source, Region()); | 24 SetRasterSourceOnPending(raster_source, Region()); |
| 30 } | 25 } |
| 31 | 26 |
| 32 FakePictureLayerImpl::FakePictureLayerImpl( | 27 FakePictureLayerImpl::FakePictureLayerImpl( |
| 33 LayerTreeImpl* tree_impl, | 28 LayerTreeImpl* tree_impl, |
| 34 int id, | 29 int id, |
| 35 scoped_refptr<RasterSource> raster_source, | 30 scoped_refptr<RasterSource> raster_source, |
| 36 bool is_mask, | 31 bool is_mask, |
| 37 const gfx::Size& layer_bounds) | 32 const gfx::Size& layer_bounds) |
| 38 : PictureLayerImpl(tree_impl, id, is_mask), | 33 : PictureLayerImpl(tree_impl, id, is_mask) { |
| 39 append_quads_count_(0), | |
| 40 did_become_active_call_count_(0), | |
| 41 has_valid_tile_priorities_(false), | |
| 42 use_set_valid_tile_priorities_flag_(false), | |
| 43 release_resources_count_(0) { | |
| 44 SetBounds(layer_bounds); | 34 SetBounds(layer_bounds); |
| 45 SetRasterSourceOnPending(raster_source, Region()); | 35 SetRasterSourceOnPending(raster_source, Region()); |
| 46 } | 36 } |
| 47 | 37 |
| 48 FakePictureLayerImpl::FakePictureLayerImpl(LayerTreeImpl* tree_impl, | 38 FakePictureLayerImpl::FakePictureLayerImpl(LayerTreeImpl* tree_impl, |
| 49 int id, | 39 int id, |
| 50 bool is_mask) | 40 bool is_mask) |
| 51 : PictureLayerImpl(tree_impl, id, is_mask), | 41 : PictureLayerImpl(tree_impl, id, is_mask) {} |
| 52 append_quads_count_(0), | |
| 53 did_become_active_call_count_(0), | |
| 54 has_valid_tile_priorities_(false), | |
| 55 use_set_valid_tile_priorities_flag_(false), | |
| 56 release_resources_count_(0) {} | |
| 57 | 42 |
| 58 std::unique_ptr<LayerImpl> FakePictureLayerImpl::CreateLayerImpl( | 43 std::unique_ptr<LayerImpl> FakePictureLayerImpl::CreateLayerImpl( |
| 59 LayerTreeImpl* tree_impl) { | 44 LayerTreeImpl* tree_impl) { |
| 60 return base::WrapUnique(new FakePictureLayerImpl(tree_impl, id(), is_mask_)); | 45 return base::WrapUnique(new FakePictureLayerImpl(tree_impl, id(), is_mask_)); |
| 61 } | 46 } |
| 62 | 47 |
| 63 void FakePictureLayerImpl::PushPropertiesTo(LayerImpl* layer_impl) { | 48 void FakePictureLayerImpl::PushPropertiesTo(LayerImpl* layer_impl) { |
| 64 FakePictureLayerImpl* picture_layer_impl = | 49 FakePictureLayerImpl* picture_layer_impl = |
| 65 static_cast<FakePictureLayerImpl*>(layer_impl); | 50 static_cast<FakePictureLayerImpl*>(layer_impl); |
| 66 picture_layer_impl->fixed_tile_size_ = fixed_tile_size_; | 51 picture_layer_impl->fixed_tile_size_ = fixed_tile_size_; |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 213 return 0; | 198 return 0; |
| 214 | 199 |
| 215 return CountTilesRequired(&PictureLayerTiling::IsTileRequiredForDraw); | 200 return CountTilesRequired(&PictureLayerTiling::IsTileRequiredForDraw); |
| 216 } | 201 } |
| 217 | 202 |
| 218 void FakePictureLayerImpl::ReleaseResources() { | 203 void FakePictureLayerImpl::ReleaseResources() { |
| 219 PictureLayerImpl::ReleaseResources(); | 204 PictureLayerImpl::ReleaseResources(); |
| 220 ++release_resources_count_; | 205 ++release_resources_count_; |
| 221 } | 206 } |
| 222 | 207 |
| 208 void FakePictureLayerImpl::ReleaseTileResources() { |
| 209 PictureLayerImpl::ReleaseTileResources(); |
| 210 ++release_tile_resources_count_; |
| 211 } |
| 212 |
| 223 } // namespace cc | 213 } // namespace cc |
| OLD | NEW |