Changeset 712
- Timestamp:
- Apr 27, 2010, 4:15:04 PM (16 years ago)
- File:
-
- 1 edited
-
trunk/src/gui/painting/qwindowsurface_pm.cpp (modified) (11 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/gui/painting/qwindowsurface_pm.cpp
r710 r712 42 42 ****************************************************************************/ 43 43 44 #include "qt_os2.h" 45 #include "qlibrary.h" 44 #include <qdebug.h> 45 46 //#define QDIVE_DEBUG 47 48 #if defined QDIVE_DEBUG 49 #define DEBUG(a) qDebug a 50 #define DEBUG_VAR(v) DEBUG(() << #v << v) 51 #define DEBUG_VAR_HEX(v) DEBUG(() << #v << qDebugFmtHex(v)) 52 #else 53 #define DEBUG(a) do {} while(0) 54 #define DEBUG_VAR(v) do {} while(0) 55 #define DEBUG_VAR_HEX(v) do {} while(0) 56 #endif 57 58 #include <qt_os2.h> 59 #include <qlibrary.h> 46 60 47 61 #include "qwindowsurface_pm_p.h" 48 62 #include "private/qnativeimage_p.h" 49 50 #include "qdebug.h"51 63 52 64 //////////////////////////////////////////////////////////////////////////////// … … 77 89 #define DIVE_BUFFER_GRAPHICS_PLANE 0x00000001 78 90 #define DIVE_BUFFER_ALTERNATE_PLANE 0x00000002 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 79 114 80 115 typedef struct _SETUP_BLITTER { … … 140 175 141 176 static 177 178 179 180 142 181 ULONG (APIENTRY *DiveOpen) ( HDIVE *phDiveInst, 143 182 BOOL fNonScreenInstance, … … 186 225 static struct { const char *name; void **entry; } diveDllFuncs[] = 187 226 { 227 188 228 FUNC_ENTRY(DiveOpen), 189 229 FUNC_ENTRY(DiveSetupBlitter), … … 200 240 static bool diveDllOK = false; 201 241 242 243 202 244 //////////////////////////////////////////////////////////////////////////////// 203 245 204 246 QT_BEGIN_NAMESPACE 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 205 279 206 280 struct QPMDiveWindowSurfacePrivate … … 235 309 memset(&d->setup, 0, sizeof(SETUP_BLITTER)); 236 310 237 // Note that DiveBlitImage() seems to ignore fccSrcColorFormat and 238 // fccSrcColorFormat which is not a big surprise because both values are 239 // known (the source color format is specified at buffer creation time 240 // and the screen color format is always known). Also note that specifying 241 // values other than FOURCC_LUT8/R565/BGR3 causes a crash in DiveBlitImage() 242 // no matter what the actual source format is. FOURCC_SCRN seems to work. 243 d->setup.fccSrcColorFormat = FOURCC_SCRN; 311 // note that fccSrcColorFormat overrides the value specified during the 312 // source buffer creation, so they must match 313 d->setup.fccSrcColorFormat = fourccScreenToBuffer(diveCaps.fccColorEncoding); 244 314 d->setup.fccDstColorFormat = FOURCC_SCRN; 245 315 … … 296 366 void QPMDiveWindowSurface::doFlush(const QRect &from, const QPoint &to) 297 367 { 298 #if 0 299 qDebug() << "QPMDiveWindowSurface::doFlush:" << window() 300 << "from" << from << "to" << to; 301 #endif 368 DEBUG(() << "QPMDiveWindowSurface::doFlush:" << window() 369 << "from" << from << "to" << to); 302 370 303 371 // make sure from doesn't exceed the backing storage size (it may happen … … 320 388 d->setup.lScreenPosY = ptl.y; 321 389 d->setup.ulStructLen = offsetof(SETUP_BLITTER, ulNumDstRects); 390 391 392 322 393 } 323 394 … … 353 424 GpiDestroyRegion(hps, hrgn); 354 425 window()->releasePS(hps); 426 427 428 429 430 431 355 432 } 356 433 … … 441 518 QImage *oldImage = d->image; 442 519 443 d->image = new QImage(width, height, QImage::Format_RGB32); 520 QImage::Format format = fourccToFormat(d->setup.fccSrcColorFormat); 521 Q_ASSERT(format != QImage::Format_Invalid); 522 d->image = new QImage(width, height, format); 444 523 445 524 // associate the image data pointer with the buffer number 446 525 DiveFreeImageBuffer(d->hDive, d->bufNum); 447 526 d->bufNum = 0; 448 ULONG rc = DiveAllocImageBuffer(d->hDive, &d->bufNum, FOURCC_BGR4, 527 ULONG rc = DiveAllocImageBuffer(d->hDive, &d->bufNum, 528 d->setup.fccSrcColorFormat, 449 529 width, height, 450 530 d->image->bytesPerLine(), 451 531 (PBYTE)const_cast<const QImage *>(d->image)->bits()); 452 453 532 if (rc != DIVE_SUCCESS) { 454 533 qWarning("QPMDiveWindowSurface::setGeometry: DiveAllocImageBuffer " … … 528 607 } 529 608 } 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 530 642 } 531 643
Note:
See TracChangeset
for help on using the changeset viewer.
