Changeset 62
- Timestamp:
- Feb 22, 2006, 10:17:33 AM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kernel/qpainter_pm.cpp
r61 r62 1143 1143 } 1144 1144 qt_geom_line_handle gh; 1145 qt_begin_geom_line( hps, COLOR_VALUE(cpen.color()), cpen.style() == NoPen, &gh ); 1145 qt_begin_geom_line( hps, COLOR_VALUE(cpen.color()), 1146 cpen.style() == NoPen, &gh ); 1146 1147 1147 1148 GpiMove( hps, &sptl ); … … 1309 1310 } 1310 1311 1312 static void doDrawRect( HPS hps, int x, int y, int w, int h, int axr, int ayr ) 1313 { 1314 const FIXED RightAngle = MAKEFIXED(90,0); 1315 const FIXED One = MAKEFIXED(1,0); 1316 1317 // top/right coordinates are inclusive 1318 -- w; 1319 -- h; 1320 1321 // beginning of the bottom side 1322 POINTL ptl = { x + axr, y }; 1323 GpiMove( hps, &ptl ); 1324 // center of the bottom-right arc 1325 ptl.x = x + w - axr; ptl.y = y + ayr; 1326 GpiPartialArc( hps, &ptl, One, MAKEFIXED(270,0), RightAngle ); 1327 // center of the top-right arc 1328 /* ptl.x = x + w - axr; */ ptl.y = y + h - ayr; 1329 GpiPartialArc( hps, &ptl, One, MAKEFIXED(0,0), RightAngle ); 1330 // center of the top-left arc 1331 ptl.x = x + axr; /* ptl.y = y + h - ayr; */ 1332 GpiPartialArc( hps, &ptl, One, RightAngle, RightAngle ); 1333 // center of the bottom-left arc 1334 /* ptl.x = x + axr; */ ptl.y = y + ayr; 1335 GpiPartialArc( hps, &ptl, One, MAKEFIXED(180,0), RightAngle ); 1336 } 1311 1337 1312 1338 void QPainter::drawRectInternal( … … 1319 1345 } 1320 1346 1321 POINTL ptl1 = { x, y }; 1322 if ( devh ) ptl1.y = devh - ( ptl1.y + h ); 1323 POINTL ptl2 = { x + w - 1, ptl1.y + h - 1 }; 1324 1347 // GpiBox API is buggy when it comes to rounded corners 1348 // combined with filling the interior (see ticket:16). 1349 // The fix is to draw rounded corners ourselves. 1350 1351 if ( wRnd == 0 || hRnd == 0 ) { 1352 POINTL ptl1 = { x, y }; 1353 if ( devh ) ptl1.y = devh - ( ptl1.y + h ); 1354 POINTL ptl2 = { x + w - 1, ptl1.y + h - 1 }; 1355 if ( cpen.width() > 1 ) { 1356 GpiMove( hps, &ptl1 ); 1357 GpiBox( hps, DRO_FILL, &ptl2, wRnd, hRnd ); 1358 qt_geom_line_handle gh; 1359 qt_begin_geom_line( hps, COLOR_VALUE(cpen.color()), 1360 cpen.style() == NoPen, &gh ); 1361 GpiMove( hps, &ptl1 ); 1362 GpiBox( hps, DRO_OUTLINE, &ptl2, 0, 0 ); 1363 qt_end_geom_line( hps, &gh ); 1364 } else { 1365 GpiMove( hps, &ptl1 ); 1366 GpiBox( hps, DRO_FILL | DRO_OUTLINE, &ptl2, 0, 0 ); 1367 } 1368 return; 1369 } 1370 1371 // flip y coordinate 1372 if ( devh ) y = devh - ( y + h ); 1373 1374 int axr = (wRnd - 1) / 2; 1375 int ayr = (hRnd - 1) / 2; 1376 ARCPARAMS arcparams = { axr, ayr, 0, 0 }; 1377 GpiSetArcParams( hps, &arcparams ); 1378 1325 1379 if ( cpen.width() > 1 ) { 1326 GpiMove( hps, &ptl1 ); 1327 GpiBox( hps, DRO_FILL, &ptl2, wRnd, hRnd ); 1380 GpiBeginArea( hps, BA_NOBOUNDARY | BA_ALTERNATE ); 1381 doDrawRect( hps, x, y, w, h, axr, ayr ); 1382 GpiEndArea( hps ); 1328 1383 qt_geom_line_handle gh; 1329 qt_begin_geom_line( hps, COLOR_VALUE(cpen.color()), cpen.style() == NoPen, &gh ); 1330 GpiMove( hps, &ptl1 ); 1331 GpiBox( hps, DRO_OUTLINE, &ptl2, wRnd, hRnd ); 1384 qt_begin_geom_line( hps, COLOR_VALUE(cpen.color()), 1385 cpen.style() == NoPen, &gh ); 1386 doDrawRect( hps, x, y, w, h, axr, ayr ); 1387 GpiCloseFigure( hps ); 1332 1388 qt_end_geom_line( hps, &gh ); 1333 1389 } else { 1334 GpiMove( hps, &ptl1 ); 1335 GpiBox( hps, DRO_FILL | DRO_OUTLINE, &ptl2, wRnd, hRnd ); 1390 GpiBeginArea( hps, BA_BOUNDARY | BA_ALTERNATE ); 1391 doDrawRect( hps, x, y, w, h, axr, ayr ); 1392 GpiEndArea( hps ); 1336 1393 } 1337 1394 } … … 1467 1524 if ( w <= 0 || h <= 0 ) 1468 1525 fix_neg_rect( &x, &y, &w, &h ); 1469 w--;1470 h--;1471 1526 int rxx = w*xRnd/200; 1472 1527 int ryy = h*yRnd/200; … … 1499 1554 } 1500 1555 1501 drawRectInternal( x, y, w, h, w*xRnd/ 100, h*yRnd/100);1556 drawRectInternal( x, y, w, h, w*xRnd/99, h*yRnd/99 ); 1502 1557 } 1503 1558
Note:
See TracChangeset
for help on using the changeset viewer.