Ignore:
Timestamp:
May 31, 2010, 2:32:51 AM (15 years ago)
Author:
Dmitry A. Kuminov
Message:

gui: Fixed a typo that caused DIVE direct FB mode to be disabled for DIVE modes which did not have a direct Qt equivalent but could be converted using a color mapping table (see #159).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/gui/painting/qwindowsurface_pm.cpp

    r735 r742  
    255255static char *diveFrameBuf = NULL;
    256256static bool diveHideMouse = false;
     257static FOURCC diveBestBufFormat = 0;
    257258
    258259static LONG mousePtrSize = 0;
     
    294295// fourccToFormat(). If isFB is true, the selection is made for the direct
    295296// framebuffer access mode.
    296 static FOURCC fourccScreenToBuffer(FOURCC fourcc, bool isFB = false)
    297 {
    298     Q_UNUSED(isFB);
    299 
     297static FOURCC fourccScreenToBuffer(FOURCC fourcc, bool isFB)
     298{
    300299    // return it as is if supported by fourccToFormat()
    301300    if (fourccToFormat(fourcc) != QImage::Format_Invalid)
     
    313312
    314313    // in direct framebuffer access mode, we use BGR4 which should be faster
     314    // (note that our color conversion table built in QPMDiveWindowSurface::create()
     315    // only works with BGR4 for now so we must return it here otherwise the FB
     316    // mode will be disabled)
    315317    return FOURCC_BGR4;
    316318}
     
    361363    // note that fccSrcColorFormat overrides the value specified during the
    362364    // source buffer creation, so they must match
    363     d->setup.fccSrcColorFormat = fourccScreenToBuffer(diveCaps.fccColorEncoding);
     365    Q_ASSERT(diveBestBufFormat != 0);
     366    d->setup.fccSrcColorFormat = diveBestBufFormat;
    364367    d->setup.fccDstColorFormat = FOURCC_SCRN;
    365368
     
    768771                         << ((char*)&diveCaps.fccColorEncoding)[3]);
    769772
    770                 FOURCC bestBufFormat = fourccScreenToBuffer(diveCaps.fccColorEncoding);
    771                 DEBUG(() << "bestBufFormat"
    772                          << ((char*)&bestBufFormat)[0]
    773                          << ((char*)&bestBufFormat)[1]
    774                          << ((char*)&bestBufFormat)[2]
    775                          << ((char*)&bestBufFormat)[3]);
     773                diveBestBufFormat = fourccScreenToBuffer(diveCaps.fccColorEncoding,
     774                                                         diveUseFB);
     775                DEBUG(() << "diveBestBufFormat"
     776                         << ((char*)&diveBestBufFormat)[0]
     777                         << ((char*)&diveBestBufFormat)[1]
     778                         << ((char*)&diveBestBufFormat)[2]
     779                         << ((char*)&diveBestBufFormat)[3]);
    776780
    777781                if (diveUseFB) {
     
    781785                        diveUseFB = false;
    782786                    } else {
    783                         if (bestBufFormat == diveCaps.fccColorEncoding) {
     787                        if (diveBestBufFormat == diveCaps.fccColorEncoding) {
    784788                            // no color conversion is required
    785                         } else if (bestBufFormat == FOURCC_BGR4) {
     789                        } else if (diveBestBufFormat == FOURCC_BGR4) {
    786790                            // build the color conversion table
    787791                            switch (diveCaps.fccColorEncoding) {
     
    831835                        }
    832836                    }
     837
     838                    if (!diveUseFB) {
     839                        // we disabled FB, recalculate the best format
     840                        diveBestBufFormat = fourccScreenToBuffer(diveCaps.fccColorEncoding,
     841                                                                 diveUseFB);
     842                        DEBUG(() << "diveBestBufFormat (final)"
     843                                 << ((char*)&diveBestBufFormat)[0]
     844                                 << ((char*)&diveBestBufFormat)[1]
     845                                 << ((char*)&diveBestBufFormat)[2]
     846                                 << ((char*)&diveBestBufFormat)[3]);
     847                    }
    833848                }
    834849
    835850                if (!diveUseFB) {
    836                     FOURCC bestBufFormat =
    837                         fourccScreenToBuffer(diveCaps.fccColorEncoding);
    838                     DEBUG(() << "bestBufFormat"
    839                              << ((char*)&bestBufFormat)[0]
    840                              << ((char*)&bestBufFormat)[1]
    841                              << ((char*)&bestBufFormat)[2]
    842                              << ((char*)&bestBufFormat)[3]);
    843 
    844                     if (bestBufFormat == 0) {
     851                    if (diveBestBufFormat == 0) {
    845852                        // there is no working pixel format for the buffer for
    846853                        // DiveBlitImage() to work correctly with the current screen
Note: See TracChangeset for help on using the changeset viewer.