summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTeng-Hui Zhu <ztenghui@google.com>2012-04-26 11:28:24 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2012-04-26 11:28:24 -0700
commita9c936c9f57a5307a6f98921a1f12b850391ee0d (patch)
tree95fe76005cde39c57c38825d73e9900c70bb0048
parentb5ce3d2b8190969ba36e8c0635c531e71d92e538 (diff)
parentbfeff6cd168c57722ca96c44f7c5caed26c98177 (diff)
downloadexternal_webkit-a9c936c9f57a5307a6f98921a1f12b850391ee0d.zip
external_webkit-a9c936c9f57a5307a6f98921a1f12b850391ee0d.tar.gz
external_webkit-a9c936c9f57a5307a6f98921a1f12b850391ee0d.tar.bz2
Merge "DO NOT MERGE: Fix clipping issue due to webview animation(scaling)" into jb-dev
-rw-r--r--Source/WebCore/platform/graphics/android/GLWebViewState.cpp18
-rw-r--r--Source/WebCore/platform/graphics/android/GLWebViewState.h2
-rw-r--r--Source/WebCore/platform/graphics/android/rendering/ShaderProgram.cpp20
3 files changed, 13 insertions, 27 deletions
diff --git a/Source/WebCore/platform/graphics/android/GLWebViewState.cpp b/Source/WebCore/platform/graphics/android/GLWebViewState.cpp
index a52a3fe..7a94eb5 100644
--- a/Source/WebCore/platform/graphics/android/GLWebViewState.cpp
+++ b/Source/WebCore/platform/graphics/android/GLWebViewState.cpp
@@ -288,14 +288,14 @@ bool GLWebViewState::setLayersRenderingMode(TexturesResult& nbTexturesNeeded)
}
// -rect(viewRect) is the webViewRect with inverted Y, in screen coordinate.
-// -viewport(visibleRect) is the visible area in document coordinate.
+// -visibleRect is the visible area in document coordinate.
// They are both based on webViewRect and calculated in Java side.
//
// -clip is the final glViewport value in screen coordinate, and it contains the
// animation translation/scale and FBO offset.
//
// TODO: Try to decrease the number of parameters as some info is redundant.
-int GLWebViewState::drawGL(IntRect& rect, SkRect& viewport, IntRect* invalRect,
+int GLWebViewState::drawGL(IntRect& rect, SkRect& visibleRect, IntRect* invalRect,
IntRect& webViewRect, int titleBarHeight,
IntRect& clip, float scale,
bool* collectionsSwappedPtr, bool* newCollectionHasAnimPtr,
@@ -303,14 +303,14 @@ int GLWebViewState::drawGL(IntRect& rect, SkRect& viewport, IntRect* invalRect,
{
TilesManager* tilesManager = TilesManager::instance();
if (shouldDraw)
- tilesManager->getProfiler()->nextFrame(viewport.fLeft, viewport.fTop,
- viewport.fRight, viewport.fBottom,
+ tilesManager->getProfiler()->nextFrame(visibleRect.fLeft, visibleRect.fTop,
+ visibleRect.fRight, visibleRect.fBottom,
scale);
tilesManager->incDrawGLCount();
- ALOGV("drawGL, rect/viewRect(%d, %d, %d, %d), viewport/visibleRect(%.2f, %.2f, %.2f, %.2f)",
+ ALOGV("drawGL, rect/viewRect(%d, %d, %d, %d), visibleRect(%.2f, %.2f, %.2f, %.2f)",
rect.x(), rect.y(), rect.width(), rect.height(),
- viewport.fLeft, viewport.fTop, viewport.fRight, viewport.fBottom);
+ visibleRect.fLeft, visibleRect.fTop, visibleRect.fRight, visibleRect.fBottom);
ALOGV("drawGL, invalRect(%d, %d, %d, %d), webViewRect(%d, %d, %d, %d)"
"clip/glViewport (%d, %d, %d, %d), scale %f titleBarHeight %d",
@@ -340,12 +340,12 @@ int GLWebViewState::drawGL(IntRect& rect, SkRect& viewport, IntRect* invalRect,
// gather the textures we can use
tilesManager->gatherTextures();
- double currentTime = setupDrawing(rect, viewport, webViewRect, titleBarHeight, clip, scale);
+ double currentTime = setupDrawing(rect, visibleRect, webViewRect, titleBarHeight, clip, scale);
TexturesResult nbTexturesNeeded;
bool fastSwap = isScrolling() || m_layersRenderingMode == kSingleSurfaceRendering;
- m_glExtras.setViewport(viewport);
- returnFlags |= m_surfaceCollectionManager.drawGL(currentTime, rect, viewport,
+ m_glExtras.setViewport(visibleRect);
+ returnFlags |= m_surfaceCollectionManager.drawGL(currentTime, rect, visibleRect,
scale, fastSwap,
collectionsSwappedPtr, newCollectionHasAnimPtr,
&nbTexturesNeeded, shouldDraw);
diff --git a/Source/WebCore/platform/graphics/android/GLWebViewState.h b/Source/WebCore/platform/graphics/android/GLWebViewState.h
index 2b28619..8d0f214 100644
--- a/Source/WebCore/platform/graphics/android/GLWebViewState.h
+++ b/Source/WebCore/platform/graphics/android/GLWebViewState.h
@@ -177,7 +177,7 @@ public:
bool setLayersRenderingMode(TexturesResult&);
- int drawGL(IntRect& rect, SkRect& viewport, IntRect* invalRect,
+ int drawGL(IntRect& rect, SkRect& visibleRect, IntRect* invalRect,
IntRect& webViewRect, int titleBarHeight,
IntRect& clip, float scale,
bool* collectionsSwappedPtr, bool* newCollectionHasAnimPtr,
diff --git a/Source/WebCore/platform/graphics/android/rendering/ShaderProgram.cpp b/Source/WebCore/platform/graphics/android/rendering/ShaderProgram.cpp
index 817efb8..bea418a 100644
--- a/Source/WebCore/platform/graphics/android/rendering/ShaderProgram.cpp
+++ b/Source/WebCore/platform/graphics/android/rendering/ShaderProgram.cpp
@@ -376,23 +376,9 @@ void ShaderProgram::setupDrawing(const IntRect& viewRect, const SkRect& visibleR
m_titleBarHeight = titleBarHeight;
//// viewport ////
- TransformationMatrix ortho;
- GLUtils::setOrthographicMatrix(ortho, visibleRect.fLeft, visibleRect.fTop,
- visibleRect.fRight, visibleRect.fBottom, -1000, 1000);
- // In most case , visibleRect / viewRect * scale should 1.0, but for the
- // translation case, the scale factor can be 1 but visibleRect is smaller
- // than viewRect, we need to tune in this factor to make sure we scale them
- // right. Conceptually, that means, no matter how animation affects the
- // visibleRect, the scaling should respect the viewRect if zoomScale is 1.0.
- // Note that at TiledPage, we already scale the tile size inversely to make
- // zooming animation right.
- float orthoScaleX = scale * visibleRect.width() / viewRect.width();
- float orthoScaleY = scale * visibleRect.height() / viewRect.height();
-
- TransformationMatrix orthoScale;
- orthoScale.scale3d(orthoScaleX, orthoScaleY, 1.0);
-
- m_visibleRectProjectionMatrix = ortho * orthoScale;
+ GLUtils::setOrthographicMatrix(m_visibleRectProjectionMatrix, visibleRect.fLeft,
+ visibleRect.fTop, visibleRect.fRight, visibleRect.fBottom,
+ -1000, 1000);
ALOGV("set m_clipProjectionMatrix, %d, %d, %d, %d",
screenClip.x(), screenClip.y(), screenClip.x() + screenClip.width(),