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

Side by Side Diff: cc/layers/image_layer.cc

Issue 226283004: Rasterize at maximum scale for scale animations on CPU-rasterized layers (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased Created 6 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « cc/layers/image_layer.h ('k') | cc/layers/layer.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2010 The Chromium Authors. All rights reserved. 1 // Copyright 2010 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/layers/image_layer.h" 5 #include "cc/layers/image_layer.h"
6 6
7 #include "base/compiler_specific.h" 7 #include "base/compiler_specific.h"
8 #include "cc/resources/image_layer_updater.h" 8 #include "cc/resources/image_layer_updater.h"
9 #include "cc/resources/layer_updater.h" 9 #include "cc/resources/layer_updater.h"
10 #include "cc/resources/prioritized_resource.h" 10 #include "cc/resources/prioritized_resource.h"
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 layer_tree_host()->GetRendererCapabilities().best_texture_format); 60 layer_tree_host()->GetRendererCapabilities().best_texture_format);
61 } 61 }
62 62
63 LayerUpdater* ImageLayer::Updater() const { 63 LayerUpdater* ImageLayer::Updater() const {
64 return updater_.get(); 64 return updater_.get();
65 } 65 }
66 66
67 void ImageLayer::CalculateContentsScale(float ideal_contents_scale, 67 void ImageLayer::CalculateContentsScale(float ideal_contents_scale,
68 float device_scale_factor, 68 float device_scale_factor,
69 float page_scale_factor, 69 float page_scale_factor,
70 float maximum_animation_contents_scale,
70 bool animating_transform_to_screen, 71 bool animating_transform_to_screen,
71 float* contents_scale_x, 72 float* contents_scale_x,
72 float* contents_scale_y, 73 float* contents_scale_y,
73 gfx::Size* content_bounds) { 74 gfx::Size* content_bounds) {
74 *contents_scale_x = ImageContentsScaleX(); 75 *contents_scale_x = ImageContentsScaleX();
75 *contents_scale_y = ImageContentsScaleY(); 76 *contents_scale_y = ImageContentsScaleY();
76 *content_bounds = gfx::Size(bitmap_.width(), bitmap_.height()); 77 *content_bounds = gfx::Size(bitmap_.width(), bitmap_.height());
77 } 78 }
78 79
79 bool ImageLayer::DrawsContent() const { 80 bool ImageLayer::DrawsContent() const {
(...skipping 12 matching lines...) Expand all
92 return static_cast<float>(bitmap_.width()) / bounds().width(); 93 return static_cast<float>(bitmap_.width()) / bounds().width();
93 } 94 }
94 95
95 float ImageLayer::ImageContentsScaleY() const { 96 float ImageLayer::ImageContentsScaleY() const {
96 if (bounds().IsEmpty() || bitmap_.height() == 0) 97 if (bounds().IsEmpty() || bitmap_.height() == 0)
97 return 1; 98 return 1;
98 return static_cast<float>(bitmap_.height()) / bounds().height(); 99 return static_cast<float>(bitmap_.height()) / bounds().height();
99 } 100 }
100 101
101 } // namespace cc 102 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layers/image_layer.h ('k') | cc/layers/layer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698