[Qt] Use QQuickFlickable::setPixelAligned instead of doing pixel-alignment when rende...
authorjocelyn.turcotte@nokia.com <jocelyn.turcotte@nokia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 13 Apr 2012 12:56:08 +0000 (12:56 +0000)
committerjocelyn.turcotte@nokia.com <jocelyn.turcotte@nokia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 13 Apr 2012 12:56:08 +0000 (12:56 +0000)
https://bugs.webkit.org/show_bug.cgi?id=83770

Reviewed by Kenneth Rohde Christiansen.

Source/WebCore:

Revert the previous way of dealing with things. The problem is that different layers
would end up rounding in different directions, and would cause jittering between
layers or with the QQuickWebPage's background.

* platform/graphics/texmap/TextureMapperGL.cpp:
(WebCore::TextureMapperGL::drawTexture):

Source/WebKit2:

- Do the alignment on the highest level as possible: the QQuickFlickable content item
  position. It already supports this with setPixelAligned which rounds the content item's position.
- Also move the setClip(true) to the common constructor as this constructor is currently only used by WTR.
- Remove setFlags(QQuickItem::ItemClipsChildrenToShape) as it is redundant with setClip(true).

* UIProcess/API/qt/qquickwebview.cpp:
(QQuickWebViewPrivate::QQuickWebViewPrivate):
(QQuickWebView::QQuickWebView):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@114118 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/platform/graphics/texmap/TextureMapperGL.cpp
Source/WebKit2/ChangeLog
Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp

index ba974f2..2dff950 100644 (file)
@@ -1,3 +1,17 @@
+2012-04-12  Jocelyn Turcotte  <jocelyn.turcotte@nokia.com>
+
+        [Qt] Use QQuickFlickable::setPixelAligned instead of doing pixel-alignment when rendering.
+        https://bugs.webkit.org/show_bug.cgi?id=83770
+
+        Reviewed by Kenneth Rohde Christiansen.
+
+        Revert the previous way of dealing with things. The problem is that different layers
+        would end up rounding in different directions, and would cause jittering between
+        layers or with the QQuickWebPage's background.
+
+        * platform/graphics/texmap/TextureMapperGL.cpp:
+        (WebCore::TextureMapperGL::drawTexture):
+
 2012-04-13  Pavel Feldman  <pfeldman@chromium.org>
 
         Web Inspector: introduce ParsedURL type, clean up url and displayName mess in Resource and NetworkRequest.
index 323a923..894ebbf 100644 (file)
@@ -326,23 +326,7 @@ void TextureMapperGL::drawTexture(uint32_t texture, Flags flags, const IntSize&
     const GLfloat unitRect[] = {0, 0, 1, 0, 1, 1, 0, 1};
     GL_CMD(glVertexAttribPointer(shaderInfo->vertexAttrib(), 2, GL_FLOAT, GL_FALSE, 0, unitRect));
 
-    TransformationMatrix adjustedModelViewMatrix(modelViewMatrix);
-    // Check if the transformed target rect has the same shape/dimensions as the drawn texture (i.e. translated only).
-    FloatQuad finalQuad = modelViewMatrix.mapQuad(FloatQuad(targetRect));
-    FloatSize finalSize = finalQuad.p3() - finalQuad.p1();
-    if (abs(textureSize.width() - finalSize.width()) < 0.001
-        && abs(textureSize.height() - finalSize.height()) < 0.001
-        && finalQuad.p2().y() == finalQuad.p1().y()
-        && finalQuad.p2().x() == finalQuad.p3().x()
-        && finalQuad.p4().x() == finalQuad.p1().x()
-        && finalQuad.p4().y() == finalQuad.p3().y()) {
-        // Pixel-align the origin of our layer's coordinate system within the frame buffer's
-        // coordinate system to avoid sub-pixel interpolation.
-        adjustedModelViewMatrix.setM41(floor(adjustedModelViewMatrix.m41() + 0.5));
-        adjustedModelViewMatrix.setM42(floor(adjustedModelViewMatrix.m42() + 0.5));
-    }
-
-    TransformationMatrix matrix = TransformationMatrix(data().projectionMatrix).multiply(adjustedModelViewMatrix).multiply(TransformationMatrix(
+    TransformationMatrix matrix = TransformationMatrix(data().projectionMatrix).multiply(modelViewMatrix).multiply(TransformationMatrix(
             targetRect.width(), 0, 0, 0,
             0, targetRect.height(), 0, 0,
             0, 0, 1, 0,
index e1a532a..16d8586 100644 (file)
@@ -1,3 +1,19 @@
+2012-04-12  Jocelyn Turcotte  <jocelyn.turcotte@nokia.com>
+
+        [Qt] Use QQuickFlickable::setPixelAligned instead of doing pixel-alignment when rendering.
+        https://bugs.webkit.org/show_bug.cgi?id=83770
+
+        Reviewed by Kenneth Rohde Christiansen.
+
+        - Do the alignment on the highest level as possible: the QQuickFlickable content item
+          position. It already supports this with setPixelAligned which rounds the content item's position.
+        - Also move the setClip(true) to the common constructor as this constructor is currently only used by WTR.
+        - Remove setFlags(QQuickItem::ItemClipsChildrenToShape) as it is redundant with setClip(true).
+
+        * UIProcess/API/qt/qquickwebview.cpp:
+        (QQuickWebViewPrivate::QQuickWebViewPrivate):
+        (QQuickWebView::QQuickWebView):
+
 2012-04-12  Alexey Proskuryakov  <ap@apple.com>
 
         Preprocessing text files with modern clang treats double slashes in comments
index 01f8da4..6f919a9 100644 (file)
@@ -82,7 +82,8 @@ QQuickWebViewPrivate::QQuickWebViewPrivate(QQuickWebView* viewport)
     , m_loadStartedSignalSent(false)
     , m_dialogActive(false)
 {
-    viewport->setFlags(QQuickItem::ItemClipsChildrenToShape);
+    viewport->setClip(true);
+    viewport->setPixelAligned(true);
     QObject::connect(viewport, SIGNAL(visibleChanged()), viewport, SLOT(_q_onVisibleChanged()));
     QObject::connect(viewport, SIGNAL(urlChanged()), viewport, SLOT(_q_onUrlChanged()));
     pageView.reset(new QQuickWebPage(viewport));
@@ -1062,7 +1063,6 @@ QQuickWebView::QQuickWebView(WKContextRef contextRef, WKPageGroupRef pageGroupRe
 {
     Q_D(QQuickWebView);
     d->initialize(contextRef, pageGroupRef);
-    setClip(true);
 }
 
 QQuickWebView::~QQuickWebView()