[chromium] Make culling work with clipped rects
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 9 Apr 2012 09:05:50 +0000 (09:05 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 9 Apr 2012 09:05:50 +0000 (09:05 +0000)
commit3712a72912bbe5d94d791c815e82c5d6b367c26f
treeb1de0695d18f8e9d28b59bbbea60a1bc7fe6e605
parent20b38dbe2b5ab4499c370e0b8b022c0314f019e4
[chromium] Make culling work with clipped rects
https://bugs.webkit.org/show_bug.cgi?id=83217

Patch by Dana Jansens <danakj@chromium.org> on 2012-04-09
Reviewed by Adrienne Walker.

Source/WebCore:

Use new CCMathUtil transformation methods to deal with rects that clip
the camera plane. This fixes three things:

1. A layer completely behind the camera is not visible and should not
occlude.
2. A layer that is clipped by the camera is treated like a
non-axis-aligned transform, as the result of a mapClippedRect() is a
bounding box and may contain pixels not in the original rect. This guards
our use of mapRect() when transforming occluded regions.
3. A layer's occlusion must be clipped by its scissor rect. This scissor
rect exists in its target space, so occlusion in screen space is only
possible if its target also is axis aligned in the screen, such that
the layer's scissor rect remains a rect in screen space.

Unit tests: CCOcclusionTrackerTestLayerBehindCameraDoesNotOcclude
            CCOcclusionTrackerTestLargePixelsOccludeInsideClipRect

* platform/graphics/chromium/cc/CCOcclusionTracker.cpp:
(WebCore::transformSurfaceOpaqueRegion):
(WebCore::computeOcclusionBehindLayer):
(WebCore::::markOccludedBehindLayer):
(WebCore::testContentRectOccluded):
(WebCore::computeUnoccludedContentRect):

Source/WebKit/chromium:

* tests/CCOcclusionTrackerTest.cpp:
(CCOcclusionTrackerTestLayerBehindCameraDoesNotOcclude):
(WebKitTests::CCOcclusionTrackerTestLayerBehindCameraDoesNotOcclude::runMyTest):
(WebKitTests):
(CCOcclusionTrackerTestLargePixelsOccludeInsideClipRect):
(WebKitTests::CCOcclusionTrackerTestLargePixelsOccludeInsideClipRect::runMyTest):
* tests/CCQuadCullerTest.cpp:
(WebCore::TestCCOcclusionTrackerImpl::TestCCOcclusionTrackerImpl):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@113561 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebCore/ChangeLog
Source/WebCore/platform/graphics/chromium/cc/CCOcclusionTracker.cpp
Source/WebKit/chromium/ChangeLog
Source/WebKit/chromium/tests/CCOcclusionTrackerTest.cpp
Source/WebKit/chromium/tests/CCQuadCullerTest.cpp