From 3b9c0bd54383c370c1e7d872751539371b1aef54 Mon Sep 17 00:00:00 2001 From: John Reck Date: Tue, 4 Oct 2011 09:12:27 -0700 Subject: Fix ring clip Bug: 5406350 Change-Id: I95507ee163a2cb41cc605efaabf32b7cad814533 --- .../platform/graphics/android/GLWebViewState.cpp | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) (limited to 'Source/WebCore/platform/graphics/android/GLWebViewState.cpp') diff --git a/Source/WebCore/platform/graphics/android/GLWebViewState.cpp b/Source/WebCore/platform/graphics/android/GLWebViewState.cpp index 2f62223..09c647b 100644 --- a/Source/WebCore/platform/graphics/android/GLWebViewState.cpp +++ b/Source/WebCore/platform/graphics/android/GLWebViewState.cpp @@ -278,6 +278,10 @@ void GLWebViewState::drawFocusRing(SkRect& srcRect) RING_COLOR_G, RING_COLOR_B); + if (srcRect.fRight <= srcRect.fLeft || srcRect.fBottom <= srcRect.fTop) { + // Invalid rect, reject it + return; + } TilesManager::instance()->shader()->drawQuad(srcRect, m_focusRingTexture, RING_COLOR_ALPHA); } @@ -285,6 +289,16 @@ void GLWebViewState::drawFocusRing(SkRect& srcRect) void GLWebViewState::paintExtras() { if (m_displayRings && !m_rings.isEmpty()) { + // Update the clip + SkIRect skbounds = m_rings.getBounds(); + if (skbounds.isEmpty()) + return; + FloatRect glclip; + glclip.setX(skbounds.fLeft); + glclip.setY(skbounds.fTop); + glclip.setWidth(skbounds.fRight - skbounds.fLeft); + glclip.setHeight(skbounds.fBottom - skbounds.fTop); + TilesManager::instance()->shader()->clip(glclip); if (m_ringsIsPressed) { SkRegion::Iterator rgnIter(m_rings); while (!rgnIter.done()) { @@ -592,9 +606,6 @@ bool GLWebViewState::drawGL(IntRect& rect, SkRect& viewport, IntRect* invalRect, double currentTime = setupDrawing(rect, viewport, webViewRect, titleBarHeight, clip, scale); bool ret = baseLayer->drawGL(currentTime, compositedRoot, rect, viewport, scale, buffersSwappedPtr); - // Reset the clip to make sure we can draw the rings. If this isn't done, the - // current clip will be the clip of whatever layer was last drawn - TilesManager::instance()->shader()->clip(clip); paintExtras(); glBindBuffer(GL_ARRAY_BUFFER, 0); -- cgit v1.1