| 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/picture_image_layer.h" | 9 #include "cc/layers/picture_image_layer.h" |
| 10 #include "third_party/skia/include/core/SkImage.h" | 10 #include "third_party/skia/include/core/SkImage.h" |
| 11 | 11 |
| 12 namespace cc_blink { | 12 namespace cc_blink { |
| 13 | 13 |
| 14 WebImageLayerImpl::WebImageLayerImpl() { | 14 WebImageLayerImpl::WebImageLayerImpl() { |
| 15 layer_.reset(new WebLayerImplFixedBounds(cc::PictureImageLayer::Create())); | 15 layer_.reset(new WebLayerImplFixedBounds(cc::PictureImageLayer::Create())); |
| 16 } | 16 } |
| 17 | 17 |
| 18 WebImageLayerImpl::~WebImageLayerImpl() { | 18 WebImageLayerImpl::~WebImageLayerImpl() { |
| 19 } | 19 } |
| 20 | 20 |
| 21 blink::WebLayer* WebImageLayerImpl::Layer() { | 21 blink::WebLayer* WebImageLayerImpl::Layer() { |
| 22 return layer_.get(); | 22 return layer_.get(); |
| 23 } | 23 } |
| 24 | 24 |
| 25 void WebImageLayerImpl::SetImage(const SkImage* image) { | 25 void WebImageLayerImpl::SetImage(cc::PaintImage image) { |
| 26 static_cast<WebLayerImplFixedBounds*>(layer_.get()) |
| 27 ->SetFixedBounds( |
| 28 gfx::Size(image.sk_image()->width(), image.sk_image()->height())); |
| 26 static_cast<cc::PictureImageLayer*>(layer_->layer()) | 29 static_cast<cc::PictureImageLayer*>(layer_->layer()) |
| 27 ->SetImage(sk_ref_sp(image)); | 30 ->SetImage(std::move(image)); |
| 28 static_cast<WebLayerImplFixedBounds*>(layer_.get()) | |
| 29 ->SetFixedBounds(gfx::Size(image->width(), image->height())); | |
| 30 } | 31 } |
| 31 | 32 |
| 32 void WebImageLayerImpl::SetNearestNeighbor(bool nearest_neighbor) { | 33 void WebImageLayerImpl::SetNearestNeighbor(bool nearest_neighbor) { |
| 33 static_cast<cc::PictureImageLayer*>(layer_->layer()) | 34 static_cast<cc::PictureImageLayer*>(layer_->layer()) |
| 34 ->SetNearestNeighbor(nearest_neighbor); | 35 ->SetNearestNeighbor(nearest_neighbor); |
| 35 } | 36 } |
| 36 | 37 |
| 37 } // namespace cc_blink | 38 } // namespace cc_blink |
| OLD | NEW |