diff options
Diffstat (limited to 'generic/tkRectOval.c')
| -rw-r--r-- | generic/tkRectOval.c | 188 |
1 files changed, 94 insertions, 94 deletions
diff --git a/generic/tkRectOval.c b/generic/tkRectOval.c index 2bbfce8..8f2e385 100644 --- a/generic/tkRectOval.c +++ b/generic/tkRectOval.c @@ -79,8 +79,8 @@ static const Tk_ConfigSpec configSpecs[] = { NULL, offsetof(RectOvalItem, outline.dash), TK_CONFIG_NULL_OK, &dashOption}, {TK_CONFIG_PIXELS, "-dashoffset", NULL, NULL, - "0", offsetof(RectOvalItem, outline.offset), - TK_CONFIG_DONT_SET_DEFAULT, NULL}, + "0", offsetof(RectOvalItem, outline.offsetObj), + TK_CONFIG_OBJS, NULL}, {TK_CONFIG_CUSTOM, "-disableddash", NULL, NULL, NULL, offsetof(RectOvalItem, outline.disabledDash), TK_CONFIG_NULL_OK, &dashOption}, @@ -765,101 +765,101 @@ DisplayRectOval( &x2, &y2); if (x2 == x1) { - /* - * The width of the bounding box corresponds to less than one pixel - * on screen. Adjustment is needed to avoid drawing attempts with zero - * width items (which would draw nothing). The bounding box spans - * either 1 or 2 pixels. Select which pixel will be drawn. - */ - - short ix1 = (short) (rectOvalPtr->bbox[0]); - short ix2 = (short) (rectOvalPtr->bbox[2]); - - if (ix1 == ix2) { - - /* - * x1 and x2 are "within the same pixel". Use this pixel. - * Note: the degenerated case (bbox[0]==bbox[2]) of a completely - * flat box results in arbitrary selection of the pixel at the - * right (with positive coordinate) or left (with negative - * coordinate) of the box. There is no "best choice" here. - */ - - if (ix1 > 0) { - x2 += 1; - } else { - x1 -= 1; - } - } else { - - /* - * (x1,x2) span two pixels. Select the one with the larger - * covered "area". - */ - - if (ix1 > 0) { - if ((rectOvalPtr->bbox[2] - ix2) > (ix2 - rectOvalPtr->bbox[0])) { - x2 += 1; - } else { - x1 -= 1; - } - } else { - if ((rectOvalPtr->bbox[2] - ix1) > (ix1 - rectOvalPtr->bbox[0])) { - x2 += 1; - } else { - x1 -= 1; - } - } - } + /* + * The width of the bounding box corresponds to less than one pixel + * on screen. Adjustment is needed to avoid drawing attempts with zero + * width items (which would draw nothing). The bounding box spans + * either 1 or 2 pixels. Select which pixel will be drawn. + */ + + short ix1 = (short) (rectOvalPtr->bbox[0]); + short ix2 = (short) (rectOvalPtr->bbox[2]); + + if (ix1 == ix2) { + + /* + * x1 and x2 are "within the same pixel". Use this pixel. + * Note: the degenerated case (bbox[0]==bbox[2]) of a completely + * flat box results in arbitrary selection of the pixel at the + * right (with positive coordinate) or left (with negative + * coordinate) of the box. There is no "best choice" here. + */ + + if (ix1 > 0) { + x2 += 1; + } else { + x1 -= 1; + } + } else { + + /* + * (x1,x2) span two pixels. Select the one with the larger + * covered "area". + */ + + if (ix1 > 0) { + if ((rectOvalPtr->bbox[2] - ix2) > (ix2 - rectOvalPtr->bbox[0])) { + x2 += 1; + } else { + x1 -= 1; + } + } else { + if ((rectOvalPtr->bbox[2] - ix1) > (ix1 - rectOvalPtr->bbox[0])) { + x2 += 1; + } else { + x1 -= 1; + } + } + } } if (y2 == y1) { - /* - * The height of the bounding box corresponds to less than one pixel - * on screen. Adjustment is needed to avoid drawing attempts with zero - * height items (which would draw nothing). The bounding box spans - * either 1 or 2 pixels. Select which pixel will be drawn. - */ - - short iy1 = (short) (rectOvalPtr->bbox[1]); - short iy2 = (short) (rectOvalPtr->bbox[3]); - - if (iy1 == iy2) { - - /* - * y1 and y2 are "within the same pixel". Use this pixel. - * Note: the degenerated case (bbox[1]==bbox[3]) of a completely - * flat box results in arbitrary selection of the pixel below - * (with positive coordinate) or above (with negative coordinate) - * the box. There is no "best choice" here. - */ - - if (iy1 > 0) { - y2 += 1; - } else { - y1 -= 1; - } - } else { - - /* - * (y1,y2) span two pixels. Select the one with the larger - * covered "area". - */ - - if (iy1 > 0) { - if ((rectOvalPtr->bbox[3] - iy2) > (iy2 - rectOvalPtr->bbox[1])) { - y2 += 1; - } else { - y1 -= 1; - } - } else { - if ((rectOvalPtr->bbox[3] - iy1) > (iy1 - rectOvalPtr->bbox[1])) { - y2 += 1; - } else { - y1 -= 1; - } - } - } + /* + * The height of the bounding box corresponds to less than one pixel + * on screen. Adjustment is needed to avoid drawing attempts with zero + * height items (which would draw nothing). The bounding box spans + * either 1 or 2 pixels. Select which pixel will be drawn. + */ + + short iy1 = (short) (rectOvalPtr->bbox[1]); + short iy2 = (short) (rectOvalPtr->bbox[3]); + + if (iy1 == iy2) { + + /* + * y1 and y2 are "within the same pixel". Use this pixel. + * Note: the degenerated case (bbox[1]==bbox[3]) of a completely + * flat box results in arbitrary selection of the pixel below + * (with positive coordinate) or above (with negative coordinate) + * the box. There is no "best choice" here. + */ + + if (iy1 > 0) { + y2 += 1; + } else { + y1 -= 1; + } + } else { + + /* + * (y1,y2) span two pixels. Select the one with the larger + * covered "area". + */ + + if (iy1 > 0) { + if ((rectOvalPtr->bbox[3] - iy2) > (iy2 - rectOvalPtr->bbox[1])) { + y2 += 1; + } else { + y1 -= 1; + } + } else { + if ((rectOvalPtr->bbox[3] - iy1) > (iy1 - rectOvalPtr->bbox[1])) { + y2 += 1; + } else { + y1 -= 1; + } + } + } } /* |
