OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/blink/web_image_layer_impl.h" | 5 #include "cc/blink/web_image_layer_impl.h" |
6 | 6 |
7 #include "cc/blink/web_layer_impl.h" | 7 #include "cc/blink/web_layer_impl.h" |
8 #include "cc/blink/web_layer_impl_fixed_bounds.h" | 8 #include "cc/blink/web_layer_impl_fixed_bounds.h" |
9 #include "cc/layers/layer_settings.h" | |
10 #include "cc/layers/picture_image_layer.h" | 9 #include "cc/layers/picture_image_layer.h" |
11 #include "third_party/skia/include/core/SkImage.h" | 10 #include "third_party/skia/include/core/SkImage.h" |
12 | 11 |
13 namespace cc_blink { | 12 namespace cc_blink { |
14 | 13 |
15 WebImageLayerImpl::WebImageLayerImpl() { | 14 WebImageLayerImpl::WebImageLayerImpl() { |
16 layer_.reset(new WebLayerImplFixedBounds( | 15 layer_.reset(new WebLayerImplFixedBounds(cc::PictureImageLayer::Create())); |
17 cc::PictureImageLayer::Create(cc::LayerSettings()))); | |
18 } | 16 } |
19 | 17 |
20 WebImageLayerImpl::~WebImageLayerImpl() { | 18 WebImageLayerImpl::~WebImageLayerImpl() { |
21 } | 19 } |
22 | 20 |
23 blink::WebLayer* WebImageLayerImpl::layer() { | 21 blink::WebLayer* WebImageLayerImpl::layer() { |
24 return layer_.get(); | 22 return layer_.get(); |
25 } | 23 } |
26 | 24 |
27 void WebImageLayerImpl::setImage(const SkImage* image) { | 25 void WebImageLayerImpl::setImage(const SkImage* image) { |
28 skia::RefPtr<const SkImage> imageRef = skia::SharePtr(image); | 26 skia::RefPtr<const SkImage> imageRef = skia::SharePtr(image); |
29 static_cast<cc::PictureImageLayer*>(layer_->layer()) | 27 static_cast<cc::PictureImageLayer*>(layer_->layer()) |
30 ->SetImage(std::move(imageRef)); | 28 ->SetImage(std::move(imageRef)); |
31 static_cast<WebLayerImplFixedBounds*>(layer_.get()) | 29 static_cast<WebLayerImplFixedBounds*>(layer_.get()) |
32 ->SetFixedBounds(gfx::Size(image->width(), image->height())); | 30 ->SetFixedBounds(gfx::Size(image->width(), image->height())); |
33 } | 31 } |
34 | 32 |
35 void WebImageLayerImpl::setNearestNeighbor(bool nearest_neighbor) { | 33 void WebImageLayerImpl::setNearestNeighbor(bool nearest_neighbor) { |
36 static_cast<cc::PictureImageLayer*>(layer_->layer()) | 34 static_cast<cc::PictureImageLayer*>(layer_->layer()) |
37 ->SetNearestNeighbor(nearest_neighbor); | 35 ->SetNearestNeighbor(nearest_neighbor); |
38 } | 36 } |
39 | 37 |
40 } // namespace cc_blink | 38 } // namespace cc_blink |
OLD | NEW |