This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project gfxprim.git.
The branch, master has been updated via c9a9d19055f9add550845b8e3c9050e7e32467c2 (commit) via b98ab667d547b2de4ad9d8fdb2c5d1dee4e65419 (commit) from 4c14716c974906c490a2f96bdbd0cef840fe1812 (commit)
Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below.
- Log ----------------------------------------------------------------- http://repo.or.cz/w/gfxprim.git/commit/c9a9d19055f9add550845b8e3c9050e7e3246...
commit c9a9d19055f9add550845b8e3c9050e7e32467c2 Author: Cyril Hrubis metan@ucw.cz Date: Wed Feb 8 20:21:44 2012 +0100
gfx: LineAA nearly complete
diff --git a/libs/gfx/GP_LineAA.gen.c.t b/libs/gfx/GP_LineAA.gen.c.t index 6bbc22f..2bf413f 100644 --- a/libs/gfx/GP_LineAA.gen.c.t +++ b/libs/gfx/GP_LineAA.gen.c.t @@ -14,39 +14,21 @@
#define FP_TO_PERC(a) (GP_FP_ROUND_TO_INT((a) * 255))
-void GP_LineAA_Raw(GP_Context *context, GP_Coord x0, GP_Coord y0, - GP_Coord x1, GP_Coord y1, GP_Pixel pixel) +static inline void line_aa_x(GP_Context *context, + GP_Coord x0, GP_Coord y0, + GP_Coord x1, GP_Coord y1, GP_Pixel pixel) { + GP_Coord xend, yend, xgap, xpx0, ypx0, xpx1, ypx1; + uint8_t perc; + int64_t dx = x1 - x0; int64_t dy = y1 - y0; - - if (dy == 0) { - //TODO!!! - GP_HLine_Raw(context, GP_FP_ROUND_TO_INT(x0), GP_FP_ROUND_TO_INT(x1), - GP_FP_ROUND_TO_INT(y0), pixel); - return; - } - - if (dx == 0) { - //TODO!!! - GP_VLine(context, GP_FP_ROUND_TO_INT(x0), GP_FP_ROUND_TO_INT(y0), - GP_FP_ROUND_TO_INT(y1), pixel); - return; - } - - if (GP_ABS(dx) < GP_ABS(dy)) { - //TODO - return; - } if (x1 < x0) { GP_SWAP(x0, x1); GP_SWAP(y0, y1); }
- GP_Coord xend, yend, xgap, xpx0, ypx0, xpx1, ypx1; - uint8_t perc; - xend = GP_FP_ROUND(x1); yend = y1 + GP_FP_DIV(GP_FP_MUL(dy, xend - x1), dx); xgap = GP_FP_FRAC(x1 + GP_FP_1_2); @@ -74,9 +56,88 @@ void GP_LineAA_Raw(GP_Context *context, GP_Coord x0, GP_Coord y0,
for (x = xpx0 + 1; x < xpx1; x++) { intery = yend + GP_FP_DIV((x - xpx0) * dy, dx); - GP_MixPixel_Raw_Clipped(context, x, GP_FP_TO_INT(intery), pixel, FP_TO_PERC(GP_FP_RFRAC(intery))); - GP_MixPixel_Raw_Clipped(context, x, GP_FP_TO_INT(intery) + 1, pixel, FP_TO_PERC(GP_FP_FRAC(intery))); + + perc = FP_TO_PERC(GP_FP_RFRAC(intery)); + GP_MixPixel_Raw_Clipped(context, x, GP_FP_TO_INT(intery), pixel, perc); + perc = FP_TO_PERC(GP_FP_FRAC(intery)); + GP_MixPixel_Raw_Clipped(context, x, GP_FP_TO_INT(intery)+1, pixel, perc); + } +} + +static inline void line_aa_y(GP_Context *context, + GP_Coord x0, GP_Coord y0, + GP_Coord x1, GP_Coord y1, GP_Pixel pixel) +{ + GP_Coord xend, yend, ygap, xpx0, ypx0, xpx1, ypx1; + uint8_t perc; + + int64_t dx = x1 - x0; + int64_t dy = y1 - y0; + + if (y1 < y0) { + GP_SWAP(x0, x1); + GP_SWAP(y0, y1); + } + + yend = GP_FP_ROUND(y1); + xend = x1 + GP_FP_DIV(GP_FP_MUL(dx, yend - y1), dy); + ygap = GP_FP_FRAC(y1 + GP_FP_1_2); + ypx1 = GP_FP_TO_INT(yend); + xpx1 = GP_FP_TO_INT(xend); + + perc = FP_TO_PERC(GP_FP_MUL(GP_FP_RFRAC(xend), ygap)); + GP_MixPixel_Raw_Clipped(context, xpx1, ypx1, pixel, perc); + perc = FP_TO_PERC(GP_FP_MUL(GP_FP_FRAC(xend), ygap)); + GP_MixPixel_Raw_Clipped(context, xpx1, ypx1+1, pixel, perc); + + yend = GP_FP_ROUND(y0); + xend = x0 + GP_FP_DIV(GP_FP_MUL(dx, yend - y0), dy); + ygap = GP_FP_RFRAC(y0 + GP_FP_1_2); + ypx0 = GP_FP_TO_INT(yend); + xpx0 = GP_FP_TO_INT(xend); + + perc = FP_TO_PERC(GP_FP_MUL(GP_FP_RFRAC(xend), ygap)); + GP_MixPixel_Raw_Clipped(context, xpx0, ypx0, pixel, perc); + perc = FP_TO_PERC(GP_FP_MUL(GP_FP_FRAC(xend), ygap)); + GP_MixPixel_Raw_Clipped(context, xpx0, ypx0+1, pixel, perc); + + GP_Coord y; + GP_Coord intery; + + for (y = ypx0 + 1; y < ypx1; y++) { + intery = xend + GP_FP_DIV((y - ypx0) * dx, dy); + + perc = FP_TO_PERC(GP_FP_RFRAC(intery)); + GP_MixPixel_Raw_Clipped(context, GP_FP_TO_INT(intery), y, pixel, perc); + perc = FP_TO_PERC(GP_FP_FRAC(intery)); + GP_MixPixel_Raw_Clipped(context, GP_FP_TO_INT(intery)+1, y, pixel, perc); } }
+void GP_LineAA_Raw(GP_Context *context, GP_Coord x0, GP_Coord y0, + GP_Coord x1, GP_Coord y1, GP_Pixel pixel) +{ + int64_t dx = x1 - x0; + int64_t dy = y1 - y0; + + if (dy == 0) { + //TODO!!! + GP_HLine_Raw(context, GP_FP_ROUND_TO_INT(x0), GP_FP_ROUND_TO_INT(x1), + GP_FP_ROUND_TO_INT(y0), pixel); + return; + } + + if (dx == 0) { + //TODO!!! + GP_VLine(context, GP_FP_ROUND_TO_INT(x0), GP_FP_ROUND_TO_INT(y0), + GP_FP_ROUND_TO_INT(y1), pixel); + return; + } + + if (GP_ABS(dx) < GP_ABS(dy)) + line_aa_y(context, x0, y0, x1, y1, pixel); + else + line_aa_x(context, x0, y0, x1, y1, pixel); +} + %% endblock body
http://repo.or.cz/w/gfxprim.git/commit/b98ab667d547b2de4ad9d8fdb2c5d1dee4e65...
commit b98ab667d547b2de4ad9d8fdb2c5d1dee4e65419 Author: Cyril Hrubis metan@ucw.cz Date: Wed Feb 8 20:13:20 2012 +0100
gfx: LineAA fix typo, reorder code.
diff --git a/libs/gfx/GP_LineAA.gen.c.t b/libs/gfx/GP_LineAA.gen.c.t index 37af24e..6bbc22f 100644 --- a/libs/gfx/GP_LineAA.gen.c.t +++ b/libs/gfx/GP_LineAA.gen.c.t @@ -22,15 +22,15 @@ void GP_LineAA_Raw(GP_Context *context, GP_Coord x0, GP_Coord y0,
if (dy == 0) { //TODO!!! - //GP_HLine_Raw(context, GP_FP_ROUND_TO_INT(x0), GP_FP_ROUND_TO_INT(x1), - // GP_FP_ROUND_TO_INT(y0), pixel); + GP_HLine_Raw(context, GP_FP_ROUND_TO_INT(x0), GP_FP_ROUND_TO_INT(x1), + GP_FP_ROUND_TO_INT(y0), pixel); return; }
if (dx == 0) { //TODO!!! - //GP_VLine(context, GP_FP_ROUND_TO_INT(x0), GP_FP_ROUND_TO_INT(y0), - // GP_FP_ROUND_TO_INT(y1), pixel); + GP_VLine(context, GP_FP_ROUND_TO_INT(x0), GP_FP_ROUND_TO_INT(y0), + GP_FP_ROUND_TO_INT(y1), pixel); return; }
@@ -44,9 +44,20 @@ void GP_LineAA_Raw(GP_Context *context, GP_Coord x0, GP_Coord y0, GP_SWAP(y0, y1); }
- GP_Coord xend, yend, xgap, xpx0, ypx0, xpx1, ypx1, ddd; + GP_Coord xend, yend, xgap, xpx0, ypx0, xpx1, ypx1; uint8_t perc;
+ xend = GP_FP_ROUND(x1); + yend = y1 + GP_FP_DIV(GP_FP_MUL(dy, xend - x1), dx); + xgap = GP_FP_FRAC(x1 + GP_FP_1_2); + xpx1 = GP_FP_TO_INT(xend); + ypx1 = GP_FP_TO_INT(yend); + + perc = FP_TO_PERC(GP_FP_MUL(GP_FP_RFRAC(yend), xgap)); + GP_MixPixel_Raw_Clipped(context, xpx1, ypx1, pixel, perc); + perc = FP_TO_PERC(GP_FP_MUL(GP_FP_FRAC(yend), xgap)); + GP_MixPixel_Raw_Clipped(context, xpx1, ypx1+1, pixel, perc); + xend = GP_FP_ROUND(x0); yend = y0 + GP_FP_DIV(GP_FP_MUL(dy, xend - x0), dx); xgap = GP_FP_RFRAC(x0 + GP_FP_1_2); @@ -58,24 +69,11 @@ void GP_LineAA_Raw(GP_Context *context, GP_Coord x0, GP_Coord y0, perc = FP_TO_PERC(GP_FP_MUL(GP_FP_FRAC(yend), xgap)); GP_MixPixel_Raw_Clipped(context, xpx0, ypx0+1, pixel, perc);
- ddd = yend; - - xend = GP_FP_ROUND(x1); - yend = y1 + GP_FP_DIV(GP_FP_MUL(dy, xend - x1), dx); - xgap = GP_FP_FRAC(x1 + GP_FP_1_2); - xpx1 = GP_FP_TO_INT(xend); - ypx1 = GP_FP_TO_INT(yend); - - perc = FP_TO_PERC(GP_FP_MUL(GP_FP_RFRAC(yend), xgap)); - GP_MixPixel_Raw_Clipped(context, xpx1, ypx1, pixel, perc); - perc = FP_TO_PERC(GP_FP_MUL(GP_FP_RFRAC(yend), xgap)); - GP_MixPixel_Raw_Clipped(context, xpx1, ypx1+1, pixel, perc); - GP_Coord x; GP_Coord intery;
for (x = xpx0 + 1; x < xpx1; x++) { - intery = ddd + GP_FP_DIV((x - xpx0) * dy, dx); + intery = yend + GP_FP_DIV((x - xpx0) * dy, dx); GP_MixPixel_Raw_Clipped(context, x, GP_FP_TO_INT(intery), pixel, FP_TO_PERC(GP_FP_RFRAC(intery))); GP_MixPixel_Raw_Clipped(context, x, GP_FP_TO_INT(intery) + 1, pixel, FP_TO_PERC(GP_FP_FRAC(intery))); }
-----------------------------------------------------------------------
Summary of changes: libs/gfx/GP_LineAA.gen.c.t | 129 ++++++++++++++++++++++++++++++++------------ 1 files changed, 94 insertions(+), 35 deletions(-)
repo.or.cz automatic notification. Contact project admin jiri.bluebear.dluhos@gmail.com if you want to unsubscribe, or site admin admin@repo.or.cz if you receive no reply.