Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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/trees/occlusion_tracker.h" | 5 #include "cc/trees/occlusion_tracker.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 | 10 |
| (...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 214 return; | 214 return; |
| 215 | 215 |
| 216 gfx::Rect affected_area_in_target = | 216 gfx::Rect affected_area_in_target = |
| 217 MathUtil::MapEnclosingClippedRect(surface_transform, surface_rect); | 217 MathUtil::MapEnclosingClippedRect(surface_transform, surface_rect); |
| 218 if (contributing_surface->is_clipped()) { | 218 if (contributing_surface->is_clipped()) { |
| 219 affected_area_in_target.Intersect(contributing_surface->clip_rect()); | 219 affected_area_in_target.Intersect(contributing_surface->clip_rect()); |
| 220 } | 220 } |
| 221 if (affected_area_in_target.IsEmpty()) | 221 if (affected_area_in_target.IsEmpty()) |
| 222 return; | 222 return; |
| 223 | 223 |
| 224 int outset_top, outset_right, outset_bottom, outset_left; | |
| 225 contributing_surface->BackgroundFilters().GetOutsets( | |
| 226 &outset_top, &outset_right, &outset_bottom, &outset_left); | |
| 227 | |
| 228 // The filter can move pixels from outside of the clip, so allow affected_area | 224 // The filter can move pixels from outside of the clip, so allow affected_area |
| 229 // to expand outside the clip. Notably the content we're concerned with here | 225 // to expand outside the clip. Notably the content we're concerned with here |
| 230 // is not the affected area, but rather stuff slightly outside it. Thus the | 226 // is not the affected area, but rather stuff slightly outside it. Thus the |
|
danakj
2017/05/19 19:28:54
I think this comment doesn't explain what we have
| |
| 231 // directions of the outsets are reversed from normal. | 227 // directions of the outsets are reversed from normal. |
| 232 affected_area_in_target.Inset(-outset_right, -outset_bottom, -outset_left, | 228 int outset_top, outset_right, outset_bottom, outset_left; |
| 233 -outset_top); | 229 contributing_surface->BackgroundFilters().GetOutsets( |
| 230 &outset_bottom, &outset_left, &outset_top, &outset_right); | |
| 231 | |
| 232 affected_area_in_target.Inset(-outset_left, -outset_top, -outset_right, | |
| 233 -outset_bottom); | |
| 234 SimpleEnclosedRegion affected_occlusion = *occlusion_from_inside_target; | 234 SimpleEnclosedRegion affected_occlusion = *occlusion_from_inside_target; |
| 235 affected_occlusion.Intersect(affected_area_in_target); | 235 affected_occlusion.Intersect(affected_area_in_target); |
| 236 | 236 |
| 237 occlusion_from_inside_target->Subtract(affected_area_in_target); | 237 occlusion_from_inside_target->Subtract(affected_area_in_target); |
| 238 for (size_t i = 0; i < affected_occlusion.GetRegionComplexity(); ++i) { | 238 for (size_t i = 0; i < affected_occlusion.GetRegionComplexity(); ++i) { |
| 239 gfx::Rect occlusion_rect = affected_occlusion.GetRect(i); | 239 gfx::Rect occlusion_rect = affected_occlusion.GetRect(i); |
| 240 | 240 |
| 241 // Shrink the rect by expanding the non-opaque pixels outside the rect. | 241 // Shrink the rect by expanding the non-opaque pixels outside the rect. |
| 242 | 242 |
| 243 // The left outset of the filters moves pixels on the right side of | 243 // The left outset of the filters moves pixels on the right side of |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 374 DCHECK(layer_tree->RootRenderSurface() == stack_.back().target); | 374 DCHECK(layer_tree->RootRenderSurface() == stack_.back().target); |
| 375 const SimpleEnclosedRegion& occluded = | 375 const SimpleEnclosedRegion& occluded = |
| 376 stack_.back().occlusion_from_inside_target; | 376 stack_.back().occlusion_from_inside_target; |
| 377 Region visible_region(screen_space_clip_rect_); | 377 Region visible_region(screen_space_clip_rect_); |
| 378 for (size_t i = 0; i < occluded.GetRegionComplexity(); ++i) | 378 for (size_t i = 0; i < occluded.GetRegionComplexity(); ++i) |
| 379 visible_region.Subtract(occluded.GetRect(i)); | 379 visible_region.Subtract(occluded.GetRect(i)); |
| 380 return visible_region; | 380 return visible_region; |
| 381 } | 381 } |
| 382 | 382 |
| 383 } // namespace cc | 383 } // namespace cc |
| OLD | NEW |