Ignore:
Timestamp:
May 5, 2011, 5:36:53 AM (14 years ago)
Author:
Dmitry A. Kuminov
Message:

trunk: Merged in qt 4.7.2 sources from branches/vendor/nokia/qt.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp

    r769 r846  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation (qt-info@nokia.com)
     
    9292}
    9393
     94#ifdef QT_DIRECTFB_OPAQUE_DETECTION
    9495// mostly duplicated from qimage.cpp (QImageData::checkForAlphaPixels)
    9596static bool checkForAlphaPixels(const QImage &img)
     
    161162    return false;
    162163}
    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
     166bool 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));
    168172#else
     173    Q_UNUSED(flags);
    169174    return img.hasAlphaChannel();
    170175#endif
     
    247252    QDirectFBPointer<IDirectFBImageProvider> provider(providerPtr);
    248253
    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 
    255254    DFBImageDescription imageDescription;
    256255    result = provider->GetImageDescription(provider.data(), &imageDescription);
     
    260259    }
    261260
    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;
    263272    imageFormat = alpha ? screen->alphaPixmapFormat() : screen->pixelFormat();
    264273
     
    288297#endif
    289298
    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     }
     299void QDirectFBPixmapData::fromImage(const QImage &img, Qt::ImageConversionFlags flags)
     300{
     301    alpha = QDirectFBPixmapData::hasAlphaChannel(img, flags);
    303302    imageFormat = alpha ? screen->alphaPixmapFormat() : screen->pixelFormat();
    304303    QImage image;
     
    591590}
    592591
    593 #ifndef QT_DIRECTFB_PLUGIN
    594592Q_GUI_EXPORT IDirectFBSurface *qt_directfb_surface_for_pixmap(const QPixmap &pixmap)
    595593{
     
    600598    return dfbData->directFBSurface();
    601599}
    602 #endif
    603600
    604601QT_END_NAMESPACE
Note: See TracChangeset for help on using the changeset viewer.