diff options
author | Teng-Hui Zhu <ztenghui@google.com> | 2011-02-16 11:26:46 -0800 |
---|---|---|
committer | Teng-Hui Zhu <ztenghui@google.com> | 2011-02-16 14:27:57 -0800 |
commit | 03d850006e8ce54945fe44c36ffaf074143184c5 (patch) | |
tree | 07856002ecf87fbb8bcc4eeb367c0ecd694f5259 /WebCore/platform/graphics | |
parent | 5ad675d34069bcdf6bcd983ae4941c0531216354 (diff) | |
download | external_webkit-03d850006e8ce54945fe44c36ffaf074143184c5.zip external_webkit-03d850006e8ce54945fe44c36ffaf074143184c5.tar.gz external_webkit-03d850006e8ce54945fe44c36ffaf074143184c5.tar.bz2 |
Adding a debug setting to enable visual indicator for GL
[This is the webkit part]
The idea is to turn on the visual indicator without building the code.
The implementation included:
1. Setup the UI on browser side to check whether or not this is enabled.
2. Transfer the info from browser setting to web setting.
3. Send this info down from WebView to webkit.
4. In the webkit, we save this info in TilesManager.
5. At texture generation time, we query this info to decide whether or not
add the visual indicator on the texture.
One design decision we made is we don't want to restart the browser for
debugging purpose. This is better preserving the browser current activity,
the only pitfall is that the visual indicator is NOT updated on different
textures simultaneously.
The dependent webView change is #change,97055
bug:3458721
Change-Id: I0ce51d7ac7de66ccdb95c9bf1f0edc7ec688622f
Diffstat (limited to 'WebCore/platform/graphics')
-rw-r--r-- | WebCore/platform/graphics/android/BaseTile.cpp | 24 | ||||
-rw-r--r-- | WebCore/platform/graphics/android/GLWebViewState.cpp | 5 | ||||
-rw-r--r-- | WebCore/platform/graphics/android/GLWebViewState.h | 2 | ||||
-rw-r--r-- | WebCore/platform/graphics/android/LayerAndroid.cpp | 36 | ||||
-rw-r--r-- | WebCore/platform/graphics/android/TilesManager.cpp | 1 | ||||
-rw-r--r-- | WebCore/platform/graphics/android/TilesManager.h | 10 |
6 files changed, 46 insertions, 32 deletions
diff --git a/WebCore/platform/graphics/android/BaseTile.cpp b/WebCore/platform/graphics/android/BaseTile.cpp index e5275c6..a69e6f9 100644 --- a/WebCore/platform/graphics/android/BaseTile.cpp +++ b/WebCore/platform/graphics/android/BaseTile.cpp @@ -265,18 +265,18 @@ void BaseTile::paintBitmap() canvas->restore(); -#ifdef DEBUG - SkPaint paint; - paint.setARGB(128, 255, 0, 0); - paint.setStrokeWidth(3); - canvas->drawLine(0, 0, tileWidth, tileHeight, paint); - paint.setARGB(128, 0, 255, 0); - canvas->drawLine(0, tileHeight, tileWidth, 0, paint); - paint.setARGB(128, 0, 0, 255); - canvas->drawLine(0, 0, tileWidth, 0, paint); - canvas->drawLine(tileWidth, 0, tileWidth, tileHeight, paint); - drawTileInfo(canvas, texture, x, y, scale); -#endif + if (TilesManager::instance()->getShowVisualIndicator()) { + SkPaint paint; + paint.setARGB(128, 255, 0, 0); + paint.setStrokeWidth(3); + canvas->drawLine(0, 0, tileWidth, tileHeight, paint); + paint.setARGB(128, 0, 255, 0); + canvas->drawLine(0, tileHeight, tileWidth, 0, paint); + paint.setARGB(128, 0, 0, 255); + canvas->drawLine(0, 0, tileWidth, 0, paint); + canvas->drawLine(tileWidth, 0, tileWidth, tileHeight, paint); + drawTileInfo(canvas, texture, x, y, scale); + } texture->setTile(x, y); texture->producerUpdate(textureInfo); diff --git a/WebCore/platform/graphics/android/GLWebViewState.cpp b/WebCore/platform/graphics/android/GLWebViewState.cpp index 53d5c5e..71f3fe5 100644 --- a/WebCore/platform/graphics/android/GLWebViewState.cpp +++ b/WebCore/platform/graphics/android/GLWebViewState.cpp @@ -92,7 +92,8 @@ GLWebViewState::~GLWebViewState() #endif } -void GLWebViewState::setBaseLayer(BaseLayerAndroid* layer, const IntRect& rect) +void GLWebViewState::setBaseLayer(BaseLayerAndroid* layer, const IntRect& rect, + bool showVisualIndicator) { android::Mutex::Autolock lock(m_baseLayerLock); if (!layer) { @@ -113,6 +114,8 @@ void GLWebViewState::setBaseLayer(BaseLayerAndroid* layer, const IntRect& rect) m_currentBaseLayer = layer; } inval(rect); + + TilesManager::instance()->setShowVisualIndicator(showVisualIndicator); } void GLWebViewState::unlockBaseLayerUpdate() { diff --git a/WebCore/platform/graphics/android/GLWebViewState.h b/WebCore/platform/graphics/android/GLWebViewState.h index d28c16a..91bb2d7 100644 --- a/WebCore/platform/graphics/android/GLWebViewState.h +++ b/WebCore/platform/graphics/android/GLWebViewState.h @@ -168,7 +168,7 @@ public: void resetTransitionTime() { m_transitionTime = -1; } unsigned int paintBaseLayerContent(SkCanvas* canvas); - void setBaseLayer(BaseLayerAndroid* layer, const IntRect& rect); + void setBaseLayer(BaseLayerAndroid* layer, const IntRect& rect, bool showVisualIndicator); void setExtra(BaseLayerAndroid*, SkPicture&, const IntRect&, bool allowSame); void scheduleUpdate(const double& currentTime, const SkIRect& viewport, float scale); diff --git a/WebCore/platform/graphics/android/LayerAndroid.cpp b/WebCore/platform/graphics/android/LayerAndroid.cpp index e000ab1..35979f6 100644 --- a/WebCore/platform/graphics/android/LayerAndroid.cpp +++ b/WebCore/platform/graphics/android/LayerAndroid.cpp @@ -992,25 +992,25 @@ void LayerAndroid::contentDraw(SkCanvas* canvas) canvas->drawPicture(*m_extra); m_atomicSync.unlock(); -#ifdef LAYER_DEBUG - float w = getSize().width(); - float h = getSize().height(); - SkPaint paint; - paint.setARGB(128, 255, 0, 0); - canvas->drawLine(0, 0, w, h, paint); - canvas->drawLine(0, h, w, 0, paint); - paint.setARGB(128, 0, 255, 0); - canvas->drawLine(0, 0, 0, h, paint); - canvas->drawLine(0, h, w, h, paint); - canvas->drawLine(w, h, w, 0, paint); - canvas->drawLine(w, 0, 0, 0, paint); - - if (m_isFixed) { - SkPaint paint; - paint.setARGB(80, 255, 0, 0); - canvas->drawRect(m_fixedRect, paint); + if (TilesManager::instance()->getShowVisualIndicator()) { + float w = getSize().width(); + float h = getSize().height(); + SkPaint paint; + paint.setARGB(128, 255, 0, 0); + canvas->drawLine(0, 0, w, h, paint); + canvas->drawLine(0, h, w, 0, paint); + paint.setARGB(128, 0, 255, 0); + canvas->drawLine(0, 0, 0, h, paint); + canvas->drawLine(0, h, w, h, paint); + canvas->drawLine(w, h, w, 0, paint); + canvas->drawLine(w, 0, 0, 0, paint); + + if (m_isFixed) { + SkPaint paint; + paint.setARGB(80, 255, 0, 0); + canvas->drawRect(m_fixedRect, paint); + } } -#endif } void LayerAndroid::onDraw(SkCanvas* canvas, SkScalar opacity) diff --git a/WebCore/platform/graphics/android/TilesManager.cpp b/WebCore/platform/graphics/android/TilesManager.cpp index 0fb3b1b..a15e862 100644 --- a/WebCore/platform/graphics/android/TilesManager.cpp +++ b/WebCore/platform/graphics/android/TilesManager.cpp @@ -88,6 +88,7 @@ TilesManager::TilesManager() , m_maxTextureCount(0) , m_expandedTileBounds(false) , m_generatorReady(false) + , m_showVisualIndicator(false) { XLOG("TilesManager ctor"); m_textures.reserveCapacity(MAX_TEXTURE_ALLOCATION); diff --git a/WebCore/platform/graphics/android/TilesManager.h b/WebCore/platform/graphics/android/TilesManager.h index 29b7fc1..107b121 100644 --- a/WebCore/platform/graphics/android/TilesManager.h +++ b/WebCore/platform/graphics/android/TilesManager.h @@ -108,6 +108,14 @@ public: m_expandedTileBounds = enabled; } + bool getShowVisualIndicator() { + return m_showVisualIndicator; + } + + void setShowVisualIndicator(bool showVisualIndicator) { + m_showVisualIndicator = showVisualIndicator; + } + private: TilesManager(); @@ -129,6 +137,8 @@ private: bool m_generatorReady; + bool m_showVisualIndicator; + sp<TexturesGenerator> m_pixmapsGenerationThread; android::Mutex m_texturesLock; |