Changeset 61 for trunk/src/kernel/qwidget_pm.cpp
- Timestamp:
- Feb 6, 2006, 10:43:39 PM (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kernel/qwidget_pm.cpp
r57 r61 973 973 WinValidateRect( winId(), &rcl, FALSE ); 974 974 975 QRegion *pcrgn = 0; 975 Q_ASSERT( !WinQueryWindowULong( winId(), QWL_QTCLIPRGN ) ); 976 QRegion reg; 976 977 if ( r != rect() ) { 977 pcrgn = newQRegion( r );978 WinSetWindowULong( winId(), QWL_QTCLIPRGN, (ULONG) pcrgn);978 reg = QRegion( r ); 979 WinSetWindowULong( winId(), QWL_QTCLIPRGN, (ULONG) ® ); 979 980 } 980 981 … … 984 985 QApplication::sendEvent( this, &e ); 985 986 986 if ( pcrgn ) { 987 WinSetWindowULong( winId(), QWL_QTCLIPRGN, 0 ); 988 delete pcrgn; 989 } 987 WinSetWindowULong( winId(), QWL_QTCLIPRGN, 0 ); 990 988 } 991 989 } … … 1000 998 #endif 1001 999 // convert region y coordinates from Qt to GPI (see qregion_pm.cpp) 1002 POINTL ptl = { 0, height() }; 1003 GpiOffsetRegion( qt_display_ps(), reg.handle(), &ptl ); 1004 WinValidateRegion( winId(), reg.handle(), FALSE ); 1005 // convert region y coordinates back from GPI to Qt 1006 ptl.y = -ptl.y; 1007 GpiOffsetRegion( qt_display_ps(), reg.handle(), &ptl ); 1008 1009 QRegion *pcrgn = new QRegion( reg ); 1010 WinSetWindowULong( winId(), QWL_QTCLIPRGN, (ULONG) pcrgn ); 1000 WinValidateRegion( winId(), reg.handle( height() ), FALSE ); 1001 1002 Q_ASSERT( !WinQueryWindowULong( winId(), QWL_QTCLIPRGN ) ); 1003 WinSetWindowULong( winId(), QWL_QTCLIPRGN, (ULONG) ® ); 1011 1004 1012 1005 QPaintEvent e( reg, erase ); … … 1016 1009 1017 1010 WinSetWindowULong( winId(), QWL_QTCLIPRGN, 0 ); 1018 delete pcrgn;1019 1011 } 1020 1012 } … … 1413 1405 } else if ( !hps ) { 1414 1406 tmphps = TRUE; 1415 lhps = WinGetPS( winId());1407 lhps = getTargetPS(); 1416 1408 } else { 1417 1409 tmphps = FALSE; … … 1428 1420 ); 1429 1421 1430 if ( tmphps ) {1422 if ( tmphps ) 1431 1423 WinReleasePS( lhps ); 1432 hps = 0;1433 }1434 1424 } 1435 1425 … … 1450 1440 } else if ( !hps ) { 1451 1441 tmphps = TRUE; 1452 lhps = WinGetPS( winId());1442 lhps = getTargetPS(); 1453 1443 } else { 1454 1444 tmphps = FALSE; 1455 1445 lhps = hps; 1456 1446 } 1457 1458 // convert region y coordinates from Qt to GPI (see qregion_pm.cpp)1459 POINTL ptl = { 0, height() };1460 GpiOffsetRegion( lhps, rgn.handle(), &ptl );1461 1447 1462 1448 HRGN oldRegion = GpiQueryClipRegion( lhps ); … … 1465 1451 GpiSetClipRegion( lhps, 0, NULL ); 1466 1452 newRegion = GpiCreateRegion( lhps, 0, NULL ); 1467 GpiCombineRegion( lhps, newRegion, oldRegion, rgn.handle(), CRGN_AND ); 1453 GpiCombineRegion( lhps, newRegion, oldRegion, rgn.handle( height() ), 1454 CRGN_AND ); 1468 1455 } else { 1469 newRegion = rgn.handle( );1456 newRegion = rgn.handle( height() ); 1470 1457 } 1471 1458 GpiSetClipRegion( lhps, newRegion, &oldRegion ); … … 1482 1469 GpiSetClipRegion( lhps, oldRegion, NULL ); 1483 1470 1484 // convert region y coordinates back from GPI to Qt1485 ptl.y = -ptl.y;1486 GpiOffsetRegion( lhps, rgn.handle(), &ptl );1487 1488 1471 if ( oldRegion ) 1489 1472 GpiDestroyRegion( lhps, newRegion ); 1490 if ( tmphps ) {1473 if ( tmphps ) 1491 1474 WinReleasePS( lhps ); 1492 hps = 0;1493 }1494 1475 } 1495 1476 … … 1882 1863 } 1883 1864 1865 /*! 1866 * \internal 1867 * 1868 * Obtains a presentaiton space to draw on this widget, set up according 1869 * to widget flags. If \a m != Unclipped and WPaintUnclipped flag is not 1870 * set, a clip region is set on the returned PS according to \a m. 1871 * 1872 * The returned handle must be freed using WinReleasePS() after usage. 1873 */ 1874 HPS QWidget::getTargetPS( ClipMode m /* = ClipAll */ ) 1875 { 1876 HPS widgetPS = 0; 1877 1878 if ( isDesktop() ) { 1879 widgetPS = WinGetScreenPS( HWND_DESKTOP ); 1880 } else { 1881 if ( m == Unclipped || testWFlags( WPaintUnclipped ) ) { 1882 widgetPS = WinGetClipPS( winId(), 0, PSF_PARENTCLIP ); 1883 } else { 1884 widgetPS = WinGetPS( winId() ); 1885 } 1886 } 1887 1888 return widgetPS; 1889 } 1890
Note:
See TracChangeset
for help on using the changeset viewer.