| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 | 10 |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 } | 122 } |
| 123 | 123 |
| 124 bool RenderSurfaceImpl::HasReplica() const { | 124 bool RenderSurfaceImpl::HasReplica() const { |
| 125 return owning_layer_->has_replica(); | 125 return owning_layer_->has_replica(); |
| 126 } | 126 } |
| 127 | 127 |
| 128 const LayerImpl* RenderSurfaceImpl::ReplicaLayer() const { | 128 const LayerImpl* RenderSurfaceImpl::ReplicaLayer() const { |
| 129 return owning_layer_->replica_layer(); | 129 return owning_layer_->replica_layer(); |
| 130 } | 130 } |
| 131 | 131 |
| 132 bool RenderSurfaceImpl::HasCopyRequest() const { |
| 133 return owning_layer_->layer_tree_impl() |
| 134 ->property_trees() |
| 135 ->effect_tree.Node(EffectTreeIndex()) |
| 136 ->data.has_copy_request; |
| 137 } |
| 138 |
| 132 int RenderSurfaceImpl::TransformTreeIndex() const { | 139 int RenderSurfaceImpl::TransformTreeIndex() const { |
| 133 return owning_layer_->transform_tree_index(); | 140 return owning_layer_->transform_tree_index(); |
| 134 } | 141 } |
| 135 | 142 |
| 136 int RenderSurfaceImpl::ClipTreeIndex() const { | 143 int RenderSurfaceImpl::ClipTreeIndex() const { |
| 137 return owning_layer_->clip_tree_index(); | 144 return owning_layer_->clip_tree_index(); |
| 138 } | 145 } |
| 139 | 146 |
| 140 int RenderSurfaceImpl::EffectTreeIndex() const { | 147 int RenderSurfaceImpl::EffectTreeIndex() const { |
| 141 return owning_layer_->effect_tree_index(); | 148 return owning_layer_->effect_tree_index(); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 155 | 162 |
| 156 surface_property_changed_ = true; | 163 surface_property_changed_ = true; |
| 157 draw_properties_.content_rect = content_rect; | 164 draw_properties_.content_rect = content_rect; |
| 158 } | 165 } |
| 159 | 166 |
| 160 void RenderSurfaceImpl::SetContentRectForTesting(const gfx::Rect& rect) { | 167 void RenderSurfaceImpl::SetContentRectForTesting(const gfx::Rect& rect) { |
| 161 SetContentRect(rect); | 168 SetContentRect(rect); |
| 162 } | 169 } |
| 163 | 170 |
| 164 gfx::Rect RenderSurfaceImpl::CalculateClippedAccumulatedContentRect() { | 171 gfx::Rect RenderSurfaceImpl::CalculateClippedAccumulatedContentRect() { |
| 165 if (owning_layer_->replica_layer() || owning_layer_->HasCopyRequest() || | 172 if (owning_layer_->replica_layer() || HasCopyRequest() || !is_clipped()) |
| 166 !is_clipped()) | |
| 167 return accumulated_content_rect(); | 173 return accumulated_content_rect(); |
| 168 | 174 |
| 169 if (accumulated_content_rect().IsEmpty()) | 175 if (accumulated_content_rect().IsEmpty()) |
| 170 return gfx::Rect(); | 176 return gfx::Rect(); |
| 171 | 177 |
| 172 // Calculate projection from the target surface rect to local | 178 // Calculate projection from the target surface rect to local |
| 173 // space. Non-invertible draw transforms means no able to bring clipped rect | 179 // space. Non-invertible draw transforms means no able to bring clipped rect |
| 174 // in target space back to local space, early out without clip. | 180 // in target space back to local space, early out without clip. |
| 175 gfx::Transform target_to_surface(gfx::Transform::kSkipInitialization); | 181 gfx::Transform target_to_surface(gfx::Transform::kSkipInitialization); |
| 176 if (!draw_transform().GetInverse(&target_to_surface)) | 182 if (!draw_transform().GetInverse(&target_to_surface)) |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 355 RenderPassDrawQuad* quad = | 361 RenderPassDrawQuad* quad = |
| 356 render_pass->CreateAndAppendDrawQuad<RenderPassDrawQuad>(); | 362 render_pass->CreateAndAppendDrawQuad<RenderPassDrawQuad>(); |
| 357 quad->SetNew(shared_quad_state, content_rect(), visible_layer_rect, | 363 quad->SetNew(shared_quad_state, content_rect(), visible_layer_rect, |
| 358 render_pass_id, mask_resource_id, mask_uv_scale, | 364 render_pass_id, mask_resource_id, mask_uv_scale, |
| 359 mask_texture_size, owning_layer_->filters(), | 365 mask_texture_size, owning_layer_->filters(), |
| 360 owning_layer_to_target_scale, | 366 owning_layer_to_target_scale, |
| 361 owning_layer_->background_filters()); | 367 owning_layer_->background_filters()); |
| 362 } | 368 } |
| 363 | 369 |
| 364 } // namespace cc | 370 } // namespace cc |
| OLD | NEW |