summaryrefslogtreecommitdiffstats
path: root/Source/WebCore
diff options
context:
space:
mode:
authorTeng-Hui Zhu <ztenghui@google.com>2011-12-05 15:39:53 -0800
committerTeng-Hui Zhu <ztenghui@google.com>2011-12-05 15:45:04 -0800
commit54c2428086bd58e55febb7419393d981b14f386a (patch)
tree9881d15f45ae1253f5c91ecdc3586b80f9b3d8cd /Source/WebCore
parentb3266cb41eee1fc7da88e5e091bab29ae25685e7 (diff)
downloadexternal_webkit-54c2428086bd58e55febb7419393d981b14f386a.zip
external_webkit-54c2428086bd58e55febb7419393d981b14f386a.tar.gz
external_webkit-54c2428086bd58e55febb7419393d981b14f386a.tar.bz2
Add visual indicator for tree swap info
Change-Id: Iab03d2086775f037ae2d4c2200f7b220380eb206
Diffstat (limited to 'Source/WebCore')
-rw-r--r--Source/WebCore/platform/graphics/android/GLWebViewState.cpp40
-rw-r--r--Source/WebCore/platform/graphics/android/GLWebViewState.h4
2 files changed, 36 insertions, 8 deletions
diff --git a/Source/WebCore/platform/graphics/android/GLWebViewState.cpp b/Source/WebCore/platform/graphics/android/GLWebViewState.cpp
index 0db9a46..f2c3b2b 100644
--- a/Source/WebCore/platform/graphics/android/GLWebViewState.cpp
+++ b/Source/WebCore/platform/graphics/android/GLWebViewState.cpp
@@ -74,6 +74,8 @@
#define FPS_INDICATOR_HEIGHT 10
#define MAX_FPS_VALUE 60
+#define TREE_SWAPPED_COUNTER_MODULE 10
+
namespace WebCore {
using namespace android;
@@ -573,7 +575,7 @@ bool GLWebViewState::drawGL(IntRect& rect, SkRect& viewport, IntRect* invalRect,
resetFrameworkInval();
}
- showFrameInfo(rect);
+ showFrameInfo(rect, *treesSwappedPtr);
#ifdef DEBUG
TilesManager::instance()->getTilesTracker()->showTrackTextures();
@@ -583,7 +585,7 @@ bool GLWebViewState::drawGL(IntRect& rect, SkRect& viewport, IntRect* invalRect,
return ret;
}
-void GLWebViewState::showFrameInfo(const IntRect& rect)
+void GLWebViewState::showFrameInfo(const IntRect& rect, bool treesSwapped)
{
bool showVisualIndicator = TilesManager::instance()->getShowVisualIndicator();
@@ -606,12 +608,36 @@ void GLWebViewState::showFrameInfo(const IntRect& rect)
}
#endif
- IntRect fpsIndicatorRect = rect;
- fpsIndicatorRect.setHeight(FPS_INDICATOR_HEIGHT);
+ IntRect frameInfoRect = rect;
+ frameInfoRect.setHeight(FPS_INDICATOR_HEIGHT);
double ratio = (1.0 / delta) / MAX_FPS_VALUE;
- glScissor(fpsIndicatorRect.x(), fpsIndicatorRect.y(),
- fpsIndicatorRect.width() * ratio, fpsIndicatorRect.height());
- glClearColor(1, 0, 0, 1);
+
+ clearRectWithColor(frameInfoRect, 1, 1, 1, 1);
+ frameInfoRect.setWidth(frameInfoRect.width() * ratio);
+ clearRectWithColor(frameInfoRect, 1, 0, 0, 1);
+
+ // Draw the tree swap counter as a circling progress bar.
+ // This will basically show how fast we are updating the tree.
+ static int swappedCounter = 0;
+ if (treesSwapped)
+ swappedCounter = (swappedCounter + 1) % TREE_SWAPPED_COUNTER_MODULE;
+
+ frameInfoRect = rect;
+ frameInfoRect.setHeight(FPS_INDICATOR_HEIGHT);
+ frameInfoRect.move(0, FPS_INDICATOR_HEIGHT);
+
+ clearRectWithColor(frameInfoRect, 1, 1, 1, 1);
+ ratio = (swappedCounter + 1.0) / TREE_SWAPPED_COUNTER_MODULE;
+
+ frameInfoRect.setWidth(frameInfoRect.width() * ratio);
+ clearRectWithColor(frameInfoRect, 0, 1, 0, 1);
+}
+
+void GLWebViewState::clearRectWithColor(const IntRect& rect, float r, float g,
+ float b, float a)
+{
+ glScissor(rect.x(), rect.y(), rect.width(), rect.height());
+ glClearColor(r, g, b, a);
glClear(GL_COLOR_BUFFER_BIT);
}
diff --git a/Source/WebCore/platform/graphics/android/GLWebViewState.h b/Source/WebCore/platform/graphics/android/GLWebViewState.h
index cb83562..b4c6dff 100644
--- a/Source/WebCore/platform/graphics/android/GLWebViewState.h
+++ b/Source/WebCore/platform/graphics/android/GLWebViewState.h
@@ -254,7 +254,9 @@ public:
private:
void inval(const IntRect& rect);
- void showFrameInfo(const IntRect& rect);
+ void showFrameInfo(const IntRect& rect, bool treesSwapped);
+ void clearRectWithColor(const IntRect& rect, float r, float g,
+ float b, float a);
double m_prevDrawTime;
ZoomManager m_zoomManager;