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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 | 59 |
60 | 60 |
61 void RenderSurfaceImpl::SetClipRect(const gfx::Rect& clip_rect) { | 61 void RenderSurfaceImpl::SetClipRect(const gfx::Rect& clip_rect) { |
62 if (clip_rect_ == clip_rect) | 62 if (clip_rect_ == clip_rect) |
63 return; | 63 return; |
64 | 64 |
65 surface_property_changed_ = true; | 65 surface_property_changed_ = true; |
66 clip_rect_ = clip_rect; | 66 clip_rect_ = clip_rect; |
67 } | 67 } |
68 | 68 |
69 bool RenderSurfaceImpl::ContentsChanged() const { | |
70 return !damage_tracker_->current_damage_rect().IsEmpty(); | |
71 } | |
72 | |
73 void RenderSurfaceImpl::SetContentRect(const gfx::Rect& content_rect) { | 69 void RenderSurfaceImpl::SetContentRect(const gfx::Rect& content_rect) { |
74 if (content_rect_ == content_rect) | 70 if (content_rect_ == content_rect) |
75 return; | 71 return; |
76 | 72 |
77 surface_property_changed_ = true; | 73 surface_property_changed_ = true; |
78 content_rect_ = content_rect; | 74 content_rect_ = content_rect; |
79 } | 75 } |
80 | 76 |
81 bool RenderSurfaceImpl::SurfacePropertyChanged() const { | 77 bool RenderSurfaceImpl::SurfacePropertyChanged() const { |
82 // Surface property changes are tracked as follows: | 78 // Surface property changes are tracked as follows: |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
214 | 210 |
215 mask_uv_rect = gfx::RectF( | 211 mask_uv_rect = gfx::RectF( |
216 uv_scale_x * content_rect_.x() / content_rect_.width(), | 212 uv_scale_x * content_rect_.x() / content_rect_.width(), |
217 uv_scale_y * content_rect_.y() / content_rect_.height(), | 213 uv_scale_y * content_rect_.y() / content_rect_.height(), |
218 uv_scale_x, | 214 uv_scale_x, |
219 uv_scale_y); | 215 uv_scale_y); |
220 } | 216 } |
221 | 217 |
222 ResourceProvider::ResourceId mask_resource_id = | 218 ResourceProvider::ResourceId mask_resource_id = |
223 mask_layer ? mask_layer->ContentsResourceId() : 0; | 219 mask_layer ? mask_layer->ContentsResourceId() : 0; |
224 gfx::Rect contents_changed_since_last_frame = | |
225 ContentsChanged() ? content_rect_ : gfx::Rect(); | |
226 | 220 |
227 DCHECK(owning_layer_->draw_properties().target_space_transform.IsScale2d()); | 221 DCHECK(owning_layer_->draw_properties().target_space_transform.IsScale2d()); |
228 gfx::Vector2dF owning_layer_to_target_scale = | 222 gfx::Vector2dF owning_layer_to_target_scale = |
229 owning_layer_->draw_properties().target_space_transform.Scale2d(); | 223 owning_layer_->draw_properties().target_space_transform.Scale2d(); |
230 owning_layer_to_target_scale.Scale(owning_layer_->contents_scale_x(), | 224 owning_layer_to_target_scale.Scale(owning_layer_->contents_scale_x(), |
231 owning_layer_->contents_scale_y()); | 225 owning_layer_->contents_scale_y()); |
232 | 226 |
233 RenderPassDrawQuad* quad = | 227 RenderPassDrawQuad* quad = |
234 render_pass->CreateAndAppendDrawQuad<RenderPassDrawQuad>(); | 228 render_pass->CreateAndAppendDrawQuad<RenderPassDrawQuad>(); |
235 quad->SetNew(shared_quad_state, | 229 quad->SetNew(shared_quad_state, |
236 content_rect_, | 230 content_rect_, |
237 visible_content_rect, | 231 visible_content_rect, |
238 render_pass_id, | 232 render_pass_id, |
239 for_replica, | |
240 mask_resource_id, | 233 mask_resource_id, |
241 contents_changed_since_last_frame, | |
242 mask_uv_rect, | 234 mask_uv_rect, |
243 owning_layer_->filters(), | 235 owning_layer_->filters(), |
244 owning_layer_to_target_scale, | 236 owning_layer_to_target_scale, |
245 owning_layer_->background_filters()); | 237 owning_layer_->background_filters()); |
246 } | 238 } |
247 | 239 |
248 } // namespace cc | 240 } // namespace cc |
OLD | NEW |