diff options
author | John Reck <jreck@google.com> | 2011-10-04 09:12:27 -0700 |
---|---|---|
committer | John Reck <jreck@google.com> | 2011-10-04 10:29:44 -0700 |
commit | 3b9c0bd54383c370c1e7d872751539371b1aef54 (patch) | |
tree | 37a8adc2e02827e425373114016cb3f61553d4ff /Source | |
parent | 834546469c79df0516956f90f5e0a9100ba1fcd5 (diff) | |
download | external_webkit-3b9c0bd54383c370c1e7d872751539371b1aef54.zip external_webkit-3b9c0bd54383c370c1e7d872751539371b1aef54.tar.gz external_webkit-3b9c0bd54383c370c1e7d872751539371b1aef54.tar.bz2 |
Fix ring clip
Bug: 5406350
Change-Id: I95507ee163a2cb41cc605efaabf32b7cad814533
Diffstat (limited to 'Source')
-rw-r--r-- | Source/WebCore/platform/graphics/android/GLWebViewState.cpp | 17 |
1 files changed, 14 insertions, 3 deletions
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); |