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

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

Issue 1935613002: cc: Move filter outset in content rect calculation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@visiblerectcleanup
Patch Set: rebase Created 4 years, 7 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 | « no previous file | 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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 } 63 }
64 64
65 RenderSurfaceImpl::DrawProperties::DrawProperties() { 65 RenderSurfaceImpl::DrawProperties::DrawProperties() {
66 draw_opacity = 1.f; 66 draw_opacity = 1.f;
67 is_clipped = false; 67 is_clipped = false;
68 } 68 }
69 69
70 RenderSurfaceImpl::DrawProperties::~DrawProperties() {} 70 RenderSurfaceImpl::DrawProperties::~DrawProperties() {}
71 71
72 gfx::RectF RenderSurfaceImpl::DrawableContentRect() const { 72 gfx::RectF RenderSurfaceImpl::DrawableContentRect() const {
73 gfx::RectF drawable_content_rect = 73 if (content_rect().IsEmpty())
74 MathUtil::MapClippedRect(draw_transform(), gfx::RectF(content_rect())); 74 return gfx::RectF();
75 if (owning_layer_->has_replica()) { 75
76 drawable_content_rect.Union(MathUtil::MapClippedRect( 76 gfx::Rect surface_content_rect = content_rect();
77 replica_draw_transform(), gfx::RectF(content_rect())));
78 }
79 if (!owning_layer_->filters().IsEmpty()) { 77 if (!owning_layer_->filters().IsEmpty()) {
80 int left, top, right, bottom; 78 int left, top, right, bottom;
81 owning_layer_->filters().GetOutsets(&top, &right, &bottom, &left); 79 owning_layer_->filters().GetOutsets(&top, &right, &bottom, &left);
82 drawable_content_rect.Inset(-left, -top, -right, -bottom); 80 surface_content_rect.Inset(-left, -top, -right, -bottom);
81 }
82 gfx::RectF drawable_content_rect = MathUtil::MapClippedRect(
83 draw_transform(), gfx::RectF(surface_content_rect));
84 if (owning_layer_->has_replica()) {
85 drawable_content_rect.Union(MathUtil::MapClippedRect(
86 replica_draw_transform(), gfx::RectF(surface_content_rect)));
87 } else if (!owning_layer_->filters().IsEmpty() && is_clipped()) {
88 // Filter could move pixels around, but still need to be clipped.
89 drawable_content_rect.Intersect(gfx::RectF(clip_rect()));
83 } 90 }
84 91
85 // If the rect has a NaN coordinate, we return empty rect to avoid crashes in 92 // If the rect has a NaN coordinate, we return empty rect to avoid crashes in
86 // functions (for example, gfx::ToEnclosedRect) that are called on this rect. 93 // functions (for example, gfx::ToEnclosedRect) that are called on this rect.
87 if (std::isnan(drawable_content_rect.x()) || 94 if (std::isnan(drawable_content_rect.x()) ||
88 std::isnan(drawable_content_rect.y()) || 95 std::isnan(drawable_content_rect.y()) ||
89 std::isnan(drawable_content_rect.right()) || 96 std::isnan(drawable_content_rect.right()) ||
90 std::isnan(drawable_content_rect.bottom())) 97 std::isnan(drawable_content_rect.bottom()))
91 return gfx::RectF(); 98 return gfx::RectF();
92 99
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after
348 RenderPassDrawQuad* quad = 355 RenderPassDrawQuad* quad =
349 render_pass->CreateAndAppendDrawQuad<RenderPassDrawQuad>(); 356 render_pass->CreateAndAppendDrawQuad<RenderPassDrawQuad>();
350 quad->SetNew(shared_quad_state, content_rect(), visible_layer_rect, 357 quad->SetNew(shared_quad_state, content_rect(), visible_layer_rect,
351 render_pass_id, mask_resource_id, mask_uv_scale, 358 render_pass_id, mask_resource_id, mask_uv_scale,
352 mask_texture_size, owning_layer_->filters(), 359 mask_texture_size, owning_layer_->filters(),
353 owning_layer_to_target_scale, 360 owning_layer_to_target_scale,
354 owning_layer_->background_filters()); 361 owning_layer_->background_filters());
355 } 362 }
356 363
357 } // namespace cc 364 } // namespace cc
OLDNEW
« no previous file with comments | « no previous file | cc/trees/damage_tracker.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698