From eabb311cd2b57ff80b4cf632078cf078d789b563 Mon Sep 17 00:00:00 2001 From: Cary Clark Date: Fri, 19 Nov 2010 14:23:02 -0500 Subject: reenable draw extras when GL is turned on This captures the drawing in the UI thread, then passes the drawing to the tile imaging thread. The draw extras interface now takes an additional rectangle, and each draw extra fills in the inval area formed as that part is drawn. The old extra implementation in GLWebViewState has been removed. The inval portion of the setBaseLayer call has been split out so it can be called directly. bug:3161294 Change-Id: I28d3e6879059770b973e7c0f7c0796909f7359aa --- .../platform/graphics/android/GLWebViewState.cpp | 48 ++++++++-------------- 1 file changed, 18 insertions(+), 30 deletions(-) (limited to 'WebCore/platform/graphics/android/GLWebViewState.cpp') diff --git a/WebCore/platform/graphics/android/GLWebViewState.cpp b/WebCore/platform/graphics/android/GLWebViewState.cpp index d0d054f..145bd89 100644 --- a/WebCore/platform/graphics/android/GLWebViewState.cpp +++ b/WebCore/platform/graphics/android/GLWebViewState.cpp @@ -72,8 +72,6 @@ GLWebViewState::GLWebViewState() , m_baseLayer(0) , m_currentPictureCounter(0) , m_usePageA(true) - , m_extra(0) - , m_navLayer(0) { m_viewport.setEmpty(); m_viewportTileBounds.setEmpty(); @@ -90,58 +88,48 @@ GLWebViewState::~GLWebViewState() { delete m_tiledPageA; delete m_tiledPageB; - delete m_navLayer; #ifdef DEBUG_COUNT gGLWebViewStateCount--; #endif } -void GLWebViewState::setBaseLayer(BaseLayerAndroid* layer, IntRect& rect) +void GLWebViewState::setBaseLayer(BaseLayerAndroid* layer, const IntRect& rect) { android::Mutex::Autolock lock(m_baseLayerLock); m_baseLayer = layer; - m_extra = 0; - delete m_navLayer; - m_navLayer = 0; if (m_baseLayer) { m_baseLayer->setGLWebViewState(this); - m_currentPictureCounter++; - - if (!rect.isEmpty()) { - // find which tiles fall within the invalRect and mark them as dirty - m_tiledPageA->invalidateRect(rect, m_currentPictureCounter); - m_tiledPageB->invalidateRect(rect, m_currentPictureCounter); - } + inval(rect); } } -void GLWebViewState::setExtra(android::DrawExtra* extra, LayerAndroid* navLayer) +void GLWebViewState::setExtra(BaseLayerAndroid* layer, SkPicture& picture, + const IntRect& rect) { android::Mutex::Autolock lock(m_baseLayerLock); - m_extra = extra; - delete m_navLayer; - m_navLayer = navLayer; - m_currentPictureCounter++; + layer->setExtra(picture); + if (!rect.isEmpty()) + inval(rect); + else if (!m_lastInval.isEmpty()) + inval(m_lastInval); + m_lastInval = rect; } -void GLWebViewState::resetExtra(bool repaint) +void GLWebViewState::inval(const IntRect& rect) { - android::Mutex::Autolock lock(m_baseLayerLock); - if (m_extra && repaint) - m_currentPictureCounter++; - m_extra = 0; - delete m_navLayer; - m_navLayer = 0; + m_currentPictureCounter++; + if (!rect.isEmpty()) { + // find which tiles fall within the invalRect and mark them as dirty + m_tiledPageA->invalidateRect(rect, m_currentPictureCounter); + m_tiledPageB->invalidateRect(rect, m_currentPictureCounter); + } } unsigned int GLWebViewState::paintBaseLayerContent(SkCanvas* canvas) { android::Mutex::Autolock lock(m_baseLayerLock); - if (m_baseLayer) { + if (m_baseLayer) m_baseLayer->drawCanvas(canvas); - if (m_extra && m_navLayer) - m_extra->draw(canvas, m_navLayer); - } return m_currentPictureCounter; } -- cgit v1.1