| 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 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 204 affected_area_in_target.Intersect(contributing_surface->clip_rect()); | 204 affected_area_in_target.Intersect(contributing_surface->clip_rect()); |
| 205 } | 205 } |
| 206 if (affected_area_in_target.IsEmpty()) | 206 if (affected_area_in_target.IsEmpty()) |
| 207 return; | 207 return; |
| 208 | 208 |
| 209 int outset_top, outset_right, outset_bottom, outset_left; | 209 int outset_top, outset_right, outset_bottom, outset_left; |
| 210 contributing_surface->BackgroundFilters().GetOutsets( | 210 contributing_surface->BackgroundFilters().GetOutsets( |
| 211 &outset_top, &outset_right, &outset_bottom, &outset_left); | 211 &outset_top, &outset_right, &outset_bottom, &outset_left); |
| 212 | 212 |
| 213 // The filter can move pixels from outside of the clip, so allow affected_area | 213 // The filter can move pixels from outside of the clip, so allow affected_area |
| 214 // to expand outside the clip. | 214 // to expand outside the clip. Notably the content we're concerned with here |
| 215 affected_area_in_target.Inset( | 215 // is not the affected area, but rather stuff slightly outside it. Thus the |
| 216 -outset_left, -outset_top, -outset_right, -outset_bottom); | 216 // directions of the outsets are reversed from normal. |
| 217 affected_area_in_target.Inset(-outset_right, -outset_bottom, -outset_left, |
| 218 -outset_top); |
| 217 SimpleEnclosedRegion affected_occlusion = *occlusion_from_inside_target; | 219 SimpleEnclosedRegion affected_occlusion = *occlusion_from_inside_target; |
| 218 affected_occlusion.Intersect(affected_area_in_target); | 220 affected_occlusion.Intersect(affected_area_in_target); |
| 219 | 221 |
| 220 occlusion_from_inside_target->Subtract(affected_area_in_target); | 222 occlusion_from_inside_target->Subtract(affected_area_in_target); |
| 221 for (size_t i = 0; i < affected_occlusion.GetRegionComplexity(); ++i) { | 223 for (size_t i = 0; i < affected_occlusion.GetRegionComplexity(); ++i) { |
| 222 gfx::Rect occlusion_rect = affected_occlusion.GetRect(i); | 224 gfx::Rect occlusion_rect = affected_occlusion.GetRect(i); |
| 223 | 225 |
| 224 // Shrink the rect by expanding the non-opaque pixels outside the rect. | 226 // Shrink the rect by expanding the non-opaque pixels outside the rect. |
| 225 | 227 |
| 226 // The left outset of the filters moves pixels on the right side of | 228 // The left outset of the filters moves pixels on the right side of |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 382 DCHECK(layer_tree->RootRenderSurface() == stack_.back().target); | 384 DCHECK(layer_tree->RootRenderSurface() == stack_.back().target); |
| 383 const SimpleEnclosedRegion& occluded = | 385 const SimpleEnclosedRegion& occluded = |
| 384 stack_.back().occlusion_from_inside_target; | 386 stack_.back().occlusion_from_inside_target; |
| 385 Region visible_region(screen_space_clip_rect_); | 387 Region visible_region(screen_space_clip_rect_); |
| 386 for (size_t i = 0; i < occluded.GetRegionComplexity(); ++i) | 388 for (size_t i = 0; i < occluded.GetRegionComplexity(); ++i) |
| 387 visible_region.Subtract(occluded.GetRect(i)); | 389 visible_region.Subtract(occluded.GetRect(i)); |
| 388 return visible_region; | 390 return visible_region; |
| 389 } | 391 } |
| 390 | 392 |
| 391 } // namespace cc | 393 } // namespace cc |
| OLD | NEW |