Title: [125834] trunk/Source/WebCore
Revision
125834
Author
[email protected]
Date
2012-08-16 17:49:06 -0700 (Thu, 16 Aug 2012)

Log Message

[Texmap] Render gif animation well.
https://bugs.webkit.org/show_bug.cgi?id=93458

Patch by Huang Dongsung <[email protected]> on 2012-08-16
Reviewed by Noam Rosenthal.

GraphicsLayerTextureMapper::setContentsToImage() checks the pointer to the
image, not nativeImagePtr, so Texmap currently draws only the first frame of gif
animations. This patch makes Texmap draw gif animations.

No new tests, could not write a test due to DRT limitation, see Bug 93458.

* platform/graphics/texmap/GraphicsLayerTextureMapper.cpp:
(WebCore::GraphicsLayerTextureMapper::setContentsNeedsDisplay):
(WebCore::GraphicsLayerTextureMapper::setContentsToImage):
* platform/graphics/texmap/GraphicsLayerTextureMapper.h:
(GraphicsLayerTextureMapper):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (125833 => 125834)


--- trunk/Source/WebCore/ChangeLog	2012-08-17 00:47:25 UTC (rev 125833)
+++ trunk/Source/WebCore/ChangeLog	2012-08-17 00:49:06 UTC (rev 125834)
@@ -1,3 +1,22 @@
+2012-08-16  Huang Dongsung  <[email protected]>
+
+        [Texmap] Render gif animation well.
+        https://bugs.webkit.org/show_bug.cgi?id=93458
+
+        Reviewed by Noam Rosenthal.
+
+        GraphicsLayerTextureMapper::setContentsToImage() checks the pointer to the
+        image, not nativeImagePtr, so Texmap currently draws only the first frame of gif
+        animations. This patch makes Texmap draw gif animations.
+
+        No new tests, could not write a test due to DRT limitation, see Bug 93458.
+
+        * platform/graphics/texmap/GraphicsLayerTextureMapper.cpp:
+        (WebCore::GraphicsLayerTextureMapper::setContentsNeedsDisplay):
+        (WebCore::GraphicsLayerTextureMapper::setContentsToImage):
+        * platform/graphics/texmap/GraphicsLayerTextureMapper.h:
+        (GraphicsLayerTextureMapper):
+
 2012-08-16  Kenneth Russell  <[email protected]>
 
         Unreviewed, rolling out r125804.

Modified: trunk/Source/WebCore/platform/graphics/texmap/GraphicsLayerTextureMapper.cpp (125833 => 125834)


--- trunk/Source/WebCore/platform/graphics/texmap/GraphicsLayerTextureMapper.cpp	2012-08-17 00:47:25 UTC (rev 125833)
+++ trunk/Source/WebCore/platform/graphics/texmap/GraphicsLayerTextureMapper.cpp	2012-08-17 00:49:06 UTC (rev 125834)
@@ -84,8 +84,6 @@
 */
 void GraphicsLayerTextureMapper::setContentsNeedsDisplay()
 {
-    if (m_image)
-        setContentsToImage(m_image.get());
     notifyChange(TextureMapperLayer::DisplayChange);
 }
 
@@ -325,14 +323,21 @@
 */
 void GraphicsLayerTextureMapper::setContentsToImage(Image* image)
 {
-    if (image == m_image)
-        return;
+    if (image) {
+        // Make the decision about whether the image has changed.
+        // This code makes the assumption that pointer equality on a NativeImagePtr is a valid way to tell if the image is changed.
+        // This assumption is true in Qt, GTK and EFL.
+        NativeImagePtr newNativeImagePtr = image->nativeImageForCurrentFrame();
+        if (!newNativeImagePtr)
+            return;
 
-    m_image = image;
-    if (m_image) {
-        RefPtr<TextureMapperTiledBackingStore> backingStore = TextureMapperTiledBackingStore::create();
-        backingStore->setContentsToImage(image);
-        m_compositedImage = backingStore;
+        if (newNativeImagePtr == m_compositedNativeImagePtr)
+            return;
+
+        m_compositedNativeImagePtr = newNativeImagePtr;
+        if (!m_compositedImage)
+            m_compositedImage = TextureMapperTiledBackingStore::create();
+        m_compositedImage->setContentsToImage(image);
     } else
         m_compositedImage = 0;
 

Modified: trunk/Source/WebCore/platform/graphics/texmap/GraphicsLayerTextureMapper.h (125833 => 125834)


--- trunk/Source/WebCore/platform/graphics/texmap/GraphicsLayerTextureMapper.h	2012-08-17 00:47:25 UTC (rev 125833)
+++ trunk/Source/WebCore/platform/graphics/texmap/GraphicsLayerTextureMapper.h	2012-08-17 00:49:06 UTC (rev 125834)
@@ -100,8 +100,8 @@
     virtual void willBeDestroyed();
 
     OwnPtr<TextureMapperLayer> m_layer;
-    RefPtr<TextureMapperBackingStore> m_compositedImage;
-    RefPtr<Image> m_image;
+    RefPtr<TextureMapperTiledBackingStore> m_compositedImage;
+    NativeImagePtr m_compositedNativeImagePtr;
     int m_changeMask;
     bool m_needsDisplay;
     bool m_fixedToViewport;
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to