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

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

Issue 2410513002: Plumb preferred raster scale for background images from Blink to cc layers. (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),
83 has_preferred_raster_scale_(false),
82 scrolls_drawn_descendant_(false), 84 scrolls_drawn_descendant_(false),
83 has_will_change_transform_hint_(false), 85 has_will_change_transform_hint_(false),
84 needs_push_properties_(false) { 86 needs_push_properties_(false) {
85 DCHECK_GT(layer_id_, 0); 87 DCHECK_GT(layer_id_, 0);
86 88
87 DCHECK(layer_tree_impl_); 89 DCHECK(layer_tree_impl_);
88 layer_tree_impl_->RegisterLayer(this); 90 layer_tree_impl_->RegisterLayer(this);
89 layer_tree_impl_->AddToElementMap(this); 91 layer_tree_impl_->AddToElementMap(this);
90 92
91 SetNeedsPushProperties(); 93 SetNeedsPushProperties();
92 } 94 }
93 95
94 LayerImpl::~LayerImpl() { 96 LayerImpl::~LayerImpl() {
95 DCHECK_EQ(DRAW_MODE_NONE, current_draw_mode_); 97 DCHECK_EQ(DRAW_MODE_NONE, current_draw_mode_);
96 98
97 layer_tree_impl_->UnregisterScrollLayer(this); 99 layer_tree_impl_->UnregisterScrollLayer(this);
98 layer_tree_impl_->UnregisterLayer(this); 100 layer_tree_impl_->UnregisterLayer(this);
99 101
100 layer_tree_impl_->RemoveFromElementMap(this); 102 layer_tree_impl_->RemoveFromElementMap(this);
101 103
102 TRACE_EVENT_OBJECT_DELETED_WITH_ID( 104 TRACE_EVENT_OBJECT_DELETED_WITH_ID(
103 TRACE_DISABLED_BY_DEFAULT("cc.debug"), "cc::LayerImpl", this); 105 TRACE_DISABLED_BY_DEFAULT("cc.debug"), "cc::LayerImpl", this);
104 } 106 }
105 107
106 void LayerImpl::SetHasWillChangeTransformHint(bool has_will_change) { 108 void LayerImpl::SetHasWillChangeTransformHint(bool has_will_change) {
107 has_will_change_transform_hint_ = has_will_change; 109 has_will_change_transform_hint_ = has_will_change;
108 } 110 }
109 111
112 void LayerImpl::SetPreferredRasterScale(float preferred_raster_scale) {
113 has_preferred_raster_scale_ = true;
114 preferred_raster_scale_ = preferred_raster_scale;
115 }
116
117 void LayerImpl::ClearPreferredRasterScale() {
118 has_preferred_raster_scale_ = false;
119 preferred_raster_scale_ = 1.0f;
120 }
121
110 AnimationHost* LayerImpl::GetAnimationHost() const { 122 AnimationHost* LayerImpl::GetAnimationHost() const {
111 return layer_tree_impl_ ? layer_tree_impl_->animation_host() : nullptr; 123 return layer_tree_impl_ ? layer_tree_impl_->animation_host() : nullptr;
112 } 124 }
113 125
114 ElementListType LayerImpl::GetElementTypeForAnimation() const { 126 ElementListType LayerImpl::GetElementTypeForAnimation() const {
115 return IsActive() ? ElementListType::ACTIVE : ElementListType::PENDING; 127 return IsActive() ? ElementListType::ACTIVE : ElementListType::PENDING;
116 } 128 }
117 129
118 void LayerImpl::SetDebugInfo( 130 void LayerImpl::SetDebugInfo(
119 std::unique_ptr<base::trace_event::ConvertableToTraceFormat> debug_info) { 131 std::unique_ptr<base::trace_event::ConvertableToTraceFormat> debug_info) {
(...skipping 961 matching lines...) Expand 10 before | Expand all | Expand 10 after
1081 .layer_transforms_should_scale_layer_contents) { 1093 .layer_transforms_should_scale_layer_contents) {
1082 return default_scale; 1094 return default_scale;
1083 } 1095 }
1084 1096
1085 gfx::Vector2dF transform_scales = MathUtil::ComputeTransform2dScaleComponents( 1097 gfx::Vector2dF transform_scales = MathUtil::ComputeTransform2dScaleComponents(
1086 ScreenSpaceTransform(), default_scale); 1098 ScreenSpaceTransform(), default_scale);
1087 return std::max(transform_scales.x(), transform_scales.y()); 1099 return std::max(transform_scales.x(), transform_scales.y());
1088 } 1100 }
1089 1101
1090 } // 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-scale.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698