| OLD | NEW |
| 1 // Copyright 2010 The Chromium Authors. All rights reserved. | 1 // Copyright 2010 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/layers/picture_image_layer.h" | 5 #include "cc/layers/picture_image_layer.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "cc/layers/picture_image_layer_impl.h" | 9 #include "cc/layers/picture_layer_impl.h" |
| 10 #include "cc/playback/display_item_list_settings.h" | 10 #include "cc/playback/display_item_list_settings.h" |
| 11 #include "cc/playback/drawing_display_item.h" | 11 #include "cc/playback/drawing_display_item.h" |
| 12 #include "cc/trees/layer_tree_host.h" | 12 #include "cc/trees/layer_tree_host.h" |
| 13 #include "third_party/skia/include/core/SkCanvas.h" | 13 #include "third_party/skia/include/core/SkCanvas.h" |
| 14 #include "third_party/skia/include/core/SkImage.h" | 14 #include "third_party/skia/include/core/SkImage.h" |
| 15 #include "third_party/skia/include/core/SkPictureRecorder.h" | 15 #include "third_party/skia/include/core/SkPictureRecorder.h" |
| 16 #include "ui/gfx/skia_util.h" | 16 #include "ui/gfx/skia_util.h" |
| 17 | 17 |
| 18 namespace cc { | 18 namespace cc { |
| 19 | 19 |
| 20 scoped_refptr<PictureImageLayer> PictureImageLayer::Create() { | 20 scoped_refptr<PictureImageLayer> PictureImageLayer::Create() { |
| 21 return make_scoped_refptr(new PictureImageLayer()); | 21 return make_scoped_refptr(new PictureImageLayer()); |
| 22 } | 22 } |
| 23 | 23 |
| 24 PictureImageLayer::PictureImageLayer() : PictureLayer(this) {} | 24 PictureImageLayer::PictureImageLayer() : PictureLayer(this) {} |
| 25 | 25 |
| 26 PictureImageLayer::~PictureImageLayer() { | 26 PictureImageLayer::~PictureImageLayer() { |
| 27 ClearClient(); | 27 ClearClient(); |
| 28 } | 28 } |
| 29 | 29 |
| 30 std::unique_ptr<LayerImpl> PictureImageLayer::CreateLayerImpl( | 30 std::unique_ptr<LayerImpl> PictureImageLayer::CreateLayerImpl( |
| 31 LayerTreeImpl* tree_impl) { | 31 LayerTreeImpl* tree_impl) { |
| 32 return PictureImageLayerImpl::Create(tree_impl, id(), is_mask()); | 32 auto layer_impl = PictureLayerImpl::Create(tree_impl, id(), is_mask()); |
| 33 layer_impl->set_is_directly_composited_image(true); |
| 34 return std::move(layer_impl); |
| 33 } | 35 } |
| 34 | 36 |
| 35 bool PictureImageLayer::HasDrawableContent() const { | 37 bool PictureImageLayer::HasDrawableContent() const { |
| 36 return image_ && PictureLayer::HasDrawableContent(); | 38 return image_ && PictureLayer::HasDrawableContent(); |
| 37 } | 39 } |
| 38 | 40 |
| 39 void PictureImageLayer::SetImage(sk_sp<const SkImage> image) { | 41 void PictureImageLayer::SetImage(sk_sp<const SkImage> image) { |
| 40 // SetImage() currently gets called whenever there is any | 42 // SetImage() currently gets called whenever there is any |
| 41 // style change that affects the layer even if that change doesn't | 43 // style change that affects the layer even if that change doesn't |
| 42 // affect the actual contents of the image (e.g. a CSS animation). | 44 // affect the actual contents of the image (e.g. a CSS animation). |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 | 92 |
| 91 bool PictureImageLayer::FillsBoundsCompletely() const { | 93 bool PictureImageLayer::FillsBoundsCompletely() const { |
| 92 return false; | 94 return false; |
| 93 } | 95 } |
| 94 | 96 |
| 95 size_t PictureImageLayer::GetApproximateUnsharedMemoryUsage() const { | 97 size_t PictureImageLayer::GetApproximateUnsharedMemoryUsage() const { |
| 96 return 0; | 98 return 0; |
| 97 } | 99 } |
| 98 | 100 |
| 99 } // namespace cc | 101 } // namespace cc |
| OLD | NEW |