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

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

Issue 2441853002: Plumb preferred raster bounds rather than scale (Closed)
Patch Set: none Created 4 years, 2 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/layer_impl.h" 5 #include "cc/layers/layer_impl.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 safe_opaque_background_color_(0), 72 safe_opaque_background_color_(0),
73 draw_blend_mode_(SkXfermode::kSrcOver_Mode), 73 draw_blend_mode_(SkXfermode::kSrcOver_Mode),
74 transform_tree_index_(TransformTree::kInvalidNodeId), 74 transform_tree_index_(TransformTree::kInvalidNodeId),
75 effect_tree_index_(EffectTree::kInvalidNodeId), 75 effect_tree_index_(EffectTree::kInvalidNodeId),
76 clip_tree_index_(ClipTree::kInvalidNodeId), 76 clip_tree_index_(ClipTree::kInvalidNodeId),
77 scroll_tree_index_(ScrollTree::kInvalidNodeId), 77 scroll_tree_index_(ScrollTree::kInvalidNodeId),
78 sorting_context_id_(0), 78 sorting_context_id_(0),
79 current_draw_mode_(DRAW_MODE_NONE), 79 current_draw_mode_(DRAW_MODE_NONE),
80 mutable_properties_(MutableProperty::kNone), 80 mutable_properties_(MutableProperty::kNone),
81 debug_info_(nullptr), 81 debug_info_(nullptr),
82 preferred_raster_scale_(1.0f), 82 has_preferred_raster_bounds_(false),
83 has_preferred_raster_scale_(false),
84 scrolls_drawn_descendant_(false), 83 scrolls_drawn_descendant_(false),
85 has_will_change_transform_hint_(false), 84 has_will_change_transform_hint_(false),
86 needs_push_properties_(false) { 85 needs_push_properties_(false) {
87 DCHECK_GT(layer_id_, 0); 86 DCHECK_GT(layer_id_, 0);
88 87
89 DCHECK(layer_tree_impl_); 88 DCHECK(layer_tree_impl_);
90 layer_tree_impl_->RegisterLayer(this); 89 layer_tree_impl_->RegisterLayer(this);
91 layer_tree_impl_->AddToElementMap(this); 90 layer_tree_impl_->AddToElementMap(this);
92 91
93 SetNeedsPushProperties(); 92 SetNeedsPushProperties();
94 } 93 }
95 94
96 LayerImpl::~LayerImpl() { 95 LayerImpl::~LayerImpl() {
97 DCHECK_EQ(DRAW_MODE_NONE, current_draw_mode_); 96 DCHECK_EQ(DRAW_MODE_NONE, current_draw_mode_);
98 97
99 layer_tree_impl_->UnregisterScrollLayer(this); 98 layer_tree_impl_->UnregisterScrollLayer(this);
100 layer_tree_impl_->UnregisterLayer(this); 99 layer_tree_impl_->UnregisterLayer(this);
101 100
102 layer_tree_impl_->RemoveFromElementMap(this); 101 layer_tree_impl_->RemoveFromElementMap(this);
103 102
104 TRACE_EVENT_OBJECT_DELETED_WITH_ID( 103 TRACE_EVENT_OBJECT_DELETED_WITH_ID(
105 TRACE_DISABLED_BY_DEFAULT("cc.debug"), "cc::LayerImpl", this); 104 TRACE_DISABLED_BY_DEFAULT("cc.debug"), "cc::LayerImpl", this);
106 } 105 }
107 106
108 void LayerImpl::SetHasWillChangeTransformHint(bool has_will_change) { 107 void LayerImpl::SetHasWillChangeTransformHint(bool has_will_change) {
109 has_will_change_transform_hint_ = has_will_change; 108 has_will_change_transform_hint_ = has_will_change;
110 } 109 }
111 110
112 void LayerImpl::SetPreferredRasterScale(float preferred_raster_scale) { 111 void LayerImpl::SetPreferredRasterBounds(
113 has_preferred_raster_scale_ = true; 112 const gfx::Size& preferred_raster_bounds) {
114 preferred_raster_scale_ = preferred_raster_scale; 113 has_preferred_raster_bounds_ = true;
114 preferred_raster_bounds_ = preferred_raster_bounds;
115 } 115 }
116 116
117 void LayerImpl::ClearPreferredRasterScale() { 117 void LayerImpl::ClearPreferredRasterBounds() {
118 has_preferred_raster_scale_ = false; 118 has_preferred_raster_bounds_ = false;
119 preferred_raster_scale_ = 1.0f; 119 preferred_raster_bounds_ = gfx::Size();
120 } 120 }
121 121
122 AnimationHost* LayerImpl::GetAnimationHost() const { 122 AnimationHost* LayerImpl::GetAnimationHost() const {
123 return layer_tree_impl_ ? layer_tree_impl_->animation_host() : nullptr; 123 return layer_tree_impl_ ? layer_tree_impl_->animation_host() : nullptr;
124 } 124 }
125 125
126 ElementListType LayerImpl::GetElementTypeForAnimation() const { 126 ElementListType LayerImpl::GetElementTypeForAnimation() const {
127 return IsActive() ? ElementListType::ACTIVE : ElementListType::PENDING; 127 return IsActive() ? ElementListType::ACTIVE : ElementListType::PENDING;
128 } 128 }
129 129
(...skipping 963 matching lines...) Expand 10 before | Expand all | Expand 10 after
1093 .layer_transforms_should_scale_layer_contents) { 1093 .layer_transforms_should_scale_layer_contents) {
1094 return default_scale; 1094 return default_scale;
1095 } 1095 }
1096 1096
1097 gfx::Vector2dF transform_scales = MathUtil::ComputeTransform2dScaleComponents( 1097 gfx::Vector2dF transform_scales = MathUtil::ComputeTransform2dScaleComponents(
1098 ScreenSpaceTransform(), default_scale); 1098 ScreenSpaceTransform(), default_scale);
1099 return std::max(transform_scales.x(), transform_scales.y()); 1099 return std::max(transform_scales.x(), transform_scales.y());
1100 } 1100 }
1101 1101
1102 } // namespace cc 1102 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layers/layer_impl.h ('k') | third_party/WebKit/LayoutTests/compositing/scaling/preferred-raster-bounds.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698