src/gui/image/qpixmapdata.cpp
changeset 3 41300fa6a67c
parent 0 1918ee327afb
child 4 3b1da2848fc7
child 7 f7bc934e204c
--- a/src/gui/image/qpixmapdata.cpp	Tue Jan 26 12:42:25 2010 +0200
+++ b/src/gui/image/qpixmapdata.cpp	Tue Feb 02 00:43:10 2010 +0200
@@ -51,6 +51,19 @@
 const uchar qt_pixmap_bit_mask[] = { 0x01, 0x02, 0x04, 0x08,
                                      0x10, 0x20, 0x40, 0x80 };
 
+QPixmapData *QPixmapData::create(int w, int h, PixelType type)
+{
+    QPixmapData *data;
+    QGraphicsSystem* gs = QApplicationPrivate::graphicsSystem();
+    if (gs)
+        data = gs->createPixmapData(static_cast<QPixmapData::PixelType>(type));
+    else
+        data = QGraphicsSystem::createDefaultPixmapData(static_cast<QPixmapData::PixelType>(type));
+    data->resize(w, h);
+    return data;
+}
+
+
 QPixmapData::QPixmapData(PixelType pixelType, int objectId)
     : w(0),
       h(0),
@@ -188,7 +201,7 @@
     if (mask.isNull()) // allocation failed
         return QBitmap();
 
-    mask.setNumColors(2);
+    mask.setColorCount(2);
     mask.setColor(0, QColor(Qt::color0).rgba());
     mask.setColor(1, QColor(Qt::color1).rgba());