[Texmap] Leaves demo: wrong geometry when opacity animation kicks in
authornoam.rosenthal@nokia.com <noam.rosenthal@nokia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 29 Apr 2012 15:20:12 +0000 (15:20 +0000)
committernoam.rosenthal@nokia.com <noam.rosenthal@nokia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 29 Apr 2012 15:20:12 +0000 (15:20 +0000)
https://bugs.webkit.org/show_bug.cgi?id=85096

Reviewed by Kenneth Rohde Christiansen.

We should use combined() instead of combinedForChildren() since we don't allow
intermediate surfaces for preserves-3d. Also, we should apply the offset before
multiplying the transforms, otherwise the transform-origin is incorrect.

Covered by existing compositing tests.

* platform/graphics/texmap/TextureMapperLayer.cpp:
(WebCore::TextureMapperLayer::paintSelf):
(WebCore::TextureMapperLayer::paintRecursive):

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

Source/WebCore/ChangeLog
Source/WebCore/platform/graphics/texmap/TextureMapperLayer.cpp

index fe973f7..aca9958 100644 (file)
@@ -1,3 +1,20 @@
+2012-04-29  No'am Rosenthal  <noam.rosenthal@nokia.com>
+
+        [Texmap] Leaves demo: wrong geometry when opacity animation kicks in
+        https://bugs.webkit.org/show_bug.cgi?id=85096
+
+        Reviewed by Kenneth Rohde Christiansen.
+
+        We should use combined() instead of combinedForChildren() since we don't allow
+        intermediate surfaces for preserves-3d. Also, we should apply the offset before
+        multiplying the transforms, otherwise the transform-origin is incorrect.
+
+        Covered by existing compositing tests.
+
+        * platform/graphics/texmap/TextureMapperLayer.cpp:
+        (WebCore::TextureMapperLayer::paintSelf):
+        (WebCore::TextureMapperLayer::paintRecursive):
+
 2012-04-29  Mark Pilgrim  <pilgrim@chromium.org>
 
         [Chromium] Call highUsageDeltaMB directly
index 9ac33dd..40b2915 100644 (file)
@@ -147,10 +147,10 @@ void TextureMapperLayer::paint()
 void TextureMapperLayer::paintSelf(const TextureMapperPaintOptions& options)
 {
     // We apply the following transform to compensate for painting into a surface, and then apply the offset so that the painting fits in the target rect.
-    TransformationMatrix transform =
-            TransformationMatrix(options.transform)
-            .multiply(m_transform.combined())
-            .translate(options.offset.width(), options.offset.height());
+    TransformationMatrix transform;
+    transform.translate(options.offset.width(), options.offset.height());
+    transform.multiply(options.transform);
+    transform.multiply(m_transform.combined());
 
     float opacity = options.opacity;
     RefPtr<BitmapTexture> mask = options.mask;
@@ -319,8 +319,7 @@ void TextureMapperLayer::paintRecursive(const TextureMapperPaintOptions& options
     options.textureMapper->bindSurface(surface.get());
     paintOptions.opacity = 1;
 
-    // We have to use combinedForChildren() and not combined(), otherwise preserve-3D doesn't work.
-    paintOptions.transform = m_transform.combinedForChildren().inverse();
+    paintOptions.transform = m_transform.combined().inverse();
     paintOptions.offset = -IntSize(surfaceRect.x(), surfaceRect.y());
 
     paintSelfAndChildrenWithReplica(paintOptions);
@@ -334,10 +333,11 @@ void TextureMapperLayer::paintRecursive(const TextureMapperPaintOptions& options
 #endif
 
     options.textureMapper->bindSurface(options.surface.get());
-    TransformationMatrix targetTransform =
-            TransformationMatrix(options.transform)
-                .multiply(m_transform.combined())
-                .translate(options.offset.width(), options.offset.height());
+    TransformationMatrix targetTransform;
+    targetTransform.translate(options.offset.width(), options.offset.height());
+    targetTransform.multiply(options.transform);
+    targetTransform.multiply(m_transform.combined());
+
     options.textureMapper->drawTexture(*surface.get(), surfaceRect, targetTransform, opacity, maskTexture.get());
 }