Index: cc/trees/occlusion_tracker.cc |
diff --git a/cc/trees/occlusion_tracker.cc b/cc/trees/occlusion_tracker.cc |
index 1418b9359c512f8ef6103398a693211b0d5ea1f1..9ca733d2e77c0580c5c479e4119eadf6cad4dd92 100644 |
--- a/cc/trees/occlusion_tracker.cc |
+++ b/cc/trees/occlusion_tracker.cc |
@@ -84,12 +84,9 @@ static SimpleEnclosedRegion TransformSurfaceOpaqueRegion( |
SimpleEnclosedRegion transformed_region; |
for (size_t i = 0; i < region.GetRegionComplexity(); ++i) { |
- bool clipped; |
- gfx::QuadF transformed_quad = |
- MathUtil::MapQuad(transform, gfx::QuadF(region.GetRect(i)), &clipped); |
+ // NonClippedRect is okay because we checked Preserves2dAxisAlignment above. |
gfx::Rect transformed_rect = |
- gfx::ToEnclosedRect(transformed_quad.BoundingBox()); |
- DCHECK(!clipped); // We only map if the transform preserves axis alignment. |
+ MathUtil::MapEnclosedNonClippedRect(transform, region.GetRect(i)); |
if (have_clip_rect) |
transformed_rect.Intersect(clip_rect_in_new_target); |
transformed_region.Union(transformed_rect); |
@@ -432,14 +429,9 @@ void OcclusionTracker<LayerType>::MarkOccludedBehindLayer( |
} |
for (size_t i = 0; i < opaque_contents.GetRegionComplexity(); ++i) { |
- bool clipped; |
- gfx::QuadF transformed_quad = |
- MathUtil::MapQuad(layer->draw_transform(), |
- gfx::QuadF(opaque_contents.GetRect(i)), |
- &clipped); |
- gfx::Rect transformed_rect = |
- gfx::ToEnclosedRect(transformed_quad.BoundingBox()); |
- DCHECK(!clipped); // We only map if the transform preserves axis alignment. |
+ // NonClippedRect is okay because we checked Preserves2dAxisAlignment above. |
+ gfx::Rect transformed_rect = MathUtil::MapEnclosedNonClippedRect( |
+ layer->draw_transform(), opaque_contents.GetRect(i)); |
transformed_rect.Intersect(clip_rect_in_target); |
if (transformed_rect.width() < minimum_tracking_size_.width() && |
transformed_rect.height() < minimum_tracking_size_.height()) |
@@ -450,13 +442,9 @@ void OcclusionTracker<LayerType>::MarkOccludedBehindLayer( |
continue; |
// Save the occluding area in screen space for debug visualization. |
- gfx::QuadF screen_space_quad = MathUtil::MapQuad( |
+ gfx::Rect screen_space_rect = MathUtil::MapEnclosedClippedRect( |
layer->render_target()->render_surface()->screen_space_transform(), |
- gfx::QuadF(transformed_rect), &clipped); |
- // TODO(danakj): Store the quad in the debug info instead of the bounding |
- // box. |
- gfx::Rect screen_space_rect = |
- gfx::ToEnclosedRect(screen_space_quad.BoundingBox()); |
+ transformed_rect); |
occluding_screen_space_rects_->push_back(screen_space_rect); |
} |
@@ -469,24 +457,16 @@ void OcclusionTracker<LayerType>::MarkOccludedBehindLayer( |
for (Region::Iterator non_opaque_content_rects(non_opaque_contents); |
non_opaque_content_rects.has_rect(); |
non_opaque_content_rects.next()) { |
- // We've already checked for clipping in the MapQuad call above, these calls |
- // should not clip anything further. |
- gfx::Rect transformed_rect = gfx::ToEnclosedRect( |
- MathUtil::MapClippedRect(layer->draw_transform(), |
- gfx::RectF(non_opaque_content_rects.rect()))); |
+ // NonClippedRect is okay because we checked Preserves2dAxisAlignment above. |
+ gfx::Rect transformed_rect = MathUtil::MapEnclosedNonClippedRect( |
+ layer->draw_transform(), non_opaque_content_rects.rect()); |
transformed_rect.Intersect(clip_rect_in_target); |
if (transformed_rect.IsEmpty()) |
continue; |
- bool clipped; |
- gfx::QuadF screen_space_quad = MathUtil::MapQuad( |
+ gfx::Rect screen_space_rect = MathUtil::MapEnclosedClippedRect( |
layer->render_target()->render_surface()->screen_space_transform(), |
- gfx::QuadF(transformed_rect), |
- &clipped); |
- // TODO(danakj): Store the quad in the debug info instead of the bounding |
- // box. |
- gfx::Rect screen_space_rect = |
- gfx::ToEnclosedRect(screen_space_quad.BoundingBox()); |
+ transformed_rect); |
non_occluding_screen_space_rects_->push_back(screen_space_rect); |
} |
} |
@@ -520,7 +500,7 @@ bool OcclusionTracker<LayerType>::Occluded( |
if (!draw_transform.GetInverse(&inverse_draw_transform)) |
return false; |
- // Take the ToEnclosingRect at each step, as we want to contain any unoccluded |
+ // Take the EnclosingRect at each step, as we want to contain any unoccluded |
// partial pixels in the resulting Rect. |
gfx::Rect unoccluded_rect_in_target_surface = |
MathUtil::MapEnclosingClippedRect(draw_transform, content_rect); |
@@ -554,7 +534,7 @@ gfx::Rect OcclusionTracker<LayerType>::UnoccludedContentRect( |
if (!draw_transform.GetInverse(&inverse_draw_transform)) |
return content_rect; |
- // Take the ToEnclosingRect at each step, as we want to contain any unoccluded |
+ // Take the EnclosingRect at each step, as we want to contain any unoccluded |
// partial pixels in the resulting Rect. |
gfx::Rect unoccluded_rect_in_target_surface = |
MathUtil::MapEnclosingClippedRect(draw_transform, content_rect); |
@@ -600,7 +580,7 @@ gfx::Rect OcclusionTracker<LayerType>::UnoccludedContributingSurfaceContentRect( |
if (!draw_transform.GetInverse(&inverse_draw_transform)) |
return content_rect; |
- // Take the ToEnclosingRect at each step, as we want to contain any unoccluded |
+ // Take the EnclosingRect at each step, as we want to contain any unoccluded |
// partial pixels in the resulting Rect. |
gfx::Rect unoccluded_rect_in_target_surface = |
MathUtil::MapEnclosingClippedRect(draw_transform, content_rect); |