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

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

Issue 1101823002: CC Animations: Make LayerAnimationController creation optional (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Plumb LayerSettings parameter for cc::Layer construction. Created 5 years, 7 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
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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/contents_scaling_layer.h" 5 #include "cc/layers/contents_scaling_layer.h"
6 #include "cc/trees/layer_tree_host.h" 6 #include "cc/trees/layer_tree_host.h"
7 #include "ui/gfx/geometry/size_conversions.h" 7 #include "ui/gfx/geometry/size_conversions.h"
8 8
9 namespace cc { 9 namespace cc {
10 10
11 gfx::Size ContentsScalingLayer::ComputeContentBoundsForScale( 11 gfx::Size ContentsScalingLayer::ComputeContentBoundsForScale(
12 float scale_x, 12 float scale_x,
13 float scale_y) const { 13 float scale_y) const {
14 return gfx::ToCeiledSize(gfx::ScaleSize(bounds(), scale_x, scale_y)); 14 return gfx::ToCeiledSize(gfx::ScaleSize(bounds(), scale_x, scale_y));
15 } 15 }
16 16
17 ContentsScalingLayer::ContentsScalingLayer() 17 ContentsScalingLayer::ContentsScalingLayer(const LayerSettings& settings)
18 : last_update_contents_scale_x_(0.f), 18 : Layer(settings),
19 last_update_contents_scale_y_(0.f) {} 19 last_update_contents_scale_x_(0.f),
20 last_update_contents_scale_y_(0.f) {
21 }
20 22
21 ContentsScalingLayer::~ContentsScalingLayer() { 23 ContentsScalingLayer::~ContentsScalingLayer() {
22 } 24 }
23 25
24 void ContentsScalingLayer::CalculateContentsScale( 26 void ContentsScalingLayer::CalculateContentsScale(
25 float ideal_contents_scale, 27 float ideal_contents_scale,
26 float* contents_scale_x, 28 float* contents_scale_x,
27 float* contents_scale_y, 29 float* contents_scale_y,
28 gfx::Size* content_bounds) { 30 gfx::Size* content_bounds) {
29 float old_contents_scale_x = *contents_scale_x; 31 float old_contents_scale_x = *contents_scale_x;
(...skipping 24 matching lines...) Expand all
54 return updated; 56 return updated;
55 57
56 last_update_contents_scale_x_ = draw_properties().contents_scale_x; 58 last_update_contents_scale_x_ = draw_properties().contents_scale_x;
57 last_update_contents_scale_y_ = draw_properties().contents_scale_y; 59 last_update_contents_scale_y_ = draw_properties().contents_scale_y;
58 // Invalidate the whole layer if scale changed. 60 // Invalidate the whole layer if scale changed.
59 SetNeedsDisplayRect(gfx::Rect(paint_properties().bounds)); 61 SetNeedsDisplayRect(gfx::Rect(paint_properties().bounds));
60 return updated; 62 return updated;
61 } 63 }
62 64
63 } // namespace cc 65 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698