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();