Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(595)

Side by Side Diff: cc/layers/render_surface_impl.cc

Issue 2751783002: cc: Replace LayerIterator with iterator that walks layer list and effect tree (Closed)
Patch Set: Rebase Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « cc/layers/render_surface_impl.h ('k') | cc/trees/damage_tracker.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 20 matching lines...) Expand all
31 namespace cc { 31 namespace cc {
32 32
33 RenderSurfaceImpl::RenderSurfaceImpl(LayerTreeImpl* layer_tree_impl, 33 RenderSurfaceImpl::RenderSurfaceImpl(LayerTreeImpl* layer_tree_impl,
34 int stable_effect_id) 34 int stable_effect_id)
35 : layer_tree_impl_(layer_tree_impl), 35 : layer_tree_impl_(layer_tree_impl),
36 stable_effect_id_(stable_effect_id), 36 stable_effect_id_(stable_effect_id),
37 effect_tree_index_(EffectTree::kInvalidNodeId), 37 effect_tree_index_(EffectTree::kInvalidNodeId),
38 surface_property_changed_(false), 38 surface_property_changed_(false),
39 ancestor_property_changed_(false), 39 ancestor_property_changed_(false),
40 contributes_to_drawn_surface_(false), 40 contributes_to_drawn_surface_(false),
41 nearest_occlusion_immune_ancestor_(nullptr), 41 nearest_occlusion_immune_ancestor_(nullptr) {
42 target_render_surface_layer_index_history_(0),
43 current_layer_index_history_(0) {
44 damage_tracker_ = DamageTracker::Create(); 42 damage_tracker_ = DamageTracker::Create();
45 } 43 }
46 44
47 RenderSurfaceImpl::~RenderSurfaceImpl() {} 45 RenderSurfaceImpl::~RenderSurfaceImpl() {}
48 46
49 RenderSurfaceImpl* RenderSurfaceImpl::render_target() { 47 RenderSurfaceImpl* RenderSurfaceImpl::render_target() {
50 EffectTree& effect_tree = layer_tree_impl_->property_trees()->effect_tree; 48 EffectTree& effect_tree = layer_tree_impl_->property_trees()->effect_tree;
51 EffectNode* node = effect_tree.Node(EffectTreeIndex()); 49 EffectNode* node = effect_tree.Node(EffectTreeIndex());
52 if (node->target_id != EffectTree::kRootNodeId) 50 if (node->target_id != EffectTree::kRootNodeId)
53 return effect_tree.GetRenderSurface(node->target_id); 51 return effect_tree.GetRenderSurface(node->target_id);
(...skipping 19 matching lines...) Expand all
73 RenderSurfaceImpl::DrawProperties::~DrawProperties() {} 71 RenderSurfaceImpl::DrawProperties::~DrawProperties() {}
74 72
75 gfx::RectF RenderSurfaceImpl::DrawableContentRect() const { 73 gfx::RectF RenderSurfaceImpl::DrawableContentRect() const {
76 if (content_rect().IsEmpty()) 74 if (content_rect().IsEmpty())
77 return gfx::RectF(); 75 return gfx::RectF();
78 76
79 gfx::Rect surface_content_rect = content_rect(); 77 gfx::Rect surface_content_rect = content_rect();
80 const FilterOperations& filters = Filters(); 78 const FilterOperations& filters = Filters();
81 if (!filters.IsEmpty()) { 79 if (!filters.IsEmpty()) {
82 surface_content_rect = 80 surface_content_rect =
83 filters.MapRect(surface_content_rect, FiltersTransform().matrix()); 81 filters.MapRect(surface_content_rect, SurfaceScale().matrix());
84 } 82 }
85 gfx::RectF drawable_content_rect = MathUtil::MapClippedRect( 83 gfx::RectF drawable_content_rect = MathUtil::MapClippedRect(
86 draw_transform(), gfx::RectF(surface_content_rect)); 84 draw_transform(), gfx::RectF(surface_content_rect));
87 if (!filters.IsEmpty() && is_clipped()) { 85 if (!filters.IsEmpty() && is_clipped()) {
88 // Filter could move pixels around, but still need to be clipped. 86 // Filter could move pixels around, but still need to be clipped.
89 drawable_content_rect.Intersect(gfx::RectF(clip_rect())); 87 drawable_content_rect.Intersect(gfx::RectF(clip_rect()));
90 } 88 }
91 89
92 // If the rect has a NaN coordinate, we return empty rect to avoid crashes in 90 // If the rect has a NaN coordinate, we return empty rect to avoid crashes in
93 // functions (for example, gfx::ToEnclosedRect) that are called on this rect. 91 // functions (for example, gfx::ToEnclosedRect) that are called on this rect.
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 } 125 }
128 126
129 const FilterOperations& RenderSurfaceImpl::Filters() const { 127 const FilterOperations& RenderSurfaceImpl::Filters() const {
130 return OwningEffectNode()->filters; 128 return OwningEffectNode()->filters;
131 } 129 }
132 130
133 gfx::PointF RenderSurfaceImpl::FiltersOrigin() const { 131 gfx::PointF RenderSurfaceImpl::FiltersOrigin() const {
134 return OwningEffectNode()->filters_origin; 132 return OwningEffectNode()->filters_origin;
135 } 133 }
136 134
137 gfx::Transform RenderSurfaceImpl::FiltersTransform() const { 135 gfx::Transform RenderSurfaceImpl::SurfaceScale() const {
138 gfx::Transform filters_transform; 136 gfx::Transform surface_scale;
139 filters_transform.Scale(OwningEffectNode()->surface_contents_scale.x(), 137 surface_scale.Scale(OwningEffectNode()->surface_contents_scale.x(),
140 OwningEffectNode()->surface_contents_scale.y()); 138 OwningEffectNode()->surface_contents_scale.y());
141 return filters_transform; 139 return surface_scale;
142 } 140 }
143 141
144 const FilterOperations& RenderSurfaceImpl::BackgroundFilters() const { 142 const FilterOperations& RenderSurfaceImpl::BackgroundFilters() const {
145 return OwningEffectNode()->background_filters; 143 return OwningEffectNode()->background_filters;
146 } 144 }
147 145
148 bool RenderSurfaceImpl::HasCopyRequest() const { 146 bool RenderSurfaceImpl::HasCopyRequest() const {
149 return OwningEffectNode()->has_copy_request; 147 return OwningEffectNode()->has_copy_request;
150 } 148 }
151 149
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 } 185 }
188 186
189 void RenderSurfaceImpl::SetContentRectForTesting(const gfx::Rect& rect) { 187 void RenderSurfaceImpl::SetContentRectForTesting(const gfx::Rect& rect) {
190 SetContentRect(rect); 188 SetContentRect(rect);
191 } 189 }
192 190
193 gfx::Rect RenderSurfaceImpl::CalculateExpandedClipForFilters( 191 gfx::Rect RenderSurfaceImpl::CalculateExpandedClipForFilters(
194 const gfx::Transform& target_to_surface) { 192 const gfx::Transform& target_to_surface) {
195 gfx::Rect clip_in_surface_space = 193 gfx::Rect clip_in_surface_space =
196 MathUtil::ProjectEnclosingClippedRect(target_to_surface, clip_rect()); 194 MathUtil::ProjectEnclosingClippedRect(target_to_surface, clip_rect());
197 gfx::Rect expanded_clip_in_surface_space = Filters().MapRectReverse( 195 gfx::Rect expanded_clip_in_surface_space =
198 clip_in_surface_space, FiltersTransform().matrix()); 196 Filters().MapRectReverse(clip_in_surface_space, SurfaceScale().matrix());
199 gfx::Rect expanded_clip_in_target_space = MathUtil::MapEnclosingClippedRect( 197 gfx::Rect expanded_clip_in_target_space = MathUtil::MapEnclosingClippedRect(
200 draw_transform(), expanded_clip_in_surface_space); 198 draw_transform(), expanded_clip_in_surface_space);
201 return expanded_clip_in_target_space; 199 return expanded_clip_in_target_space;
202 } 200 }
203 201
204 gfx::Rect RenderSurfaceImpl::CalculateClippedAccumulatedContentRect() { 202 gfx::Rect RenderSurfaceImpl::CalculateClippedAccumulatedContentRect() {
205 if (HasCopyRequest() || !is_clipped()) 203 if (HasCopyRequest() || !is_clipped())
206 return accumulated_content_rect(); 204 return accumulated_content_rect();
207 205
208 if (accumulated_content_rect().IsEmpty()) 206 if (accumulated_content_rect().IsEmpty())
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
420 RenderPassDrawQuad* quad = 418 RenderPassDrawQuad* quad =
421 render_pass->CreateAndAppendDrawQuad<RenderPassDrawQuad>(); 419 render_pass->CreateAndAppendDrawQuad<RenderPassDrawQuad>();
422 quad->SetNew( 420 quad->SetNew(
423 shared_quad_state, content_rect(), visible_layer_rect, GetRenderPassId(), 421 shared_quad_state, content_rect(), visible_layer_rect, GetRenderPassId(),
424 mask_resource_id, gfx::ScaleRect(gfx::RectF(content_rect()), 422 mask_resource_id, gfx::ScaleRect(gfx::RectF(content_rect()),
425 mask_uv_scale.x(), mask_uv_scale.y()), 423 mask_uv_scale.x(), mask_uv_scale.y()),
426 mask_texture_size, surface_contents_scale, FiltersOrigin(), gfx::RectF()); 424 mask_texture_size, surface_contents_scale, FiltersOrigin(), gfx::RectF());
427 } 425 }
428 426
429 } // namespace cc 427 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layers/render_surface_impl.h ('k') | cc/trees/damage_tracker.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698