Ignore:
Timestamp:
Aug 2, 2010, 9:27:30 PM (15 years ago)
Author:
Dmitry A. Kuminov
Message:

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

Location:
trunk
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk

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

    r651 r769  
    6969
    7070    enum CompositionModeStatus {
    71         PorterDuff_None = 0x00,
    72         PorterDuff_SupportedBlits = 0x01,
    73         PorterDuff_SupportedPrimitives = 0x02,
    74         PorterDuff_SupportedOpaquePrimitives = 0x04,
    75         PorterDuff_Dirty = 0x10
     71        PorterDuff_None = 0x0,
     72        PorterDuff_Supported = 0x1,
     73        PorterDuff_PremultiplyColors = 0x2,
     74        PorterDuff_AlwaysBlend = 0x4
    7675    };
    7776
     
    9897    static inline void unlock(QDirectFBPaintDevice *device);
    9998
    100     inline bool testCompositionMode(const QPen *pen, const QBrush *brush, const QColor *color = 0) const;
    10199    inline bool isSimpleBrush(const QBrush &brush) const;
    102100
     
    131129    QDirectFBPaintDevice *dfbDevice;
    132130    uint compositionModeStatus;
     131
    133132
    134133    bool inClip;
     
    169168#endif
    170169
    171 #if defined QT_DIRECTFB_WARN_ON_RASTERFALLBACKS || defined QT_DIRECTFB_DISABLE_RASTERFALLBACKS
     170#if defined QT_DIRECTFB_WARN_ON_RASTERFALLBACKS || defined QT_DIRECTFB_DISABLE_RASTERFALLBACKS
    172171#define VOID_ARG() static_cast<bool>(false)
    173172enum PaintOperation {
     
    179178    ALL = 0xffff
    180179};
    181 #endif
    182 
     180
     181#ifdef QT_DEBUG
     182static void initRasterFallbacksMasks(int *warningMask, int *disableMask)
     183{
     184    struct {
     185        const char *name;
     186        PaintOperation operation;
     187    } const operations[] = {
     188        { "DRAW_RECTS", DRAW_RECTS },
     189        { "DRAW_LINES", DRAW_LINES },
     190        { "DRAW_IMAGE", DRAW_IMAGE },
     191        { "DRAW_PIXMAP", DRAW_PIXMAP },
     192        { "DRAW_TILED_PIXMAP", DRAW_TILED_PIXMAP },
     193        { "STROKE_PATH", STROKE_PATH },
     194        { "DRAW_PATH", DRAW_PATH },
     195        { "DRAW_POINTS", DRAW_POINTS },
     196        { "DRAW_ELLIPSE", DRAW_ELLIPSE },
     197        { "DRAW_POLYGON", DRAW_POLYGON },
     198        { "DRAW_TEXT", DRAW_TEXT },
     199        { "FILL_PATH", FILL_PATH },
     200        { "FILL_RECT", FILL_RECT },
     201        { "DRAW_COLORSPANS", DRAW_COLORSPANS },
     202        { "DRAW_ROUNDED_RECT", DRAW_ROUNDED_RECT },
     203        { "ALL", ALL },
     204        { 0, ALL }
     205    };
     206
     207    QStringList warning = QString::fromLatin1(qgetenv("QT_DIRECTFB_WARN_ON_RASTERFALLBACKS")).toUpper().split(QLatin1Char('|'),
     208                                                                                                              QString::SkipEmptyParts);
     209    QStringList disable = QString::fromLatin1(qgetenv("QT_DIRECTFB_DISABLE_RASTERFALLBACKS")).toUpper().split(QLatin1Char('|'),
     210                                                                                                              QString::SkipEmptyParts);
     211    *warningMask = 0;
     212    *disableMask = 0;
     213    if (!warning.isEmpty() || !disable.isEmpty()) {
     214        for (int i=0; operations[i].name; ++i) {
     215            const QString name = QString::fromLatin1(operations[i].name);
     216            int idx = warning.indexOf(name);
     217            if (idx != -1) {
     218                *warningMask |= operations[i].operation;
     219                warning.erase(warning.begin() + idx);
     220            }
     221            idx = disable.indexOf(name);
     222            if (idx != -1) {
     223                *disableMask |= operations[i].operation;
     224                disable.erase(disable.begin() + idx);
     225            }
     226        }
     227    }
     228    if (!warning.isEmpty()) {
     229        qWarning("QDirectFBPaintEngine QT_DIRECTFB_WARN_ON_RASTERFALLBACKS Unknown operation(s): %s",
     230                 qPrintable(warning.join(QLatin1String("|"))));
     231    }
     232    if (!disable.isEmpty()) {
     233        qWarning("QDirectFBPaintEngine QT_DIRECTFB_DISABLE_RASTERFALLBACKS Unknown operation(s): %s",
     234                 qPrintable(disable.join(QLatin1String("|"))));
     235    }
     236
     237}
     238#endif
     239
     240static inline int rasterFallbacksMask(bool warn)
     241{
    183242#ifdef QT_DIRECTFB_WARN_ON_RASTERFALLBACKS
     243
     244
     245
     246
     247
     248
     249
     250
     251
     252
     253
     254
     255
     256
     257
     258
     259
     260
     261
     262
    184263template <typename device, typename T1, typename T2, typename T3>
    185264static void rasterFallbackWarn(const char *msg, const char *func, const device *dev,
     
    191270#endif
    192271
    193 #if defined QT_DIRECTFB_WARN_ON_RASTERFALLBACKS && defined QT_DIRECTFB_DISABLE_RASTERFALLBACKS
     272#if defined QT_D
    194273#define RASTERFALLBACK(op, one, two, three)                             \
    195     if (op & (QT_DIRECTFB_WARN_ON_RASTERFALLBACKS))                     \
    196         rasterFallbackWarn("Disabled raster engine operation",          \
    197                            __FUNCTION__, state()->painter->device(),    \
    198                            d_func()->transformationType,                \
    199                            d_func()->simplePen,                         \
    200                            d_func()->clipType,                          \
    201                            d_func()->compositionModeStatus,             \
    202                            #one, one, #two, two, #three, three);        \
    203     if (op & (QT_DIRECTFB_DISABLE_RASTERFALLBACKS))                     \
    204         return;
     274    {                                                                   \
     275        const bool disable = op & rasterFallbacksMask(false);           \
     276        if (op & rasterFallbacksMask(true))                             \
     277            rasterFallbackWarn(disable                                  \
     278                               ? "Disabled raster engine operation"     \
     279                               : "Falling back to raster engine for",   \
     280                               __FUNCTION__,                            \
     281                               state()->painter->device(),              \
     282                               d_func()->transformationType,            \
     283                               d_func()->simplePen,                     \
     284                               d_func()->clipType,                      \
     285                               d_func()->compositionModeStatus,         \
     286                               #one, one, #two, two, #three, three);    \
     287        if (disable)                                                    \
     288            return;                                                     \
     289    }
    205290#elif defined QT_DIRECTFB_DISABLE_RASTERFALLBACKS
    206 #define RASTERFALLBACK(op, one, two, three)             \
    207     if (op & (QT_DIRECTFB_DISABLE_RASTERFALLBACKS))     \
     291#define RASTERFALLBACK(op, one, two, three)             \
     292    if (op &      \
    208293        return;
    209294#elif defined QT_DIRECTFB_WARN_ON_RASTERFALLBACKS
    210295#define RASTERFALLBACK(op, one, two, three)                             \
    211     if (op & (QT_DIRECTFB_WARN_ON_RASTERFALLBACKS))                     \
     296    if (op &                      \
    212297        rasterFallbackWarn("Falling back to raster engine for",         \
    213298                           __FUNCTION__, state()->painter->device(),    \
     
    288373               device->devType());
    289374    }
     375
    290376
    291377    d->prepare(d->dfbDevice);
     
    414500        || d->clipType == QDirectFBPaintEnginePrivate::ComplexClip
    415501        || !d->isSimpleBrush(brush)
    416         || !d->testCompositionMode(&pen, &brush)) {
     502        || !)) {
    417503        RASTERFALLBACK(DRAW_RECTS, rectCount, VOID_ARG(), VOID_ARG());
    418504        d->lock();
     
    444530        || d->clipType == QDirectFBPaintEnginePrivate::ComplexClip
    445531        || !d->isSimpleBrush(brush)
    446         || !d->testCompositionMode(&pen, &brush)) {
     532        || !)) {
    447533        RASTERFALLBACK(DRAW_RECTS, rectCount, VOID_ARG(), VOID_ARG());
    448534        d->lock();
     
    469555    if (!d->simplePen
    470556        || d->clipType == QDirectFBPaintEnginePrivate::ComplexClip
    471         || !d->testCompositionMode(&pen, 0)) {
     557        || !)) {
    472558        RASTERFALLBACK(DRAW_LINES, lineCount, VOID_ARG(), VOID_ARG());
    473559        d->lock();
     
    489575    if (!d->simplePen
    490576        || d->clipType == QDirectFBPaintEnginePrivate::ComplexClip
    491         || !d->testCompositionMode(&pen, 0)) {
     577        || !)) {
    492578        RASTERFALLBACK(DRAW_LINES, lineCount, VOID_ARG(), VOID_ARG());
    493579        d->lock();
     
    527613
    528614#if !defined QT_NO_DIRECTFB_PREALLOCATED || defined QT_DIRECTFB_IMAGECACHE
    529     if (!(d->compositionModeStatus & QDirectFBPaintEnginePrivate::PorterDuff_SupportedBlits)
     615    if (!(d->compositionModeStatus & QDirectFBPaintEnginePrivate::PorterDuff_Supported)
    530616        || (d->transformationType & QDirectFBPaintEnginePrivate::Matrix_BlitsUnsupported)
    531617        || (d->clipType == QDirectFBPaintEnginePrivate::ComplexClip)
     
    576662        Q_ASSERT(data->classId() == QPixmapData::DirectFBClass);
    577663        QDirectFBPixmapData *dfbData = static_cast<QDirectFBPixmapData*>(data);
    578         if (!(d->compositionModeStatus & QDirectFBPaintEnginePrivate::PorterDuff_SupportedBlits)
     664        if (!(d->compositionModeStatus & QDirectFBPaintEnginePrivate::PorterDuff_Supported)
    579665            || (d->transformationType & QDirectFBPaintEnginePrivate::Matrix_BlitsUnsupported)
    580666            || (d->clipType == QDirectFBPaintEnginePrivate::ComplexClip)
     
    607693        d->lock();
    608694        QRasterPaintEngine::drawTiledPixmap(r, pixmap, offset);
    609     } else if (!(d->compositionModeStatus & QDirectFBPaintEnginePrivate::PorterDuff_SupportedBlits)
     695    } else if (!(d->compositionModeStatus & QDirectFBPaintEnginePrivate::PorterDuff_Supported)
    610696               || (d->transformationType & QDirectFBPaintEnginePrivate::Matrix_BlitsUnsupported)
    611697               || (d->clipType == QDirectFBPaintEnginePrivate::ComplexClip)
     
    720806        switch (brush.style()) {
    721807        case Qt::SolidPattern: {
    722             if (d->transformationType & QDirectFBPaintEnginePrivate::Matrix_RectsUnsupported
    723                 || !d->testCompositionMode(0, &brush)) {
    724                 break;
    725             }
    726808            const QColor color = brush.color();
    727809            if (!color.isValid())
    728810                return;
     811
     812
     813
     814
     815
    729816            d->setDFBColor(color);
    730817            const QRect r = state()->matrix.mapRect(rect).toRect();
     
    733820
    734821        case Qt::TexturePattern: {
    735             if (!(d->compositionModeStatus & QDirectFBPaintEnginePrivate::PorterDuff_SupportedBlits)
     822            if (!(d->compositionModeStatus & QDirectFBPaintEnginePrivate::PorterDuff_Supported)
    736823                || (d->transformationType & QDirectFBPaintEnginePrivate::Matrix_BlitsUnsupported)
    737824                || (!d->supportsStretchBlit() && state()->matrix.isScaling())) {
     
    761848    if ((d->transformationType & QDirectFBPaintEnginePrivate::Matrix_RectsUnsupported)
    762849        || (d->clipType == QDirectFBPaintEnginePrivate::ComplexClip)
    763         || !d->testCompositionMode(0, 0, &color)) {
     850        || !)) {
    764851        RASTERFALLBACK(FILL_RECT, rect, color, VOID_ARG());
    765852        d->lock();
     
    805892      transformationType(0), opacity(255),
    806893      clipType(ClipUnset), dfbDevice(0),
    807       compositionModeStatus(0), inClip(false), q(p)
     894      compositionModeStatus(0), inClip(false), q(p)
    808895{
    809896    fb = QDirectFBScreen::instance()->dfb();
     
    820907    return (brush.style() == Qt::NoBrush) || (brush.style() == Qt::SolidPattern && !antialiased);
    821908}
    822 
    823 bool QDirectFBPaintEnginePrivate::testCompositionMode(const QPen *pen, const QBrush *brush, const QColor *color) const
    824 {
    825     Q_ASSERT(!pen || pen->style() == Qt::NoPen || pen->style() == Qt::SolidLine);
    826     Q_ASSERT(!brush || brush->style() == Qt::NoBrush || brush->style() == Qt::SolidPattern);
    827     switch (compositionModeStatus & (QDirectFBPaintEnginePrivate::PorterDuff_SupportedOpaquePrimitives
    828                                      |QDirectFBPaintEnginePrivate::PorterDuff_SupportedPrimitives)) {
    829     case QDirectFBPaintEnginePrivate::PorterDuff_SupportedPrimitives:
    830         return true;
    831     case QDirectFBPaintEnginePrivate::PorterDuff_SupportedOpaquePrimitives:
    832         if (pen && pen->style() == Qt::SolidLine && pen->color().alpha() != 255)
    833             return false;
    834         if (brush) {
    835             if (brush->style() == Qt::SolidPattern && brush->color().alpha() != 255) {
    836                 return false;
    837             }
    838         } else if (color && color->alpha() != 255) {
    839             return false;
    840         }
    841         return true;
    842     case QDirectFBPaintEnginePrivate::PorterDuff_None:
    843         return false;
    844     default:
    845         // ### PorterDuff_SupportedOpaquePrimitives|PorterDuff_SupportedPrimitives can't be combined
    846         break;
    847     }
    848     Q_ASSERT(0);
    849     return false;
    850 }
    851 
    852909
    853910void QDirectFBPaintEnginePrivate::lock()
     
    913970    static const bool forceRasterFallBack = qgetenv("QT_DIRECTFB_FORCE_RASTER").toInt() > 0;
    914971    if (forceRasterFallBack) {
    915         compositionModeStatus = 0;
     972        compositionModeStatus = ;
    916973        return;
    917974    }
    918975
    919     compositionModeStatus = PorterDuff_SupportedBlits;
     976    compositionModeStatus = PorterDuff_Supported;
    920977    switch (mode) {
    921978    case QPainter::CompositionMode_Clear:
     
    924981    case QPainter::CompositionMode_Source:
    925982        surface->SetPorterDuff(surface, DSPD_SRC);
    926         compositionModeStatus |= PorterDuff_SupportedOpaquePrimitives;
     983        compositionModeStatus &= ~PorterDuff_AlwaysBlend;
     984        if (!isPremultiplied)
     985            compositionModeStatus &= ~PorterDuff_PremultiplyColors;
    927986        break;
    928987    case QPainter::CompositionMode_SourceOver:
    929         compositionModeStatus |= PorterDuff_SupportedPrimitives;
     988        compositionModeStatus ;
    930989        surface->SetPorterDuff(surface, DSPD_SRC_OVER);
    931990        break;
     
    935994    case QPainter::CompositionMode_SourceIn:
    936995        surface->SetPorterDuff(surface, DSPD_SRC_IN);
     996
     997
    937998        break;
    938999    case QPainter::CompositionMode_DestinationIn:
     
    9451006        surface->SetPorterDuff(surface, DSPD_DST_OUT);
    9461007        break;
     1008
     1009
     1010
     1011
     1012
    9471013#if (Q_DIRECTFB_VERSION >= 0x010000)
    9481014    case QPainter::CompositionMode_SourceAtop:
     
    9601026#endif
    9611027    default:
    962         compositionModeStatus = 0;
     1028        compositionModeStatus = ;
    9631029        break;
    9641030    }
     
    9821048    surface->SetColor(surface, 0xff, 0xff, 0xff, opacity);
    9831049    surface->SetBlittingFlags(surface, blittingFlags);
    984     if (compositionModeStatus & PorterDuff_Dirty) {
    985         setCompositionMode(q->state()->composition_mode);
    986     }
    9871050}
    9881051
     
    9971060{
    9981061    Q_ASSERT(surface);
     1062
    9991063    const quint8 alpha = (opacity == 255 ?
    10001064                          color.alpha() : ALPHA_MUL(color.alpha(), opacity));
    1001     surface->SetColor(surface, color.red(), color.green(), color.blue(), alpha);
    1002     surface->SetPorterDuff(surface, DSPD_NONE);
    1003     surface->SetDrawingFlags(surface, alpha == 255 ? DSDRAW_NOFX : DSDRAW_BLEND);
    1004     compositionModeStatus |= PorterDuff_Dirty;
     1065    QColor col;
     1066    if (compositionModeStatus & PorterDuff_PremultiplyColors) {
     1067        col = QColor(ALPHA_MUL(color.red(), alpha),
     1068                     ALPHA_MUL(color.green(), alpha),
     1069                     ALPHA_MUL(color.blue(), alpha),
     1070                     alpha);
     1071    } else {
     1072        col = QColor(color.red(), color.green(), color.blue(), alpha);
     1073    }
     1074    surface->SetColor(surface, col.red(), col.green(), col.blue(), col.alpha());
     1075    surface->SetDrawingFlags(surface, alpha == 255 && !(compositionModeStatus & PorterDuff_AlwaysBlend) ? DSDRAW_NOFX : DSDRAW_BLEND);
    10051076}
    10061077
     
    12841355}
    12851356
    1286 #ifdef QT_DIRECTFB_WARN_ON_RASTERFALLBACKS
     1357#if
    12871358template <typename T> inline const T *ptr(const T &t) { return &t; }
    12881359template <> inline const bool* ptr<bool>(const bool &) { return 0; }
  • trunk/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp

    r651 r769  
    175175                                   Qt::ImageConversionFlags flags)
    176176{
     177
     178
    177179    if (flags == Qt::AutoColor) {
    178180        if (filename.startsWith(QLatin1Char(':'))) { // resource
     
    289291                                    Qt::ImageConversionFlags flags)
    290292{
    291     if (img.depth() == 1 || img.format() == QImage::Format_RGB32) {
    292         fromImage(img.convertToFormat(screen->alphaPixmapFormat()), flags);
    293         return;
    294     }
    295 
    296     if (img.hasAlphaChannel()
     293    if (img.depth() == 1) {
     294        alpha = true;
    297295#ifndef QT_NO_DIRECTFB_OPAQUE_DETECTION
    298         && (flags & Qt::NoOpaqueDetection || QDirectFBPixmapData::hasAlphaChannel(img))
    299 #endif
    300         ) {
     296    } else if (flags & Qt::NoOpaqueDetection || QDirectFBPixmapData::hasAlphaChannel(img)) {
    301297        alpha = true;
    302         imageFormat = screen->alphaPixmapFormat();
    303     } else {
    304         alpha = false;
    305         imageFormat = screen->pixelFormat();
    306     }
     298#else
     299    } else if (img.hasAlphaChannel()) {
     300        alpha = true;
     301#endif
     302    }
     303    imageFormat = alpha ? screen->alphaPixmapFormat() : screen->pixelFormat();
    307304    QImage image;
    308     if (flags != Qt::AutoColor) {
     305    if ( != Qt::AutoColor) {
    309306        image = img.convertToFormat(imageFormat, flags);
    310307        flags = Qt::AutoColor;
    311     } else if (img.format() == QImage::Format_RGB32) {
     308    } else if (img.format() == QImage::Format_RGB32) {
    312309        image = img.convertToFormat(imageFormat, flags);
    313310    } else {
     
    426423    Q_ASSERT(dfbSurface);
    427424
    428     alpha = (color.alpha() < 255);
     425    alpha = (color.alpha() < 255);
    429426
    430427    if (alpha && isOpaqueFormat(imageFormat)) {
     
    594591}
    595592
     593
     594
     595
     596
     597
     598
     599
     600
     601
     602
     603
    596604QT_END_NAMESPACE
    597605
  • trunk/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp

    r651 r769  
    922922        }
    923923    } else {
    924         flipFlags = DSFLIP_BLIT;
     924        flipFlags = DSFLIP_BLIT;
    925925    }
    926926}
     
    11271127    if (displayArgs.contains(QLatin1String("boundingrectflip"), Qt::CaseInsensitive)) {
    11281128        d_ptr->directFBFlags |= BoundingRectFlip;
     1129
     1130
    11291131    }
    11301132
     
    11391141#endif
    11401142        d_ptr->dfb->SetCooperativeLevel(d_ptr->dfb, DFSCL_FULLSCREEN);
     1143
     1144
    11411145
    11421146    DFBSurfaceDescription description;
     
    11681172    }
    11691173
    1170     if (displayArgs.contains(QLatin1String("forcepremultiplied"), Qt::CaseInsensitive)) {
     1174    if () {
    11711175        description.caps |= DSCAPS_PREMULTIPLIED;
    11721176    }
     
    12181222        break;
    12191223    case QImage::Format_ARGB32:
     1224
     1225
    12201226    case QImage::Format_ARGB32_Premultiplied:
    12211227    case QImage::Format_ARGB4444_Premultiplied:
     
    16751681uchar *QDirectFBScreen::lockSurface(IDirectFBSurface *surface, DFBSurfaceLockFlags flags, int *bpl)
    16761682{
    1677     void *mem;
     1683    void *mem;
    16781684    const DFBResult result = surface->Lock(surface, flags, &mem, bpl);
    16791685    if (result != DFB_OK) {
     
    16841690}
    16851691
     1692
     1693
     1694
     1695
     1696
     1697
     1698
     1699
     1700
     1701
    16861702
    16871703void QDirectFBScreen::flipSurface(IDirectFBSurface *surface, DFBSurfaceFlipFlags flipFlags,
    16881704                                  const QRegion &region, const QPoint &offset)
    16891705{
    1690     if (!(flipFlags & DSFLIP_BLIT)) {
     1706    if (d_ptr->directFBFlags & NoPartialFlip
     1707        || (!(flipFlags & DSFLIP_BLIT) && QT_PREPEND_NAMESPACE(isFullUpdate(surface, region, offset)))) {
    16911708        surface->Flip(surface, 0, flipFlags);
    16921709    } else {
  • trunk/src/plugins/gfxdrivers/directfb/qdirectfbscreen.h

    r651 r769  
    145145        VideoOnly = 0x01,
    146146        SystemOnly = 0x02,
    147         BoundingRectFlip = 0x04
     147        BoundingRectFlip = 0x04,
     148        NoPartialFlip = 0x08
    148149    };
    149150
  • trunk/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp

    r651 r769  
    6262    , flipFlags(flip)
    6363    , boundingRectFlip(scr->directFBFlags() & QDirectFBScreen::BoundingRectFlip)
     64
    6465{
    6566#ifdef QT_NO_DIRECTFB_WM
     
    8182    , flipFlags(flip)
    8283    , boundingRectFlip(scr->directFBFlags() & QDirectFBScreen::BoundingRectFlip)
     84
    8385{
    8486    SurfaceFlags flags = 0;
     
    9395        flags = Buffered;
    9496    }
    95 #else
    96     noSystemBackground = widget && widget->testAttribute(Qt::WA_NoSystemBackground);
    97     if (noSystemBackground)
    98         flags &= ~Opaque;
    9997#endif
    10098    setSurfaceFlags(flags);
     
    135133        qFatal("QDirectFBWindowSurface: Unable to get primary display layer!");
    136134
     135
     136
    137137    DFBWindowDescription description;
    138138    memset(&description, 0, sizeof(DFBWindowDescription));
    139139
     140
    140141    description.caps = DWCAPS_NODECORATION;
    141     description.flags = DWDESC_CAPS|DWDESC_SURFACE_CAPS|DWDESC_PIXELFORMAT|DWDESC_HEIGHT|DWDESC_WIDTH|DWDESC_POSX|DWDESC_POSY;
    142 #if (Q_DIRECTFB_VERSION >= 0x010200)
    143     description.flags |= DWDESC_OPTIONS;
    144 #endif
    145 
    146     if (noSystemBackground) {
     142    description.surface_caps = DSCAPS_NONE;
     143    imageFormat = screen->pixelFormat();
     144
     145    if (!(surfaceFlags() & Opaque)) {
     146        imageFormat = screen->alphaPixmapFormat();
    147147        description.caps |= DWCAPS_ALPHACHANNEL;
    148148#if (Q_DIRECTFB_VERSION >= 0x010200)
     149
    149150        description.options |= DWOP_ALPHACHANNEL;
    150151#endif
    151152    }
    152 
     153    description.pixelformat = QDirectFBScreen::getSurfacePixelFormat(imageFormat);
    153154    description.posx = rect.x();
    154155    description.posy = rect.y();
    155156    description.width = rect.width();
    156157    description.height = rect.height();
    157     description.surface_caps = DSCAPS_NONE;
     158
     159    if (QDirectFBScreen::isPremultiplied(imageFormat))
     160        description.surface_caps = DSCAPS_PREMULTIPLIED;
     161
    158162    if (screen->directFBFlags() & QDirectFBScreen::VideoOnly)
    159163        description.surface_caps |= DSCAPS_VIDEOONLY;
    160     const QImage::Format format = (noSystemBackground ? screen->alphaPixmapFormat() : screen->pixelFormat());
    161     description.pixelformat = QDirectFBScreen::getSurfacePixelFormat(format);
    162     if (QDirectFBScreen::isPremultiplied(format))
    163         description.surface_caps = DSCAPS_PREMULTIPLIED;
    164164
    165165    DFBResult result = layer->CreateWindow(layer, &description, &dfbWindow);
     
    183183    Q_ASSERT(!dfbSurface);
    184184    dfbWindow->GetSurface(dfbWindow, &dfbSurface);
    185     updateFormat();
    186185}
    187186
     
    268267        } else { // mode == Offscreen
    269268            if (!dfbSurface) {
    270                 dfbSurface = screen->createDFBSurface(rect.size(), screen->pixelFormat(), QDirectFBScreen::DontTrackSurface);
     269                dfbSurface = screen->createDFBSurface(rect.size(), surfaceFlags() & Opaque ? screen->pixelFormat() : screen->alphaPixmapFormat(),
     270                                                      QDirectFBScreen::DontTrackSurface);
    271271            }
    272272        }
     
    275275#endif
    276276    }
    277     if (oldSurface != dfbSurface)
    278         updateFormat();
     277    if (oldSurface != dfbSurface) {
     278        imageFormat = dfbSurface ? QDirectFBScreen::getImageFormat(dfbSurface) : QImage::Format_Invalid;
     279    }
    279280
    280281    if (oldRect.size() != rect.size()) {
     
    297298        sibling = *reinterpret_cast<QDirectFBWindowSurface *const*>(state.constData());
    298299        Q_ASSERT(sibling);
    299         sibling->setSurfaceFlags(surfaceFlags());
    300     }
    301 }
    302 
    303 static inline void scrollSurface(IDirectFBSurface *surface, const QRect &r, int dx, int dy)
    304 {
     300        setSurfaceFlags(sibling->surfaceFlags());
     301    }
     302}
     303
     304bool QDirectFBWindowSurface::scroll(const QRegion &region, int dx, int dy)
     305{
     306    if (!dfbSurface || !(flipFlags & DSFLIP_BLIT) || region.rectCount() != 1)
     307        return false;
     308    if (flushPending) {
     309        dfbSurface->Flip(dfbSurface, 0, DSFLIP_BLIT);
     310    } else {
     311        flushPending = true;
     312    }
     313    dfbSurface->SetBlittingFlags(dfbSurface, DSBLIT_NOFX);
     314    const QRect r = region.boundingRect();
    305315    const DFBRectangle rect = { r.x(), r.y(), r.width(), r.height() };
    306     surface->Blit(surface, surface, &rect, r.x() + dx, r.y() + dy);
    307     const DFBRegion region = { rect.x + dx, rect.y + dy, r.right() + dx, r.bottom() + dy };
    308     surface->Flip(surface, &region, DSFLIP_BLIT);
    309 }
    310 
    311 bool QDirectFBWindowSurface::scroll(const QRegion &region, int dx, int dy)
    312 {
    313     if (!dfbSurface || !(flipFlags & DSFLIP_BLIT) || region.isEmpty())
    314         return false;
    315     dfbSurface->SetBlittingFlags(dfbSurface, DSBLIT_NOFX);
    316     if (region.rectCount() == 1) {
    317         scrollSurface(dfbSurface, region.boundingRect(), dx, dy);
    318     } else {
    319         const QVector<QRect> rects = region.rects();
    320         const int n = rects.size();
    321         for (int i=0; i<n; ++i) {
    322             scrollSurface(dfbSurface, rects.at(i), dx, dy);
    323         }
    324     }
     316    dfbSurface->Blit(dfbSurface, dfbSurface, &rect, r.x() + dx, r.y() + dy);
    325317    return true;
    326318}
     
    360352    const QRect windowGeometry = geometry();
    361353#ifdef QT_DIRECTFB_WM
    362     const bool wasNoSystemBackground = noSystemBackground;
    363     noSystemBackground = win->testAttribute(Qt::WA_NoSystemBackground);
    364354    quint8 currentOpacity;
    365355    Q_ASSERT(dfbWindow);
     
    369359    }
    370360
    371     setOpaque(noSystemBackground || windowOpacity != 0xff);
    372     if (wasNoSystemBackground != noSystemBackground) {
    373         releaseSurface();
    374         dfbWindow->Release(dfbWindow);
    375         dfbWindow = 0;
    376         createWindow(windowGeometry);
    377         win->update();
    378         return;
    379     }
    380361    screen->flipSurface(dfbSurface, flipFlags, region, offset);
    381362#else
    382     setOpaque(windowOpacity != 0xff);
     363    setOpaque(windowOpacity = 0xff);
    383364    if (mode == Offscreen) {
    384365        screen->exposeRegion(region.translated(offset + geometry().topLeft()), 0);
     
    397378    }
    398379#endif
     380
    399381}
    400382
     
    404386        engine = new QDirectFBPaintEngine(this);
    405387    }
     388
    406389}
    407390
     
    443426}
    444427
    445 void QDirectFBWindowSurface::updateFormat()
    446 {
    447     imageFormat = dfbSurface ? QDirectFBScreen::getImageFormat(dfbSurface) : QImage::Format_Invalid;
    448 }
    449 
    450428void QDirectFBWindowSurface::releaseSurface()
    451429{
     
    466444}
    467445
     446
     447
     448
     449
     450
     451
     452
     453
     454
     455
     456
     457
     458
     459
     460
     461
     462
     463
     464
     465
     466
     467
     468
     469
     470
     471
     472
     473
     474
     475
    468476
    469477QT_END_NAMESPACE
    470478
    471479#endif // QT_NO_QWS_DIRECTFB
    472 
    473 
  • trunk/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.h

    r651 r769  
    9898#endif
    9999private:
     100
    100101    void setOpaque(bool opaque);
    101     void updateFormat();
    102102    void releaseSurface();
    103103    QDirectFBWindowSurface *sibling;
     
    114114
    115115    DFBSurfaceFlipFlags flipFlags;
    116     bool noSystemBackground;
    117116    bool boundingRectFlip;
     117
    118118#ifdef QT_DIRECTFB_TIMING
    119119    int frames;
  • trunk/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglscreen.cpp

    r651 r769  
    260260        return 0;
    261261    return 90 * static_cast<const QTransformedScreen *>(parent)
    262                     ->transformation();
     262                    ->transformation();
    263263}
    264264
  • trunk/src/plugins/gfxdrivers/vnc/qscreenvnc_qws.cpp

    r651 r769  
    326326    { 0xffe9, Qt::Key_Alt       },
    327327    { 0xffea, Qt::Key_Alt       },
     328
     329
     330
     331
     332
     333
     334
     335
     336
     337
     338
     339
     340
     341
     342
     343
     344
     345
     346
     347
     348
     349
     350
     351
     352
     353
     354
     355
     356
     357
    328358    { 0, 0 }
    329359};
     
    484514        i++;
    485515    }
     516
     517
     518
     519
    486520    if (!keycode) {
    487521        if (key <= 0xff) {
     
    21302164        const int id = getDisplayId(dspec);
    21312165        QScreen *s = qt_get_screen(id, dspec.toLatin1().constData());
     2166
     2167
     2168
    21322169        setScreen(s);
    21332170    } else { // create virtual screen
Note: See TracChangeset for help on using the changeset viewer.