blob: efa4242b59e89e3e940a42f46027112c137e5bd7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "cc/blink/web_image_layer_impl.h"
#include "cc/blink/web_layer_impl.h"
#include "cc/blink/web_layer_impl_fixed_bounds.h"
#include "cc/layers/picture_image_layer.h"
#include "third_party/skia/include/core/SkImage.h"
namespace cc_blink {
WebImageLayerImpl::WebImageLayerImpl() {
layer_.reset(new WebLayerImplFixedBounds(
cc::PictureImageLayer::Create(WebLayerImpl::LayerSettings())));
}
WebImageLayerImpl::~WebImageLayerImpl() {
}
blink::WebLayer* WebImageLayerImpl::layer() {
return layer_.get();
}
void WebImageLayerImpl::setImage(const SkImage* image) {
skia::RefPtr<const SkImage> imageRef = skia::SharePtr(image);
static_cast<cc::PictureImageLayer*>(layer_->layer())
->SetImage(imageRef.Pass());
static_cast<WebLayerImplFixedBounds*>(layer_.get())
->SetFixedBounds(gfx::Size(image->width(), image->height()));
}
void WebImageLayerImpl::setNearestNeighbor(bool nearest_neighbor) {
static_cast<cc::PictureImageLayer*>(layer_->layer())
->SetNearestNeighbor(nearest_neighbor);
}
} // namespace cc_blink
|