| 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 RenderPassDrawQuad* quad = | 221 RenderPassDrawQuad* quad = |
| 228 render_pass->CreateAndAppendDrawQuad<RenderPassDrawQuad>(); | 222 render_pass->CreateAndAppendDrawQuad<RenderPassDrawQuad>(); |
| 229 quad->SetNew(shared_quad_state, | 223 quad->SetNew(shared_quad_state, |
| 230 content_rect_, | 224 content_rect_, |
| 231 visible_content_rect, | 225 visible_content_rect, |
| 232 render_pass_id, | 226 render_pass_id, |
| 233 for_replica, | |
| 234 mask_resource_id, | 227 mask_resource_id, |
| 235 contents_changed_since_last_frame, | |
| 236 mask_uv_rect, | 228 mask_uv_rect, |
| 237 owning_layer_->filters(), | 229 owning_layer_->filters(), |
| 238 owning_layer_->background_filters()); | 230 owning_layer_->background_filters()); |
| 239 } | 231 } |
| 240 | 232 |
| 241 } // namespace cc | 233 } // namespace cc |
| OLD | NEW |