picture_image_layer_impl.cc revision 2a99a7e74a7f215066514fe81d2bfa6639d9eddd
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.
4
5#include "cc/layers/picture_image_layer_impl.h"
6
7#include "cc/debug/debug_colors.h"
8#include "cc/trees/layer_tree_impl.h"
9
10namespace cc {
11
12PictureImageLayerImpl::PictureImageLayerImpl(LayerTreeImpl* tree_impl, int id)
13    : PictureLayerImpl(tree_impl, id) {
14}
15
16PictureImageLayerImpl::~PictureImageLayerImpl() {
17}
18
19const char* PictureImageLayerImpl::LayerTypeAsString() const {
20  return "PictureImageLayer";
21}
22
23scoped_ptr<LayerImpl> PictureImageLayerImpl::CreateLayerImpl(
24    LayerTreeImpl* tree_impl) {
25  return PictureImageLayerImpl::Create(tree_impl, id()).PassAs<LayerImpl>();
26}
27
28void PictureImageLayerImpl::GetDebugBorderProperties(
29    SkColor* color, float* width) const {
30  *color = DebugColors::ImageLayerBorderColor();
31  *width = DebugColors::ImageLayerBorderWidth(layer_tree_impl());
32}
33
34void PictureImageLayerImpl::CalculateRasterContentsScale(
35    bool animating_transform_to_screen,
36    float* raster_contents_scale,
37    float* low_res_raster_contents_scale) {
38  // Don't scale images during rastering to ensure image quality, save memory
39  // and avoid frequent re-rastering on change of scale.
40  *raster_contents_scale = std::max(1.f, MinimumContentsScale());
41  // We don't need low res tiles.
42  *low_res_raster_contents_scale = *raster_contents_scale;
43}
44
45}  // namespace cc
46