Index: cc/trees/occlusion.cc |
diff --git a/cc/trees/occlusion.cc b/cc/trees/occlusion.cc |
index d9da9382bcafc6788128ba25488412599dc11356..1e47871447dc36fa839f99512ae7bb7d03729f8b 100644 |
--- a/cc/trees/occlusion.cc |
+++ b/cc/trees/occlusion.cc |
@@ -20,14 +20,26 @@ Occlusion::Occlusion(const gfx::Transform& draw_transform, |
occlusion_from_inside_target_(occlusion_from_inside_target) { |
} |
+Occlusion Occlusion::GetOcclusionWithScaledDrawTransform(SkMScalar x, |
+ SkMScalar y) { |
+ gfx::Transform scaled_transform = draw_transform_; |
+ scaled_transform.Scale(x, y); |
danakj
2014/10/05 17:27:38
Rather than doing these matrix multiplies twice yo
vmpstr
2014/10/06 15:44:51
I think this is a great idea. I think I'll add som
|
+ return Occlusion(scaled_transform, |
+ occlusion_from_outside_target_, |
+ occlusion_from_inside_target_); |
+} |
+ |
+bool Occlusion::HasOcclusion() const { |
+ return !occlusion_from_inside_target_.IsEmpty() || |
+ !occlusion_from_outside_target_.IsEmpty(); |
+} |
+ |
bool Occlusion::IsOccluded(const gfx::Rect& content_rect) const { |
if (content_rect.IsEmpty()) |
return true; |
- if (occlusion_from_inside_target_.IsEmpty() && |
- occlusion_from_outside_target_.IsEmpty()) { |
+ if (!HasOcclusion()) |
return false; |
- } |
gfx::Rect unoccluded_rect_in_target_surface = |
GetUnoccludedRectInTargetSurface(content_rect); |
@@ -39,10 +51,8 @@ gfx::Rect Occlusion::GetUnoccludedContentRect( |
if (content_rect.IsEmpty()) |
return content_rect; |
- if (occlusion_from_inside_target_.IsEmpty() && |
- occlusion_from_outside_target_.IsEmpty()) { |
+ if (!HasOcclusion()) |
return content_rect; |
- } |
gfx::Rect unoccluded_rect_in_target_surface = |
GetUnoccludedRectInTargetSurface(content_rect); |