1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "cc/layers/picture_image_layer_impl.h"
9 #include "cc/debug/debug_colors.h"
10 #include "cc/trees/layer_tree_impl.h"
14 PictureImageLayerImpl::PictureImageLayerImpl(LayerTreeImpl
* tree_impl
,
17 : PictureLayerImpl(tree_impl
, id
, is_mask
) {
20 PictureImageLayerImpl::~PictureImageLayerImpl() {
23 const char* PictureImageLayerImpl::LayerTypeAsString() const {
24 return "cc::PictureImageLayerImpl";
27 scoped_ptr
<LayerImpl
> PictureImageLayerImpl::CreateLayerImpl(
28 LayerTreeImpl
* tree_impl
) {
29 return PictureImageLayerImpl::Create(tree_impl
, id(), is_mask_
);
32 void PictureImageLayerImpl::GetDebugBorderProperties(
33 SkColor
* color
, float* width
) const {
34 *color
= DebugColors::ImageLayerBorderColor();
35 *width
= DebugColors::ImageLayerBorderWidth(layer_tree_impl());
38 bool PictureImageLayerImpl::ShouldAdjustRasterScale() const {
42 void PictureImageLayerImpl::RecalculateRasterScales() {
43 // Don't scale images during rastering to ensure image quality, save memory
44 // and avoid frequent re-rastering on change of scale.
45 raster_page_scale_
= 1.f
;
46 raster_device_scale_
= 1.f
;
47 raster_source_scale_
= std::max(1.f
, MinimumContentsScale());
48 raster_contents_scale_
= raster_source_scale_
;
49 // We don't need low res tiles.
50 low_res_raster_contents_scale_
= raster_contents_scale_
;
53 void PictureImageLayerImpl::UpdateIdealScales() {
54 ideal_contents_scale_
= 1.f
;
55 ideal_page_scale_
= 1.f
;
56 ideal_device_scale_
= 1.f
;
57 ideal_source_scale_
= 1.f
;