Title: [200940] trunk/Source/WebCore
Revision
200940
Author
zandober...@gmail.com
Date
2016-05-16 03:28:19 -0700 (Mon, 16 May 2016)

Log Message

[Cairo] GraphicsContext3D::ImageExtractor should use the correct size for copying non-image surfaces
https://bugs.webkit.org/show_bug.cgi?id=157580

Reviewed by Darin Adler.

GraphicsContext3D::ImageExtractor::extractImage() shouldn't use m_imageWidth
and m_imageHeight members when copying the non-image-backed Cairo surface into
the image-based replacement simply because these two are not initialized until
later in this method.

Instead, the size of the to-be-copied image should be queried via the
cairoSurfaceSize() utility function which properly handles Cairo surfaces of
different types.

* platform/graphics/cairo/GraphicsContext3DCairo.cpp:
(WebCore::GraphicsContext3D::ImageExtractor::extractImage):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (200939 => 200940)


--- trunk/Source/WebCore/ChangeLog	2016-05-16 08:05:13 UTC (rev 200939)
+++ trunk/Source/WebCore/ChangeLog	2016-05-16 10:28:19 UTC (rev 200940)
@@ -1,3 +1,22 @@
+2016-05-16  Zan Dobersek  <zdober...@igalia.com>
+
+        [Cairo] GraphicsContext3D::ImageExtractor should use the correct size for copying non-image surfaces
+        https://bugs.webkit.org/show_bug.cgi?id=157580
+
+        Reviewed by Darin Adler.
+
+        GraphicsContext3D::ImageExtractor::extractImage() shouldn't use m_imageWidth
+        and m_imageHeight members when copying the non-image-backed Cairo surface into
+        the image-based replacement simply because these two are not initialized until
+        later in this method.
+
+        Instead, the size of the to-be-copied image should be queried via the
+        cairoSurfaceSize() utility function which properly handles Cairo surfaces of
+        different types.
+
+        * platform/graphics/cairo/GraphicsContext3DCairo.cpp:
+        (WebCore::GraphicsContext3D::ImageExtractor::extractImage):
+
 2016-05-16  Said Abou-Hallawa  <sabouhall...@apple.com>
 
         REGRESSION (r199821): Large animated GIFs with slow network do not animate till the last frame

Modified: trunk/Source/WebCore/platform/graphics/cairo/GraphicsContext3DCairo.cpp (200939 => 200940)


--- trunk/Source/WebCore/platform/graphics/cairo/GraphicsContext3DCairo.cpp	2016-05-16 08:05:13 UTC (rev 200939)
+++ trunk/Source/WebCore/platform/graphics/cairo/GraphicsContext3DCairo.cpp	2016-05-16 10:28:19 UTC (rev 200940)
@@ -226,9 +226,10 @@
 
         // if m_imageSurface is not an image, extract a copy of the surface
         if (m_imageSurface && cairo_surface_get_type(m_imageSurface.get()) != CAIRO_SURFACE_TYPE_IMAGE) {
-            RefPtr<cairo_surface_t> tmpSurface = adoptRef(cairo_image_surface_create(CAIRO_FORMAT_ARGB32, m_imageWidth, m_imageHeight));
-            copyRectFromOneSurfaceToAnother(m_imageSurface.get(), tmpSurface.get(), IntSize(), IntRect(0, 0, m_imageWidth, m_imageHeight), IntSize(), CAIRO_OPERATOR_SOURCE);
-            m_imageSurface = tmpSurface.release();
+            IntSize surfaceSize = cairoSurfaceSize(m_imageSurface.get());
+            auto tmpSurface = adoptRef(cairo_image_surface_create(CAIRO_FORMAT_ARGB32, surfaceSize.width(), surfaceSize.height()));
+            copyRectFromOneSurfaceToAnother(m_imageSurface.get(), tmpSurface.get(), IntSize(), IntRect(IntPoint(), surfaceSize), IntSize(), CAIRO_OPERATOR_SOURCE);
+            m_imageSurface = WTFMove(tmpSurface);
         }
     }
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to