| 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(const SkImage* image) { |
| 26 skia::RefPtr<const SkImage> imageRef = skia::SharePtr(image); | |
| 27 static_cast<cc::PictureImageLayer*>(layer_->layer()) | 26 static_cast<cc::PictureImageLayer*>(layer_->layer()) |
| 28 ->SetImage(std::move(imageRef)); | 27 ->SetImage(sk_ref_sp(image)); |
| 29 static_cast<WebLayerImplFixedBounds*>(layer_.get()) | 28 static_cast<WebLayerImplFixedBounds*>(layer_.get()) |
| 30 ->SetFixedBounds(gfx::Size(image->width(), image->height())); | 29 ->SetFixedBounds(gfx::Size(image->width(), image->height())); |
| 31 } | 30 } |
| 32 | 31 |
| 33 void WebImageLayerImpl::setNearestNeighbor(bool nearest_neighbor) { | 32 void WebImageLayerImpl::setNearestNeighbor(bool nearest_neighbor) { |
| 34 static_cast<cc::PictureImageLayer*>(layer_->layer()) | 33 static_cast<cc::PictureImageLayer*>(layer_->layer()) |
| 35 ->SetNearestNeighbor(nearest_neighbor); | 34 ->SetNearestNeighbor(nearest_neighbor); |
| 36 } | 35 } |
| 37 | 36 |
| 38 } // namespace cc_blink | 37 } // namespace cc_blink |
| OLD | NEW |