equal
deleted
inserted
replaced
89 h = height; |
89 h = height; |
90 is_null = (w <= 0 || h <= 0); |
90 is_null = (w <= 0 || h <= 0); |
91 setSerialNumber(++global_ser_no); |
91 setSerialNumber(++global_ser_no); |
92 } |
92 } |
93 |
93 |
|
94 #ifdef QT_DIRECTFB_OPAQUE_DETECTION |
94 // mostly duplicated from qimage.cpp (QImageData::checkForAlphaPixels) |
95 // mostly duplicated from qimage.cpp (QImageData::checkForAlphaPixels) |
95 static bool checkForAlphaPixels(const QImage &img) |
96 static bool checkForAlphaPixels(const QImage &img) |
96 { |
97 { |
97 const uchar *bits = img.bits(); |
98 const uchar *bits = img.bits(); |
98 const int bytes_per_line = img.bytesPerLine(); |
99 const int bytes_per_line = img.bytesPerLine(); |
158 break; |
159 break; |
159 } |
160 } |
160 |
161 |
161 return false; |
162 return false; |
162 } |
163 } |
163 |
164 #endif // QT_DIRECTFB_OPAQUE_DETECTION |
164 bool QDirectFBPixmapData::hasAlphaChannel(const QImage &img) |
165 |
165 { |
166 bool QDirectFBPixmapData::hasAlphaChannel(const QImage &img, Qt::ImageConversionFlags flags) |
166 #ifndef QT_NO_DIRECTFB_OPAQUE_DETECTION |
167 { |
167 return checkForAlphaPixels(img); |
168 if (img.depth() == 1) |
|
169 return true; |
|
170 #ifdef QT_DIRECTFB_OPAQUE_DETECTION |
|
171 return ((flags & Qt::NoOpaqueDetection) ? img.hasAlphaChannel() : checkForAlphaPixels(img)); |
168 #else |
172 #else |
|
173 Q_UNUSED(flags); |
169 return img.hasAlphaChannel(); |
174 return img.hasAlphaChannel(); |
170 #endif |
175 #endif |
171 } |
176 } |
172 |
177 |
173 #ifdef QT_DIRECTFB_IMAGEPROVIDER |
178 #ifdef QT_DIRECTFB_IMAGEPROVIDER |
285 return true; |
290 return true; |
286 } |
291 } |
287 |
292 |
288 #endif |
293 #endif |
289 |
294 |
290 void QDirectFBPixmapData::fromImage(const QImage &img, |
295 void QDirectFBPixmapData::fromImage(const QImage &img, Qt::ImageConversionFlags flags) |
291 Qt::ImageConversionFlags flags) |
296 { |
292 { |
297 alpha = QDirectFBPixmapData::hasAlphaChannel(img, flags); |
293 if (img.depth() == 1) { |
|
294 alpha = true; |
|
295 #ifndef QT_NO_DIRECTFB_OPAQUE_DETECTION |
|
296 } else if (flags & Qt::NoOpaqueDetection || QDirectFBPixmapData::hasAlphaChannel(img)) { |
|
297 alpha = true; |
|
298 #else |
|
299 } else if (img.hasAlphaChannel()) { |
|
300 alpha = true; |
|
301 #endif |
|
302 } |
|
303 imageFormat = alpha ? screen->alphaPixmapFormat() : screen->pixelFormat(); |
298 imageFormat = alpha ? screen->alphaPixmapFormat() : screen->pixelFormat(); |
304 QImage image; |
299 QImage image; |
305 if ((flags & ~Qt::NoOpaqueDetection) != Qt::AutoColor) { |
300 if ((flags & ~Qt::NoOpaqueDetection) != Qt::AutoColor) { |
306 image = img.convertToFormat(imageFormat, flags); |
301 image = img.convertToFormat(imageFormat, flags); |
307 flags = Qt::AutoColor; |
302 flags = Qt::AutoColor; |