Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 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/render_surface_impl.h" | 5 #include "cc/layers/render_surface_impl.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 190 (!mask_layer->DrawsContent() || mask_layer->bounds().IsEmpty())) | 190 (!mask_layer->DrawsContent() || mask_layer->bounds().IsEmpty())) |
| 191 mask_layer = NULL; | 191 mask_layer = NULL; |
| 192 | 192 |
| 193 if (!mask_layer && for_replica) { | 193 if (!mask_layer && for_replica) { |
| 194 mask_layer = owning_layer_->replica_layer()->mask_layer(); | 194 mask_layer = owning_layer_->replica_layer()->mask_layer(); |
| 195 if (mask_layer && | 195 if (mask_layer && |
| 196 (!mask_layer->DrawsContent() || mask_layer->bounds().IsEmpty())) | 196 (!mask_layer->DrawsContent() || mask_layer->bounds().IsEmpty())) |
| 197 mask_layer = NULL; | 197 mask_layer = NULL; |
| 198 } | 198 } |
| 199 | 199 |
| 200 gfx::Vector2dF owning_layer_draw_scale = | |
| 201 MathUtil::ComputeTransform2dScaleComponents( | |
| 202 owning_layer_->draw_transform(), 1.f); | |
| 200 gfx::RectF mask_uv_rect(0.f, 0.f, 1.f, 1.f); | 203 gfx::RectF mask_uv_rect(0.f, 0.f, 1.f, 1.f); |
| 201 if (mask_layer) { | 204 if (mask_layer) { |
| 202 gfx::Vector2dF owning_layer_draw_scale = | |
| 203 MathUtil::ComputeTransform2dScaleComponents( | |
| 204 owning_layer_->draw_transform(), 1.f); | |
| 205 gfx::SizeF unclipped_mask_target_size = gfx::ScaleSize( | 205 gfx::SizeF unclipped_mask_target_size = gfx::ScaleSize( |
| 206 owning_layer_->content_bounds(), | 206 owning_layer_->content_bounds(), |
| 207 owning_layer_draw_scale.x(), | 207 owning_layer_draw_scale.x(), |
| 208 owning_layer_draw_scale.y()); | 208 owning_layer_draw_scale.y()); |
| 209 | 209 |
| 210 float uv_scale_x = | 210 float uv_scale_x = |
| 211 content_rect_.width() / unclipped_mask_target_size.width(); | 211 content_rect_.width() / unclipped_mask_target_size.width(); |
| 212 float uv_scale_y = | 212 float uv_scale_y = |
| 213 content_rect_.height() / unclipped_mask_target_size.height(); | 213 content_rect_.height() / unclipped_mask_target_size.height(); |
| 214 | 214 |
| 215 mask_uv_rect = gfx::RectF( | 215 mask_uv_rect = gfx::RectF( |
| 216 uv_scale_x * content_rect_.x() / content_rect_.width(), | 216 uv_scale_x * content_rect_.x() / content_rect_.width(), |
| 217 uv_scale_y * content_rect_.y() / content_rect_.height(), | 217 uv_scale_y * content_rect_.y() / content_rect_.height(), |
| 218 uv_scale_x, | 218 uv_scale_x, |
| 219 uv_scale_y); | 219 uv_scale_y); |
| 220 } | 220 } |
| 221 | 221 |
| 222 ResourceProvider::ResourceId mask_resource_id = | 222 ResourceProvider::ResourceId mask_resource_id = |
| 223 mask_layer ? mask_layer->ContentsResourceId() : 0; | 223 mask_layer ? mask_layer->ContentsResourceId() : 0; |
| 224 gfx::Rect contents_changed_since_last_frame = | 224 gfx::Rect contents_changed_since_last_frame = |
| 225 ContentsChanged() ? content_rect_ : gfx::Rect(); | 225 ContentsChanged() ? content_rect_ : gfx::Rect(); |
| 226 | 226 |
| 227 // Calculate the total scale (including device pixel scale) for the | |
| 228 // owning_layer by combining the draw_scale and the contents_scale. | |
| 229 gfx::Vector2dF owning_layer_scale(owning_layer_draw_scale); | |
| 230 owning_layer_scale.Scale(owning_layer_->contents_scale_x(), | |
| 231 owning_layer_->contents_scale_y()); | |
| 232 | |
| 227 RenderPassDrawQuad* quad = | 233 RenderPassDrawQuad* quad = |
| 228 render_pass->CreateAndAppendDrawQuad<RenderPassDrawQuad>(); | 234 render_pass->CreateAndAppendDrawQuad<RenderPassDrawQuad>(); |
| 229 quad->SetNew(shared_quad_state, | 235 quad->SetNew(shared_quad_state, |
| 230 content_rect_, | 236 content_rect_, |
| 231 visible_content_rect, | 237 visible_content_rect, |
| 232 render_pass_id, | 238 render_pass_id, |
| 233 for_replica, | 239 for_replica, |
| 234 mask_resource_id, | 240 mask_resource_id, |
| 235 contents_changed_since_last_frame, | 241 contents_changed_since_last_frame, |
| 236 mask_uv_rect, | 242 mask_uv_rect, |
| 237 owning_layer_->filters(), | 243 owning_layer_->filters(), |
| 238 owning_layer_->background_filters()); | 244 owning_layer_->background_filters(), |
| 245 owning_layer_scale); | |
|
danakj
2014/07/11 16:08:22
let's call this "owning_layer_to_target_scale" her
garykac
2014/07/25 18:18:59
Done.
| |
| 239 } | 246 } |
| 240 | 247 |
| 241 } // namespace cc | 248 } // namespace cc |
| OLD | NEW |