summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorTeng-Hui Zhu <ztenghui@google.com>2012-03-02 15:47:25 -0800
committerTeng-Hui Zhu <ztenghui@google.com>2012-03-05 10:10:33 -0800
commit2bd6000a1d89d3680bfbbc2c10cd9766c113d644 (patch)
tree58692778571a609eef0eacd1a4d49a29fa65f6d9 /Source
parent3e2930d97c8473fa6152c97822241c223536b336 (diff)
downloadexternal_webkit-2bd6000a1d89d3680bfbbc2c10cd9766c113d644.zip
external_webkit-2bd6000a1d89d3680bfbbc2c10cd9766c113d644.tar.gz
external_webkit-2bd6000a1d89d3680bfbbc2c10cd9766c113d644.tar.bz2
Fix scaling issue with translation
bug:5684832 Change-Id: I57fd4cddd480f6d8d5e3bebdf9a63bcab59e02c5
Diffstat (limited to 'Source')
-rw-r--r--Source/WebCore/platform/graphics/android/ShaderProgram.cpp15
1 files changed, 14 insertions, 1 deletions
diff --git a/Source/WebCore/platform/graphics/android/ShaderProgram.cpp b/Source/WebCore/platform/graphics/android/ShaderProgram.cpp
index b09701b..74a74e1 100644
--- a/Source/WebCore/platform/graphics/android/ShaderProgram.cpp
+++ b/Source/WebCore/platform/graphics/android/ShaderProgram.cpp
@@ -385,7 +385,20 @@ void ShaderProgram::setupDrawing(const IntRect& viewRect, const SkRect& visibleR
TransformationMatrix ortho;
GLUtils::setOrthographicMatrix(ortho, visibleRect.fLeft, visibleRect.fTop,
visibleRect.fRight, visibleRect.fBottom, -1000, 1000);
- m_projectionMatrix = ortho;
+ // 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_projectionMatrix = ortho * orthoScale;
m_viewport = visibleRect;
m_currentScale = scale;