Mercurial > dwindows
comparison os2/dw.c @ 1780:d1f65efea6b1
Minor OS/2 cleanup while looking for a weird bug in
dw_font_text_extents_get() while autosizing....
Make sure cleanup codepaths are the same as setup.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Thu, 19 Jul 2012 09:25:13 +0000 |
parents | 0cdfb0c3f4ca |
children | a532ca0231ad |
comparison
equal
deleted
inserted
replaced
1779:f77b76c86d19 | 1780:d1f65efea6b1 |
---|---|
10448 POINTL ptl; | 10448 POINTL ptl; |
10449 | 10449 |
10450 if(handle) | 10450 if(handle) |
10451 { | 10451 { |
10452 hps = _set_colors(handle); | 10452 hps = _set_colors(handle); |
10453 height = _get_height(handle); | 10453 height = _get_height(handle); |
10454 } | 10454 } |
10455 else if(pixmap) | 10455 else if(pixmap) |
10456 { | 10456 { |
10457 hps = _set_hps(pixmap->hps); | 10457 hps = _set_hps(pixmap->hps); |
10458 height = pixmap->height; | 10458 height = pixmap->height; |
10462 | 10462 |
10463 ptl.x = x; | 10463 ptl.x = x; |
10464 ptl.y = height - y - 1; | 10464 ptl.y = height - y - 1; |
10465 | 10465 |
10466 GpiSetPel(hps, &ptl); | 10466 GpiSetPel(hps, &ptl); |
10467 if(!pixmap) | 10467 if(handle) |
10468 WinReleasePS(hps); | 10468 WinReleasePS(hps); |
10469 } | 10469 } |
10470 | 10470 |
10471 /* Draw a line on a window (preferably a render window). | 10471 /* Draw a line on a window (preferably a render window). |
10472 * Parameters: | 10472 * Parameters: |
10484 POINTL ptl[2]; | 10484 POINTL ptl[2]; |
10485 | 10485 |
10486 if(handle) | 10486 if(handle) |
10487 { | 10487 { |
10488 hps = _set_colors(handle); | 10488 hps = _set_colors(handle); |
10489 height = _get_height(handle); | 10489 height = _get_height(handle); |
10490 } | 10490 } |
10491 else if(pixmap) | 10491 else if(pixmap) |
10492 { | 10492 { |
10493 hps = _set_hps(pixmap->hps); | 10493 hps = _set_hps(pixmap->hps); |
10494 height = pixmap->height; | 10494 height = pixmap->height; |
10502 ptl[1].y = height - y2 - 1; | 10502 ptl[1].y = height - y2 - 1; |
10503 | 10503 |
10504 GpiMove(hps, &ptl[0]); | 10504 GpiMove(hps, &ptl[0]); |
10505 GpiLine(hps, &ptl[1]); | 10505 GpiLine(hps, &ptl[1]); |
10506 | 10506 |
10507 if(!pixmap) | 10507 if(handle) |
10508 WinReleasePS(hps); | 10508 WinReleasePS(hps); |
10509 } | 10509 } |
10510 | 10510 |
10511 | 10511 |
10512 void _CopyFontSettings(HPS hpsSrc, HPS hpsDst) | 10512 void _CopyFontSettings(HPS hpsSrc, HPS hpsDst) |
10513 { | 10513 { |
10585 if(_background == DW_CLR_DEFAULT) | 10585 if(_background == DW_CLR_DEFAULT) |
10586 WinDrawText(hps, -1, (PCH)text, &rcl, DT_TEXTATTRS, DT_TEXTATTRS, DT_VCENTER | DT_LEFT | DT_TEXTATTRS); | 10586 WinDrawText(hps, -1, (PCH)text, &rcl, DT_TEXTATTRS, DT_TEXTATTRS, DT_VCENTER | DT_LEFT | DT_TEXTATTRS); |
10587 else | 10587 else |
10588 WinDrawText(hps, -1, (PCH)text, &rcl, _internal_color(_foreground), _internal_color(_background), DT_VCENTER | DT_LEFT | DT_ERASERECT); | 10588 WinDrawText(hps, -1, (PCH)text, &rcl, _internal_color(_foreground), _internal_color(_background), DT_VCENTER | DT_LEFT | DT_ERASERECT); |
10589 | 10589 |
10590 if(!pixmap) | 10590 if(handle) |
10591 WinReleasePS(hps); | 10591 WinReleasePS(hps); |
10592 } | 10592 } |
10593 | 10593 |
10594 /* Query the width and height of a text string. | 10594 /* Query the width and height of a text string. |
10595 * Parameters: | 10595 * Parameters: |
10625 *width = aptl[TXTBOX_TOPRIGHT].x - aptl[TXTBOX_TOPLEFT].x; | 10625 *width = aptl[TXTBOX_TOPRIGHT].x - aptl[TXTBOX_TOPLEFT].x; |
10626 | 10626 |
10627 if(height) | 10627 if(height) |
10628 *height = aptl[TXTBOX_TOPLEFT].y - aptl[TXTBOX_BOTTOMLEFT].y; | 10628 *height = aptl[TXTBOX_TOPLEFT].y - aptl[TXTBOX_BOTTOMLEFT].y; |
10629 | 10629 |
10630 if(!pixmap) | 10630 if(handle) |
10631 WinReleasePS(hps); | 10631 WinReleasePS(hps); |
10632 } | 10632 } |
10633 | 10633 |
10634 /* Draw a polygon on a window (preferably a render window). | 10634 /* Draw a polygon on a window (preferably a render window). |
10635 * Parameters: | 10635 * Parameters: |
10690 GpiPolyLine( hps, npoints-1, pptl ); | 10690 GpiPolyLine( hps, npoints-1, pptl ); |
10691 | 10691 |
10692 if ( flags & DW_DRAW_FILL ) | 10692 if ( flags & DW_DRAW_FILL ) |
10693 GpiEndArea( hps ); | 10693 GpiEndArea( hps ); |
10694 } | 10694 } |
10695 if ( !pixmap ) | 10695 if(handle) |
10696 WinReleasePS(hps); | 10696 WinReleasePS(hps); |
10697 free( pptl ); | 10697 free( pptl ); |
10698 } | 10698 } |
10699 | 10699 |
10700 /* Draw a rectangle on a window (preferably a render window). | 10700 /* Draw a rectangle on a window (preferably a render window). |
10714 POINTL ptl[2]; | 10714 POINTL ptl[2]; |
10715 | 10715 |
10716 if(handle) | 10716 if(handle) |
10717 { | 10717 { |
10718 hps = _set_colors(handle); | 10718 hps = _set_colors(handle); |
10719 thisheight = _get_height(handle); | 10719 thisheight = _get_height(handle); |
10720 } | 10720 } |
10721 else if(pixmap) | 10721 else if(pixmap) |
10722 { | 10722 { |
10723 hps = _set_hps(pixmap->hps); | 10723 hps = _set_hps(pixmap->hps); |
10724 thisheight = pixmap->height; | 10724 thisheight = pixmap->height; |
10732 ptl[1].y = thisheight - y - height; | 10732 ptl[1].y = thisheight - y - height; |
10733 | 10733 |
10734 GpiMove(hps, &ptl[0]); | 10734 GpiMove(hps, &ptl[0]); |
10735 GpiBox(hps, (flags & DW_DRAW_FILL) ? DRO_OUTLINEFILL : DRO_OUTLINE, &ptl[1], 0, 0); | 10735 GpiBox(hps, (flags & DW_DRAW_FILL) ? DRO_OUTLINEFILL : DRO_OUTLINE, &ptl[1], 0, 0); |
10736 | 10736 |
10737 if(!pixmap) | 10737 if(handle) |
10738 WinReleasePS(hps); | 10738 WinReleasePS(hps); |
10739 } | 10739 } |
10740 | 10740 |
10741 /* VisualAge doesn't seem to have this */ | 10741 /* VisualAge doesn't seem to have this */ |
10742 #ifndef M_PI | 10742 #ifndef M_PI |
10818 GpiPointArc(hps, pts); | 10818 GpiPointArc(hps, pts); |
10819 if(flags & DW_DRAW_FILL) | 10819 if(flags & DW_DRAW_FILL) |
10820 GpiEndArea(hps); | 10820 GpiEndArea(hps); |
10821 } | 10821 } |
10822 | 10822 |
10823 if(!pixmap) | 10823 if(handle) |
10824 WinReleasePS(hps); | 10824 WinReleasePS(hps); |
10825 } | 10825 } |
10826 | 10826 |
10827 /* Call this after drawing to the screen to make sure | 10827 /* Call this after drawing to the screen to make sure |
10828 * anything you have drawn is visible. | 10828 * anything you have drawn is visible. |
11158 hpssrc = srcp->hps; | 11158 hpssrc = srcp->hps; |
11159 sheight = srcp->height; | 11159 sheight = srcp->height; |
11160 } | 11160 } |
11161 else | 11161 else |
11162 { | 11162 { |
11163 if(!destp) | 11163 if(dest) |
11164 WinReleasePS(hpsdest); | 11164 WinReleasePS(hpsdest); |
11165 return DW_ERROR_GENERAL; | 11165 return DW_ERROR_GENERAL; |
11166 } | 11166 } |
11167 | 11167 |
11168 ptl[0].x = xdest; | 11168 ptl[0].x = xdest; |
11194 { | 11194 { |
11195 /* Otherwise use the regular BitBlt call */ | 11195 /* Otherwise use the regular BitBlt call */ |
11196 GpiBitBlt(hpsdest, hpssrc, count, ptl, ROP_SRCCOPY, BBO_IGNORE); | 11196 GpiBitBlt(hpsdest, hpssrc, count, ptl, ROP_SRCCOPY, BBO_IGNORE); |
11197 } | 11197 } |
11198 | 11198 |
11199 if(!destp) | 11199 if(dest) |
11200 WinReleasePS(hpsdest); | 11200 WinReleasePS(hpsdest); |
11201 if(!srcp) | 11201 if(src) |
11202 WinReleasePS(hpssrc); | 11202 WinReleasePS(hpssrc); |
11203 return DW_ERROR_NONE; | 11203 return DW_ERROR_NONE; |
11204 } | 11204 } |
11205 | 11205 |
11206 /* Run DosBeep() in a separate thread so it doesn't block */ | 11206 /* Run DosBeep() in a separate thread so it doesn't block */ |