diff --git a/src/devctxt.c b/src/devctxt.c index 4729b9b..60c63c3 100755 --- a/src/devctxt.c +++ b/src/devctxt.c @@ -67,37 +67,37 @@ static BOOL line_clip(PINT32 output, INT32 x1, INT32 y1, INT32 x2, INT32 y2, INT if ((outcode1 & outcode2) != 0) return FALSE; /* trivial rejection */ else if ((outcode1 == 0) && (outcode2 == 0)) - break; /* trivial acceptance */ - if (outcode1 == 0) - { - tmp = x1; - x1 = x2; - x2 = tmp; - tmp = y1; - y1 = y2; - y2 = tmp; - outcode1 = outcode2; /* we don't reference outcode2 in the rest of the loop */ - } - if (outcode1 & 0x8) - { - x1 += M(x2 - x1, D(ymin - y1, y2 - y1)); - y1 = ymin; - } - else if (outcode1 & 0x4) - { - x1 += M(x2 - x1, D(ymax - ONE - y1, y2 - y1)); - y1 = ymax - ONE; - } - else if (outcode1 & 0x2) - { - y1 += M(y2 - y1, D(xmax - ONE - x1, x2 - x1)); - x1 = xmax - ONE; - } - else if (outcode1 & 0x1) - { - y1 += M(y2 - y1, D(xmin - x1, x2 - x1)); - x1 = xmin; - } + break; /* trivial acceptance */ + if (outcode1 == 0) + { + tmp = x1; + x1 = x2; + x2 = tmp; + tmp = y1; + y1 = y2; + y2 = tmp; + outcode1 = outcode2; /* we don't reference outcode2 in the rest of the loop */ + } + if (outcode1 & 0x8) + { + x1 += M(x2 - x1, D(ymin - y1, y2 - y1)); + y1 = ymin; + } + else if (outcode1 & 0x4) + { + x1 += M(x2 - x1, D(ymax - ONE - y1, y2 - y1)); + y1 = ymax - ONE; + } + else if (outcode1 & 0x2) + { + y1 += M(y2 - y1, D(xmax - ONE - x1, x2 - x1)); + x1 = xmax - ONE; + } + else if (outcode1 & 0x1) + { + y1 += M(y2 - y1, D(xmin - x1, x2 - x1)); + x1 = xmin; + } } output[0] = x1; output[1] = y1; diff --git a/src/devctxt.h b/src/devctxt.h index f714c66..74d9934 100755 --- a/src/devctxt.h +++ b/src/devctxt.h @@ -1,12 +1,12 @@ /* * UPIWIN - Micro Pi Windowing Framework Kernel * Copyright (C) 2019 Amy Bowersox/Erbosoft Metaverse Design Solutions - * + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the @@ -25,7 +25,7 @@ #include "gfxobj.h" #include "bitmap.h" -#define DCTXT_SIG_WORD 0x78744344 /* "DCtx */ +#define DCTXT_SIG_WORD 0x78744344 /* "DCtx" */ /* Raster operation codes */ #define R2_BLACK 1