OLD | NEW |
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 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 render_surface_->ClearLayerLists(); | 170 render_surface_->ClearLayerLists(); |
171 } | 171 } |
172 | 172 |
173 void LayerImpl::PopulateSharedQuadState(SharedQuadState* state) const { | 173 void LayerImpl::PopulateSharedQuadState(SharedQuadState* state) const { |
174 state->SetAll(draw_properties_.target_space_transform, bounds(), | 174 state->SetAll(draw_properties_.target_space_transform, bounds(), |
175 draw_properties_.visible_layer_rect, draw_properties_.clip_rect, | 175 draw_properties_.visible_layer_rect, draw_properties_.clip_rect, |
176 draw_properties_.is_clipped, draw_properties_.opacity, | 176 draw_properties_.is_clipped, draw_properties_.opacity, |
177 draw_blend_mode_, sorting_context_id_); | 177 draw_blend_mode_, sorting_context_id_); |
178 } | 178 } |
179 | 179 |
180 void LayerImpl::PopulateScaledSharedQuadState(SharedQuadState* state, | 180 void LayerImpl::PopulateScaledSharedQuadState( |
181 float scale) const { | 181 SharedQuadState* state, |
| 182 float layer_to_content_scale_x, |
| 183 float layer_to_content_scale_y) const { |
182 gfx::Transform scaled_draw_transform = | 184 gfx::Transform scaled_draw_transform = |
183 draw_properties_.target_space_transform; | 185 draw_properties_.target_space_transform; |
184 scaled_draw_transform.Scale(SK_MScalar1 / scale, SK_MScalar1 / scale); | 186 scaled_draw_transform.Scale(SK_MScalar1 / layer_to_content_scale_x, |
185 gfx::Size scaled_bounds = gfx::ScaleToCeiledSize(bounds(), scale); | 187 SK_MScalar1 / layer_to_content_scale_y); |
186 gfx::Rect scaled_visible_layer_rect = | 188 gfx::Size scaled_bounds = gfx::ScaleToCeiledSize( |
187 gfx::ScaleToEnclosingRect(visible_layer_rect(), scale); | 189 bounds(), layer_to_content_scale_x, layer_to_content_scale_y); |
| 190 gfx::Rect scaled_visible_layer_rect = gfx::ScaleToEnclosingRect( |
| 191 visible_layer_rect(), layer_to_content_scale_x, layer_to_content_scale_y); |
188 scaled_visible_layer_rect.Intersect(gfx::Rect(scaled_bounds)); | 192 scaled_visible_layer_rect.Intersect(gfx::Rect(scaled_bounds)); |
189 | 193 |
190 state->SetAll(scaled_draw_transform, scaled_bounds, scaled_visible_layer_rect, | 194 state->SetAll(scaled_draw_transform, scaled_bounds, scaled_visible_layer_rect, |
191 draw_properties().clip_rect, draw_properties().is_clipped, | 195 draw_properties().clip_rect, draw_properties().is_clipped, |
192 draw_properties().opacity, draw_blend_mode_, | 196 draw_properties().opacity, draw_blend_mode_, |
193 sorting_context_id_); | 197 sorting_context_id_); |
194 } | 198 } |
195 | 199 |
196 bool LayerImpl::WillDraw(DrawMode draw_mode, | 200 bool LayerImpl::WillDraw(DrawMode draw_mode, |
197 ResourceProvider* resource_provider) { | 201 ResourceProvider* resource_provider) { |
(...skipping 901 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1099 .layer_transforms_should_scale_layer_contents) { | 1103 .layer_transforms_should_scale_layer_contents) { |
1100 return default_scale; | 1104 return default_scale; |
1101 } | 1105 } |
1102 | 1106 |
1103 gfx::Vector2dF transform_scales = MathUtil::ComputeTransform2dScaleComponents( | 1107 gfx::Vector2dF transform_scales = MathUtil::ComputeTransform2dScaleComponents( |
1104 ScreenSpaceTransform(), default_scale); | 1108 ScreenSpaceTransform(), default_scale); |
1105 return std::max(transform_scales.x(), transform_scales.y()); | 1109 return std::max(transform_scales.x(), transform_scales.y()); |
1106 } | 1110 } |
1107 | 1111 |
1108 } // namespace cc | 1112 } // namespace cc |
OLD | NEW |