Changeset 437 for trunk/src


Ignore:
Timestamp:
Dec 23, 2009, 1:02:06 AM (15 years ago)
Author:
Dmitry A. Kuminov
Message:

gui: Implemented new blit mirroring method using undocumented GpiEnableYInversion() (QImage.mirrored() is still the default as it seems to show better performance, see #101 for more information).

Location:
trunk/src/gui
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/gui/kernel/qapplication_pm.cpp

    r434 r437  
    411411    extern unsigned long long qt_total_blit_ms;
    412412    extern unsigned long long qt_total_blit_pixels;
    413     printf("*** qt_total_blit_ms %llu\n"
    414            "*** qt_total_blit_pixels %llu\n"
    415            "*** speed %llu pixels/ms",
     413    printf("*** qt_total_blit_ms %llu\n"
     414           "*** qt_total_blit_pixels %llu\n"
     415           "*** ",
    416416           qt_total_blit_ms, qt_total_blit_pixels,
    417417           qt_total_blit_pixels / qt_total_blit_ms);
  • trunk/src/gui/painting/qwindowsurface_raster.cpp

    r308 r437  
    7070#endif
    7171
     72
     73
     74
     75
     76
     77
     78
     79
    7280QT_BEGIN_NAMESPACE
    7381
     
    225233#endif
    226234
    227 #if 1
     235#if QT_BITMAP_MIRROR == 1
     236
    228237    // flip the image vertically for PM
    229238    QImage img = d->image->image.mirrored();
     
    258267    GpiDrawBits(wps, (PVOID) img.bits(), (PBITMAPINFO2) &bmh, 4, ptls,
    259268                ROP_SRCCOPY, BBO_IGNORE);
    260 #else
     269
     270#elif QT_BITMAP_MIRROR == 2
     271
     272    QPoint wOffset = qt_qwidget_data(widget)->wrect.topLeft();
     273    QRect wbr = br.translated(-wOffset);
     274
     275    br.translate(offset);
     276
     277    BITMAPINFOHEADER2 bmh;
     278    memset(&bmh, 0, sizeof(BITMAPINFOHEADER2));
     279    bmh.cbFix = sizeof(BITMAPINFOHEADER2);
     280    bmh.cPlanes = 1;
     281    bmh.cBitCount = 32; // @todo support 8-bit indexed colors?
     282    bmh.cx = d->image->width();
     283    bmh.cy = d->image->height();
     284
     285    // Note: target is inclusive-inclusive, source is inclusive-exclusive
     286    POINTL ptls[] = { { wbr.left(), wbr.top() },
     287                      { wbr.right(), wbr.bottom() },
     288                      { br.left(), br.top() },
     289                      { br.right() + 1, br.bottom() + 1 } };
     290#if 0
     291    qDebug("QRasterWindowSurface::flush: [%s] ptls %ld,%ld-%ld,%ld %ld,%ld-%ld,%ld",
     292           qWidgetName(widget).toUtf8().constData(),
     293           ptls[0].x, ptls[0].y, ptls[1].x, ptls[1].y,
     294           ptls[2].x, ptls[2].y, ptls[3].x, ptls[3].y);
     295#endif
     296
     297    // setup the Y coordinate inversion (this seems to use the same GPI matrix
     298    // transformation internally as we do in method 3 below)
     299    LONG oldInversion = GpiQueryYInversion(wps);
     300    GpiEnableYInversion(wps, widget->height() - 1);
     301
     302    GpiDrawBits(wps, (PVOID) d->image->image.bits(), (PBITMAPINFO2) &bmh,
     303                4, ptls, ROP_SRCCOPY, BBO_IGNORE);
     304
     305    GpiEnableYInversion(wps, oldInversion);
     306
     307#elif QT_BITMAP_MIRROR == 3
     308
    261309    // use the reflection + transformation matrix to flip the y axis.
    262310    // This should be slower than flipping the image ourselves (unless this
     
    302350    const QImage img = d->image->image;
    303351#endif
     352
     353
     354
    304355#endif
    305356
Note: See TracChangeset for help on using the changeset viewer.