Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[Qt] Use QQuickFlickable::setPixelAligned instead of doing pixel-alig…
…nment when rendering.

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):

Canonical link: https://commits.webkit.org/101400@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@114118 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
jturcotte committed Apr 13, 2012
1 parent 6541073 commit 7f3a8d0
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 19 deletions.
14 changes: 14 additions & 0 deletions Source/WebCore/ChangeLog
@@ -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.
Expand Down
18 changes: 1 addition & 17 deletions Source/WebCore/platform/graphics/texmap/TextureMapperGL.cpp
Expand Up @@ -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,
Expand Down
16 changes: 16 additions & 0 deletions Source/WebKit2/ChangeLog
@@ -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
Expand Down
4 changes: 2 additions & 2 deletions Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp
Expand Up @@ -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));
Expand Down Expand Up @@ -1062,7 +1063,6 @@ QQuickWebView::QQuickWebView(WKContextRef contextRef, WKPageGroupRef pageGroupRe
{
Q_D(QQuickWebView);
d->initialize(contextRef, pageGroupRef);
setClip(true);
}

QQuickWebView::~QQuickWebView()
Expand Down

0 comments on commit 7f3a8d0

Please sign in to comment.