Title: [121209] trunk/Source/WebCore
Revision
121209
Author
[email protected]
Date
2012-06-25 18:30:19 -0700 (Mon, 25 Jun 2012)

Log Message

[Qt] Avoid a deep copy of QImage in GraphicsContext3D::getImageData.
https://bugs.webkit.org/show_bug.cgi?id=89865

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

No new tests. Covered by existing tests.

* platform/graphics/qt/GraphicsContext3DQt.cpp:
(WebCore::GraphicsContext3D::getImageData):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (121208 => 121209)


--- trunk/Source/WebCore/ChangeLog	2012-06-26 01:26:17 UTC (rev 121208)
+++ trunk/Source/WebCore/ChangeLog	2012-06-26 01:30:19 UTC (rev 121209)
@@ -1,3 +1,15 @@
+2012-06-25  Huang Dongsung  <[email protected]>
+
+        [Qt] Avoid a deep copy of QImage in GraphicsContext3D::getImageData.
+        https://bugs.webkit.org/show_bug.cgi?id=89865
+
+        Reviewed by Noam Rosenthal.
+
+        No new tests. Covered by existing tests.
+
+        * platform/graphics/qt/GraphicsContext3DQt.cpp:
+        (WebCore::GraphicsContext3D::getImageData):
+
 2012-06-25  Nick Carter  <[email protected]>
 
         Reduce memory footprint of BitmapImage Vectors.

Modified: trunk/Source/WebCore/platform/graphics/qt/GraphicsContext3DQt.cpp (121208 => 121209)


--- trunk/Source/WebCore/platform/graphics/qt/GraphicsContext3DQt.cpp	2012-06-26 01:26:17 UTC (rev 121208)
+++ trunk/Source/WebCore/platform/graphics/qt/GraphicsContext3DQt.cpp	2012-06-26 01:30:19 UTC (rev 121209)
@@ -35,6 +35,7 @@
 #include "SharedBuffer.h"
 #if HAVE(QT5)
 #include <QWindow>
+#include <qpa/qplatformpixmap.h>
 #endif
 #include <wtf/UnusedParam.h>
 #include <wtf/text/CString.h>
@@ -490,7 +491,15 @@
         nativeImage = QImage::fromData(reinterpret_cast<const uchar*>(image->data()->data()), image->data()->size()).convertToFormat(QImage::Format_ARGB32);
     else {
         QPixmap* nativePixmap = image->nativeImageForCurrentFrame();
-        nativeImage = nativePixmap->toImage().convertToFormat(QImage::Format_ARGB32);
+        QImage qtImage;
+#if HAVE(QT5)
+        // With QPA, we can avoid a deep copy.
+        qtImage = *nativePixmap->handle()->buffer();
+#else
+        // This might be a deep copy, depending on other references to the pixmap.
+        qtImage = nativePixmap->toImage();
+#endif
+        nativeImage = qtImage.convertToFormat(QImage::Format_ARGB32);
     }
     AlphaOp neededAlphaOp = AlphaDoNothing;
     if (premultiplyAlpha)
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to