Title: [122953] trunk/Source
Revision
122953
Author
zol...@webkit.org
Date
2012-07-18 05:50:36 -0700 (Wed, 18 Jul 2012)

Log Message

[Qt] Modify the using of the QImage::Format enum to the appropriate functions from NativeImageQt
https://bugs.webkit.org/show_bug.cgi?id=91600

Reviewed by Andreas Kling.

Use NativeImageQt::defaultFormatForAlphaEnabledImages() and NativeImageQt::defaultFormatForOpaqueImages()
instead of the direct imagetypes at the appropriate places.

Source/WebCore:

Covered by existing tests.

* platform/graphics/qt/GraphicsContext3DQt.cpp:
(WebCore::GraphicsContext3D::paintToCanvas):
* platform/graphics/qt/PathQt.cpp:
(WebCore::scratchContext):
* platform/graphics/texmap/TextureMapperGL.cpp:
(WebCore::TextureMapperGL::drawRepaintCounter):
* platform/graphics/texmap/TextureMapperImageBuffer.cpp:
(WebCore::BitmapTextureImageBuffer::updateContents):

Source/WebKit2:

* Shared/qt/ShareableBitmapQt.cpp:
(WebKit::ShareableBitmap::createQImage):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (122952 => 122953)


--- trunk/Source/WebCore/ChangeLog	2012-07-18 12:50:15 UTC (rev 122952)
+++ trunk/Source/WebCore/ChangeLog	2012-07-18 12:50:36 UTC (rev 122953)
@@ -1,3 +1,24 @@
+2012-07-18  Zoltan Horvath  <zol...@webkit.org>
+
+        [Qt] Modify the using of the QImage::Format enum to the appropriate functions from NativeImageQt
+        https://bugs.webkit.org/show_bug.cgi?id=91600
+
+        Reviewed by Andreas Kling.
+
+        Use NativeImageQt::defaultFormatForAlphaEnabledImages() and NativeImageQt::defaultFormatForOpaqueImages()
+        instead of the direct imagetypes at the appropriate places.
+
+        Covered by existing tests.
+
+        * platform/graphics/qt/GraphicsContext3DQt.cpp:
+        (WebCore::GraphicsContext3D::paintToCanvas):
+        * platform/graphics/qt/PathQt.cpp:
+        (WebCore::scratchContext):
+        * platform/graphics/texmap/TextureMapperGL.cpp:
+        (WebCore::TextureMapperGL::drawRepaintCounter):
+        * platform/graphics/texmap/TextureMapperImageBuffer.cpp:
+        (WebCore::BitmapTextureImageBuffer::updateContents):
+
 2012-07-18  Andrey Kosyakov  <ca...@chromium.org>
 
         Web Inspector: create timeline detail records lazily

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


--- trunk/Source/WebCore/platform/graphics/qt/GraphicsContext3DQt.cpp	2012-07-18 12:50:15 UTC (rev 122952)
+++ trunk/Source/WebCore/platform/graphics/qt/GraphicsContext3DQt.cpp	2012-07-18 12:50:36 UTC (rev 122953)
@@ -29,6 +29,7 @@
 #include "HostWindow.h"
 #include "ImageBuffer.h"
 #include "ImageData.h"
+#include "NativeImageQt.h"
 #include "NotImplemented.h"
 #include "OpenGLShims.h"
 #include "QWebPageClient.h"
@@ -468,7 +469,7 @@
 void GraphicsContext3D::paintToCanvas(const unsigned char* imagePixels, int imageWidth, int imageHeight,
                                       int canvasWidth, int canvasHeight, QPainter* context)
 {
-    QImage image(imagePixels, imageWidth, imageHeight, QImage::Format_ARGB32_Premultiplied);
+    QImage image(imagePixels, imageWidth, imageHeight, NativeImageQt::defaultFormatForAlphaEnabledImages());
     context->save();
     context->translate(0, imageHeight);
     context->scale(1, -1);

Modified: trunk/Source/WebCore/platform/graphics/qt/PathQt.cpp (122952 => 122953)


--- trunk/Source/WebCore/platform/graphics/qt/PathQt.cpp	2012-07-18 12:50:15 UTC (rev 122952)
+++ trunk/Source/WebCore/platform/graphics/qt/PathQt.cpp	2012-07-18 12:50:36 UTC (rev 122953)
@@ -35,6 +35,7 @@
 #include "FloatRect.h"
 #include "GraphicsContext.h"
 #include "ImageBuffer.h"
+#include "NativeImageQt.h"
 #include "PlatformString.h"
 #include "StrokeStyleApplier.h"
 #include <QPainterPath>
@@ -118,7 +119,7 @@
 
 static GraphicsContext* scratchContext()
 {
-    static QImage image(1, 1, QImage::Format_ARGB32_Premultiplied);
+    static QImage image(1, 1, NativeImageQt::defaultFormatForAlphaEnabledImages());
     static QPainter painter(&image);
     static GraphicsContext* context = new GraphicsContext(&painter);
     return context;

Modified: trunk/Source/WebCore/platform/graphics/texmap/TextureMapperGL.cpp (122952 => 122953)


--- trunk/Source/WebCore/platform/graphics/texmap/TextureMapperGL.cpp	2012-07-18 12:50:15 UTC (rev 122952)
+++ trunk/Source/WebCore/platform/graphics/texmap/TextureMapperGL.cpp	2012-07-18 12:50:36 UTC (rev 122953)
@@ -38,6 +38,7 @@
 #endif
 
 #if PLATFORM(QT)
+#include "NativeImageQt.h"
 #if HAVE(QT5)
 #include <QOpenGLContext>
 #else
@@ -377,7 +378,7 @@
     IntRect sourceRect(IntPoint::zero(), size);
     IntRect targetRect(roundedIntPoint(targetPoint), size);
 
-    QImage image(size, QImage::Format_ARGB32_Premultiplied);
+    QImage image(size, NativeImageQt::defaultFormatForAlphaEnabledImages());
     QPainter painter(&image);
     painter.fillRect(sourceRect, Qt::blue); // Since we won't swap R+B for speed, this will paint red.
     painter.setFont(font);

Modified: trunk/Source/WebCore/platform/graphics/texmap/TextureMapperImageBuffer.cpp (122952 => 122953)


--- trunk/Source/WebCore/platform/graphics/texmap/TextureMapperImageBuffer.cpp	2012-07-18 12:50:15 UTC (rev 122952)
+++ trunk/Source/WebCore/platform/graphics/texmap/TextureMapperImageBuffer.cpp	2012-07-18 12:50:36 UTC (rev 122953)
@@ -21,14 +21,18 @@
 #include "TextureMapperImageBuffer.h"
 
 #include "FilterEffectRenderer.h"
+#if PLATFORM(QT)
+#include "NativeImageQt.h"
+#endif
 
+
 #if USE(TEXTURE_MAPPER)
 namespace WebCore {
 
 void BitmapTextureImageBuffer::updateContents(const void* data, const IntRect& targetRect, const IntPoint& sourceOffset, int bytesPerLine)
 {
 #if PLATFORM(QT)
-    QImage image(reinterpret_cast<const uchar*>(data), targetRect.width(), targetRect.height(), bytesPerLine, QImage::Format_ARGB32_Premultiplied);
+    QImage image(reinterpret_cast<const uchar*>(data), targetRect.width(), targetRect.height(), bytesPerLine, NativeImageQt::defaultFormatForAlphaEnabledImages());
 
     QPainter* painter = m_image->context()->platformContext();
     painter->save();

Modified: trunk/Source/WebKit2/ChangeLog (122952 => 122953)


--- trunk/Source/WebKit2/ChangeLog	2012-07-18 12:50:15 UTC (rev 122952)
+++ trunk/Source/WebKit2/ChangeLog	2012-07-18 12:50:36 UTC (rev 122953)
@@ -1,3 +1,16 @@
+2012-07-18  Zoltan Horvath  <zol...@webkit.org>
+
+        [Qt] Modify the using of the QImage::Format enum to the appropriate functions from NativeImageQt
+        https://bugs.webkit.org/show_bug.cgi?id=91600
+
+        Reviewed by Andreas Kling.
+
+        Use NativeImageQt::defaultFormatForAlphaEnabledImages() and NativeImageQt::defaultFormatForOpaqueImages()
+        instead of the direct imagetypes at the appropriate places.
+
+        * Shared/qt/ShareableBitmapQt.cpp:
+        (WebKit::ShareableBitmap::createQImage):
+
 2012-07-18  Zeno Albisser  <z...@webkit.org>
 
         [Qt][WK2] Caching of ShareableSurfaces breaks tiling.

Modified: trunk/Source/WebKit2/Shared/qt/ShareableBitmapQt.cpp (122952 => 122953)


--- trunk/Source/WebKit2/Shared/qt/ShareableBitmapQt.cpp	2012-07-18 12:50:15 UTC (rev 122952)
+++ trunk/Source/WebKit2/Shared/qt/ShareableBitmapQt.cpp	2012-07-18 12:50:36 UTC (rev 122953)
@@ -26,6 +26,7 @@
 #include "config.h"
 #include "ShareableBitmap.h"
 
+#include "NativeImageQt.h"
 #include <QImage>
 #include <QPainter>
 #include <QtGlobal>
@@ -41,7 +42,7 @@
 {
     ref(); // Balanced by deref in releaseSharedMemoryData
     return QImage(reinterpret_cast<uchar*>(data()), m_size.width(), m_size.height(), m_size.width() * 4,
-                  m_flags & SupportsAlpha ? QImage::Format_ARGB32_Premultiplied : QImage::Format_RGB32,
+                  m_flags & SupportsAlpha ? NativeImageQt::defaultFormatForAlphaEnabledImages() : NativeImageQt::defaultFormatForOpaqueImages(),
                   releaseSharedMemoryData, this);
 }
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to