Changeset 846 for trunk/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp
- Timestamp:
- May 5, 2011, 5:36:53 AM (14 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
- Property svn:mergeinfo changed
/branches/vendor/nokia/qt/4.7.2 (added) merged: 845 /branches/vendor/nokia/qt/current merged: 844 /branches/vendor/nokia/qt/4.6.3 removed
- Property svn:mergeinfo changed
-
trunk/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp
r769 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) … … 92 92 } 93 93 94 #ifdef QT_DIRECTFB_OPAQUE_DETECTION 94 95 // mostly duplicated from qimage.cpp (QImageData::checkForAlphaPixels) 95 96 static bool checkForAlphaPixels(const QImage &img) … … 161 162 return false; 162 163 } 163 164 bool QDirectFBPixmapData::hasAlphaChannel(const QImage &img) 165 { 166 #ifndef QT_NO_DIRECTFB_OPAQUE_DETECTION 167 return checkForAlphaPixels(img); 164 #endif // QT_DIRECTFB_OPAQUE_DETECTION 165 166 bool QDirectFBPixmapData::hasAlphaChannel(const QImage &img, Qt::ImageConversionFlags flags) 167 { 168 if (img.depth() == 1) 169 return true; 170 #ifdef QT_DIRECTFB_OPAQUE_DETECTION 171 return ((flags & Qt::NoOpaqueDetection) ? img.hasAlphaChannel() : checkForAlphaPixels(img)); 168 172 #else 173 Q_UNUSED(flags); 169 174 return img.hasAlphaChannel(); 170 175 #endif … … 247 252 QDirectFBPointer<IDirectFBImageProvider> provider(providerPtr); 248 253 249 DFBSurfaceDescription surfaceDescription;250 if ((result = provider->GetSurfaceDescription(provider.data(), &surfaceDescription)) != DFB_OK) {251 DirectFBError("QDirectFBPixmapData::fromDataBufferDescription(): Can't get surface description", result);252 return false;253 }254 255 254 DFBImageDescription imageDescription; 256 255 result = provider->GetImageDescription(provider.data(), &imageDescription); … … 260 259 } 261 260 262 alpha = imageDescription.caps & (DICAPS_ALPHACHANNEL|DICAPS_COLORKEY); 261 if (imageDescription.caps & DICAPS_COLORKEY) { 262 return false; 263 } 264 265 DFBSurfaceDescription surfaceDescription; 266 if ((result = provider->GetSurfaceDescription(provider.data(), &surfaceDescription)) != DFB_OK) { 267 DirectFBError("QDirectFBPixmapData::fromDataBufferDescription(): Can't get surface description", result); 268 return false; 269 } 270 271 alpha = imageDescription.caps & DICAPS_ALPHACHANNEL; 263 272 imageFormat = alpha ? screen->alphaPixmapFormat() : screen->pixelFormat(); 264 273 … … 288 297 #endif 289 298 290 void QDirectFBPixmapData::fromImage(const QImage &img, 291 Qt::ImageConversionFlags flags) 292 { 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 } 299 void QDirectFBPixmapData::fromImage(const QImage &img, Qt::ImageConversionFlags flags) 300 { 301 alpha = QDirectFBPixmapData::hasAlphaChannel(img, flags); 303 302 imageFormat = alpha ? screen->alphaPixmapFormat() : screen->pixelFormat(); 304 303 QImage image; … … 591 590 } 592 591 593 #ifndef QT_DIRECTFB_PLUGIN594 592 Q_GUI_EXPORT IDirectFBSurface *qt_directfb_surface_for_pixmap(const QPixmap &pixmap) 595 593 { … … 600 598 return dfbData->directFBSurface(); 601 599 } 602 #endif603 600 604 601 QT_END_NAMESPACE
Note:
See TracChangeset
for help on using the changeset viewer.