| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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.h" | 5 #include "cc/test/fake_picture_layer.h" |
| 6 | 6 |
| 7 #include "cc/test/fake_picture_layer_impl.h" | 7 #include "cc/test/fake_picture_layer_impl.h" |
| 8 | 8 |
| 9 namespace cc { | 9 namespace cc { |
| 10 | 10 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 always_update_resources_(false), | 24 always_update_resources_(false), |
| 25 force_unsuitable_for_gpu_rasterization_(false) { | 25 force_unsuitable_for_gpu_rasterization_(false) { |
| 26 SetBounds(gfx::Size(1, 1)); | 26 SetBounds(gfx::Size(1, 1)); |
| 27 SetIsDrawable(true); | 27 SetIsDrawable(true); |
| 28 } | 28 } |
| 29 | 29 |
| 30 FakePictureLayer::~FakePictureLayer() {} | 30 FakePictureLayer::~FakePictureLayer() {} |
| 31 | 31 |
| 32 std::unique_ptr<LayerImpl> FakePictureLayer::CreateLayerImpl( | 32 std::unique_ptr<LayerImpl> FakePictureLayer::CreateLayerImpl( |
| 33 LayerTreeImpl* tree_impl) { | 33 LayerTreeImpl* tree_impl) { |
| 34 std::unique_ptr<FakePictureLayerImpl> layer_impl; |
| 34 switch (mask_type()) { | 35 switch (mask_type()) { |
| 35 case Layer::LayerMaskType::NOT_MASK: | 36 case Layer::LayerMaskType::NOT_MASK: |
| 36 return FakePictureLayerImpl::Create(tree_impl, id()); | 37 layer_impl = FakePictureLayerImpl::Create(tree_impl, id()); |
| 38 break; |
| 37 case Layer::LayerMaskType::MULTI_TEXTURE_MASK: | 39 case Layer::LayerMaskType::MULTI_TEXTURE_MASK: |
| 38 return FakePictureLayerImpl::CreateMask(tree_impl, id()); | 40 layer_impl = FakePictureLayerImpl::CreateMask(tree_impl, id()); |
| 41 break; |
| 39 case Layer::LayerMaskType::SINGLE_TEXTURE_MASK: | 42 case Layer::LayerMaskType::SINGLE_TEXTURE_MASK: |
| 40 return FakePictureLayerImpl::CreateSingleTextureMask(tree_impl, id()); | 43 layer_impl = |
| 44 FakePictureLayerImpl::CreateSingleTextureMask(tree_impl, id()); |
| 45 break; |
| 41 default: | 46 default: |
| 42 NOTREACHED(); | 47 NOTREACHED(); |
| 43 break; | 48 break; |
| 44 } | 49 } |
| 45 return nullptr; | 50 |
| 51 if (!fixed_tile_size_.IsEmpty()) |
| 52 layer_impl->set_fixed_tile_size(fixed_tile_size_); |
| 53 |
| 54 return std::move(layer_impl); |
| 46 } | 55 } |
| 47 | 56 |
| 48 bool FakePictureLayer::Update() { | 57 bool FakePictureLayer::Update() { |
| 49 bool updated = PictureLayer::Update(); | 58 bool updated = PictureLayer::Update(); |
| 50 update_count_++; | 59 update_count_++; |
| 51 return updated || always_update_resources_; | 60 return updated || always_update_resources_; |
| 52 } | 61 } |
| 53 | 62 |
| 54 bool FakePictureLayer::IsSuitableForGpuRasterization() const { | 63 bool FakePictureLayer::IsSuitableForGpuRasterization() const { |
| 55 if (force_unsuitable_for_gpu_rasterization_) | 64 if (force_unsuitable_for_gpu_rasterization_) |
| 56 return false; | 65 return false; |
| 57 return PictureLayer::IsSuitableForGpuRasterization(); | 66 return PictureLayer::IsSuitableForGpuRasterization(); |
| 58 } | 67 } |
| 59 | 68 |
| 60 } // namespace cc | 69 } // namespace cc |
| OLD | NEW |