Title: [88797] trunk/Source/WebKit2
Revision
88797
Author
[email protected]
Date
2011-06-14 06:54:29 -0700 (Tue, 14 Jun 2011)

Log Message

2011-06-14  Noam Rosenthal  <[email protected]>

        Reviewed by Kenneth Rohde Christiansen.

        [Qt] Implement accelerated compositing on WK2 Qt port
        https://bugs.webkit.org/show_bug.cgi?id=56935

        Add a createImage() function to ShareableBitmap, for now ifdef'ed to Qt only.
        This allows us to support directly composited images across the WebKit2 processes.

        Together with Viatcheslav Ostapenko.

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

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (88796 => 88797)


--- trunk/Source/WebKit2/ChangeLog	2011-06-14 13:53:38 UTC (rev 88796)
+++ trunk/Source/WebKit2/ChangeLog	2011-06-14 13:54:29 UTC (rev 88797)
@@ -1,3 +1,20 @@
+2011-06-14  Noam Rosenthal  <[email protected]>
+
+        Reviewed by Kenneth Rohde Christiansen.
+
+        [Qt] Implement accelerated compositing on WK2 Qt port
+        https://bugs.webkit.org/show_bug.cgi?id=56935
+
+        Add a createImage() function to ShareableBitmap, for now ifdef'ed to Qt only.
+        This allows us to support directly composited images across the WebKit2 processes.
+
+        Together with Viatcheslav Ostapenko.
+
+        * Shared/ShareableBitmap.h:
+        * Shared/qt/ShareableBitmapQt.cpp:
+        (WebKit::ShareableBitmap::createQImage):
+        (WebKit::ShareableBitmap::createImage):
+
 2011-06-13  Anders Carlsson  <[email protected]>
 
         Reviewed by Sam Weinig.

Modified: trunk/Source/WebKit2/Shared/ShareableBitmap.h (88796 => 88797)


--- trunk/Source/WebKit2/Shared/ShareableBitmap.h	2011-06-14 13:53:38 UTC (rev 88796)
+++ trunk/Source/WebKit2/Shared/ShareableBitmap.h	2011-06-14 13:54:29 UTC (rev 88797)
@@ -27,6 +27,7 @@
 #define ShareableBitmap_h
 
 #include "SharedMemory.h"
+#include <WebCore/Image.h>
 #include <WebCore/IntRect.h>
 #include <wtf/PassOwnPtr.h>
 #include <wtf/PassRefPtr.h>
@@ -121,6 +122,7 @@
     // This creates a QImage that directly references the shared bitmap data.
     // This is only safe to use when we know that the contents of the shareable bitmap won't change.
     QImage createQImage();
+    PassRefPtr<WebCore::Image> createImage();
 #endif
 
 private:

Modified: trunk/Source/WebKit2/Shared/qt/ShareableBitmapQt.cpp (88796 => 88797)


--- trunk/Source/WebKit2/Shared/qt/ShareableBitmapQt.cpp	2011-06-14 13:53:38 UTC (rev 88796)
+++ trunk/Source/WebKit2/Shared/qt/ShareableBitmapQt.cpp	2011-06-14 13:54:29 UTC (rev 88797)
@@ -28,6 +28,7 @@
 
 #include <QImage>
 #include <QPainter>
+#include <WebCore/BitmapImage.h>
 #include <WebCore/GraphicsContext.h>
 
 using namespace WebCore;
@@ -36,9 +37,18 @@
 
 QImage ShareableBitmap::createQImage()
 {
-    return QImage(reinterpret_cast<uchar*>(data()), m_size.width(), m_size.height(), m_size.width() * 4, QImage::Format_RGB32);
+    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);
 }
 
+#if PLATFORM(QT)
+PassRefPtr<Image> ShareableBitmap::createImage()
+{
+    QPixmap* pixmap = new QPixmap(QPixmap::fromImage(createQImage()));
+    return BitmapImage::create(pixmap);
+}
+#endif
+
 PassOwnPtr<GraphicsContext> ShareableBitmap::createGraphicsContext()
 {
     // FIXME: Should this be OwnPtr<QImage>?
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to