From 9ee6387729386f61e28b3030037dd42636db82ec Mon Sep 17 00:00:00 2001 From: "commit-queue@webkit.org" Date: Sat, 21 Jan 2012 02:21:02 +0000 Subject: [PATCH] [chromium] Partially filled pixels do not occlude pixels below them. https://bugs.webkit.org/show_bug.cgi?id=76658 Patch by Dana Jansens on 2012-01-20 Reviewed by James Robinson. Source/WebCore: Test: compositing/culling/tile-occlusion-boundaries.html * platform/graphics/chromium/cc/CCQuadCuller.cpp: (WebCore::enclosedIntRect): (WebCore::CCQuadCuller::cullOccludedQuads): LayoutTests: * compositing/culling/tile-occlusion-boundaries-expected.png: Added. * compositing/culling/tile-occlusion-boundaries-expected.txt: Added. * compositing/culling/tile-occlusion-boundaries.html: Added. * compositing/resources/green.jpg: Added. git-svn-id: http://svn.webkit.org/repository/webkit/trunk@105561 268f45cc-cd09-0410-ab3c-d52691b4dbfc --- LayoutTests/ChangeLog | 12 ++++++++ .../culling/tile-occlusion-boundaries-expected.png | Bin 0 -> 2861 bytes .../culling/tile-occlusion-boundaries-expected.txt | 1 + .../culling/tile-occlusion-boundaries.html | 31 +++++++++++++++++++++ Source/WebCore/ChangeLog | 13 +++++++++ .../platform/graphics/chromium/cc/CCQuadCuller.cpp | 20 +++++++++++-- 6 files changed, 75 insertions(+), 2 deletions(-) create mode 100644 LayoutTests/compositing/culling/tile-occlusion-boundaries-expected.png create mode 100644 LayoutTests/compositing/culling/tile-occlusion-boundaries-expected.txt create mode 100644 LayoutTests/compositing/culling/tile-occlusion-boundaries.html diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog index d7b7957..a0ade6f 100644 --- a/LayoutTests/ChangeLog +++ b/LayoutTests/ChangeLog @@ -1,3 +1,15 @@ +2012-01-20 Dana Jansens + + [chromium] Partially filled pixels do not occlude pixels below them. + https://bugs.webkit.org/show_bug.cgi?id=76658 + + Reviewed by James Robinson. + + * compositing/culling/tile-occlusion-boundaries-expected.png: Added. + * compositing/culling/tile-occlusion-boundaries-expected.txt: Added. + * compositing/culling/tile-occlusion-boundaries.html: Added. + * compositing/resources/green.jpg: Added. + 2012-01-20 Adam Barth Add a Chromium-specific baselines for diff --git a/LayoutTests/compositing/culling/tile-occlusion-boundaries-expected.png b/LayoutTests/compositing/culling/tile-occlusion-boundaries-expected.png new file mode 100644 index 0000000000000000000000000000000000000000..052b46dcff4643af0754940e472ea9087ba1c41d GIT binary patch literal 2861 zcmeAS@N?(olHy`uVBq!ia0y~yU{+vYV2a>i0*Z)=h^hlA%@Ws$lH`ok + + + + + + + + + + + diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog index 0f43619..e3d862a 100644 --- a/Source/WebCore/ChangeLog +++ b/Source/WebCore/ChangeLog @@ -1,3 +1,16 @@ +2012-01-20 Dana Jansens + + [chromium] Partially filled pixels do not occlude pixels below them. + https://bugs.webkit.org/show_bug.cgi?id=76658 + + Reviewed by James Robinson. + + Test: compositing/culling/tile-occlusion-boundaries.html + + * platform/graphics/chromium/cc/CCQuadCuller.cpp: + (WebCore::enclosedIntRect): + (WebCore::CCQuadCuller::cullOccludedQuads): + 2012-01-20 Ami Fischman Small cleanup of {get,put}CurrentFrame for WebMediaPlayerClientImpl/CCVideoLayerImpl. diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCQuadCuller.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCQuadCuller.cpp index 079aa7f..d30ffc8 100644 --- a/Source/WebCore/platform/graphics/chromium/cc/CCQuadCuller.cpp +++ b/Source/WebCore/platform/graphics/chromium/cc/CCQuadCuller.cpp @@ -35,6 +35,8 @@ #include "cc/CCRenderPass.h" #include "cc/CCRenderSurfaceDrawQuad.h" +using namespace std; + namespace std { // Specialize for OwnPtr since Vector doesn't know how to reverse a Vector of OwnPtr in general. @@ -60,6 +62,18 @@ static bool regionContainsRect(const Region& region, const IntRect& rect) return rectRegion.isEmpty(); } +static IntRect enclosedIntRect(const FloatRect& rect) +{ + float x = ceilf(rect.x()); + float y = ceilf(rect.y()); + // A rect of width 0 should not become a rect of width -1. + float width = max(floorf(rect.maxX()) - x, 0); + float height = max(floorf(rect.maxY()) - y, 0); + + return IntRect(clampToInteger(x), clampToInteger(y), + clampToInteger(width), clampToInteger(height)); +} + void CCQuadCuller::cullOccludedQuads(CCQuadList& quadList) { if (!quadList.size()) @@ -77,8 +91,10 @@ void CCQuadCuller::cullOccludedQuads(CCQuadList& quadList) bool keepQuad = !regionContainsRect(opaqueCoverageThusFar, quadRect); - if (keepQuad && drawQuad->drawsOpaque() && drawQuad->isLayerAxisAlignedIntRect()) - opaqueCoverageThusFar.unite(Region(quadRect)); + if (keepQuad && drawQuad->drawsOpaque() && drawQuad->isLayerAxisAlignedIntRect()) { + IntRect opaqueRect = enclosedIntRect(drawQuad->quadTransform().mapRect(FloatRect(drawQuad->quadRect()))); + opaqueCoverageThusFar.unite(opaqueRect); + } if (keepQuad) culledList.append(quadList[i].release()); -- 2.7.4