diff os2/dw.c @ 1275:0b34e2cf0706

Updated dw_draw_rect and dw_draw_polygon to accept flags the same way as dw_draw_arc. The fill parameter has been replaced by flags which should be backwards compatible. Also updated the source comments to reflect these changes.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Sun, 30 Oct 2011 10:14:49 +0000
parents 885b55c0d7d7
children 1cdc18d760e0
line wrap: on
line diff
--- a/os2/dw.c	Sun Oct 30 02:13:47 2011 +0000
+++ b/os2/dw.c	Sun Oct 30 10:14:49 2011 +0000
@@ -8557,13 +8557,13 @@
  * Parameters:
  *       handle: Handle to the window.
  *       pixmap: Handle to the pixmap. (choose only one of these)
- *       fill: Fill box TRUE or FALSE.
+ *       flags: DW_DRAW_FILL (1) to fill the polygon or DW_DRAW_DEFAULT (0).
  *       x: X coordinate.
  *       y: Y coordinate.
  *       width: Width of rectangle.
  *       height: Height of rectangle.
  */
-void API dw_draw_polygon( HWND handle, HPIXMAP pixmap, int fill, int npoints, int *x, int *y )
+void API dw_draw_polygon( HWND handle, HPIXMAP pixmap, int flags, int npoints, int *x, int *y )
 {
    HPS hps;
    int thisheight;
@@ -8591,7 +8591,7 @@
    /*
     * For a filled polygon we need to start an area
     */
-   if ( fill )
+   if ( flags & DW_DRAW_FILL )
       GpiBeginArea( hps, 0L );
    if ( npoints )
    {
@@ -8611,7 +8611,7 @@
       }
       GpiPolyLine( hps, npoints-1, pptl );
 
-      if ( fill )
+      if ( flags & DW_DRAW_FILL )
          GpiEndArea( hps );
    }
    if ( !pixmap )
@@ -8623,7 +8623,7 @@
  * Parameters:
  *       handle: Handle to the window.
  *       pixmap: Handle to the pixmap. (choose only one of these)
- *       fill: Fill box TRUE or FALSE.
+ *       flags: DW_DRAW_FILL (1) to fill the box or DW_DRAW_DEFAULT (0).
  *       x: X coordinate.
  *       y: Y coordinate.
  *       width: Width of rectangle.
@@ -8653,8 +8653,13 @@
    ptl[1].x = x + width - 1;
    ptl[1].y = thisheight - y - height;
 
+   /* For a filled arc we need to start an area */
+   if(flags & DW_DRAW_FILL)
+       GpiBeginArea(hps, 0L);
    GpiMove(hps, &ptl[0]);
    GpiBox(hps, fill ? DRO_OUTLINEFILL : DRO_OUTLINE, &ptl[1], 0, 0);
+   if(flags & DW_DRAW_FILL)
+       GpiEndArea(hps);
 
    if(!pixmap)
       WinReleasePS(hps);
@@ -8669,7 +8674,8 @@
  * Parameters:
  *       handle: Handle to the window.
  *       pixmap: Handle to the pixmap. (choose only one of these)
- *       flags: For future use.
+ *       flags: DW_DRAW_FILL (1) to fill the arc or DW_DRAW_DEFAULT (0).
+ *              DW_DRAW_FULL will draw a complete circle/elipse.
  *       xorigin: X coordinate of center of arc.
  *       yorigin: Y coordinate of center of arc.
  *       x1: X coordinate of first segment of arc.
@@ -8690,7 +8696,7 @@
    if(flags & DW_DRAW_FULL)
    {
        /* Draw one half... */
-	   dw_draw_arc(handle, pixmap, flags & ~DW_DRAW_FULL, xorigin, yorigin, x2, y2, x1, y1);
+    dw_draw_arc(handle, pixmap, flags & ~DW_DRAW_FULL, xorigin, yorigin, x2, y2, x1, y1);
        /* ... then continue to draw the other half */
    }
 
@@ -8707,7 +8713,7 @@
    else
       return;
 
-   /* For a filled polygon we need to start an area */
+   /* For a filled arc we need to start an area */
    if(flags & DW_DRAW_FILL)
        GpiBeginArea(hps, 0L);
    /* Setup the arc info on the presentation space */