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

Unified Diff: cc/trees/occlusion.cc

Issue 607023003: cc: Unify the occlusion access by adding an ability to scale transform. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: +tests Created 6 years, 2 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 side-by-side diff with in-line comments
Download patch
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);
« cc/cc_tests.gyp ('K') | « cc/trees/occlusion.h ('k') | cc/trees/occlusion_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698