Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(14)

Side by Side Diff: cc/picture_image_layer_impl.cc

Issue 12326022: Efficiently handle image layer scaling (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Handle sublayerTransform and anchor point Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
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/picture_image_layer_impl.h"
6
7 #include "cc/debug_colors.h"
8 #include "cc/layer_tree_impl.h"
9
10 namespace cc {
11
12 PictureImageLayerImpl::PictureImageLayerImpl(LayerTreeImpl* treeImpl, int id)
13 : PictureLayerImpl(treeImpl, id) {
14 }
15
16 PictureImageLayerImpl::~PictureImageLayerImpl() {
17 }
18
19 const char* PictureImageLayerImpl::layerTypeAsString() const {
20 return "PictureImageLayer";
21 }
22
23 scoped_ptr<LayerImpl> PictureImageLayerImpl::createLayerImpl(
24 LayerTreeImpl* treeImpl) {
25 return PictureImageLayerImpl::create(treeImpl, id()).PassAs<LayerImpl>();
26 }
27
28 void PictureImageLayerImpl::getDebugBorderProperties(
29 SkColor* color, float* width) const {
30 *color = DebugColors::ImageLayerBorderColor();
31 *width = DebugColors::ImageLayerBorderWidth(layerTreeImpl());
32 }
33
34 void 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 if (ideal_contents_scale_ >
enne (OOO) 2013/02/22 00:10:49 I don't understand this math. If the ideal conten
Xianzhu 2013/02/22 00:53:30 Actually I meant 'ideal_contents_scale_ != minimum
enne (OOO) 2013/02/22 01:18:18 Ok. Maybe there's more work to be done here befor
Xianzhu 2013/02/22 23:24:38 Added std::max in the 'if' block, but still kept t
41 layerTreeImpl()->settings().minimumContentsScale) {
42 *raster_contents_scale = 1.f;
43 }else {
44 // ... except that the contents scale is very small, to save memory.
45 *raster_contents_scale = ideal_contents_scale_;
46 }
47
48 // We don't need low res tiles.
49 *low_res_raster_contents_scale = *raster_contents_scale;
50 }
51
52 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698