diff options
author | Tor Andersson <tor.andersson@artifex.com> | 2011-04-08 01:18:48 +0200 |
---|---|---|
committer | Tor Andersson <tor.andersson@artifex.com> | 2011-04-08 01:18:48 +0200 |
commit | dabb6740d535e9f6abb1bd33f892cf5f7aeac3f0 (patch) | |
tree | 5868b60dfbfb45a586a7970090ed15359ed7df04 /draw/draw_paint.c | |
parent | 0dbfc980afc9d318a1fcb68994621006240ce205 (diff) | |
download | mupdf-dabb6740d535e9f6abb1bd33f892cf5f7aeac3f0.tar.xz |
Add special case non-aa scan converter with accompanying blit functions.
Also turn on font hinting when rendering non-aa text.
Diffstat (limited to 'draw/draw_paint.c')
-rw-r--r-- | draw/draw_paint.c | 36 |
1 files changed, 32 insertions, 4 deletions
diff --git a/draw/draw_paint.c b/draw/draw_paint.c index 00e6405d..3b02b870 100644 --- a/draw/draw_paint.c +++ b/draw/draw_paint.c @@ -72,6 +72,35 @@ and stick to using the premultiplied form. typedef unsigned char byte; +/* These are used by the non-aa scan converter */ + +void +fz_paint_solid_alpha(byte * restrict dp, int w, int alpha) +{ + int t = FZ_EXPAND(255 - alpha); + while (w--) + { + *dp = alpha + FZ_COMBINE(*dp, t); + dp ++; + } +} + +void +fz_paint_solid_color(byte * restrict dp, int n, int w, byte *color) +{ + int n1 = n - 1; + int sa = FZ_EXPAND(color[n1]); + int k; + while (w--) + { + int ma = FZ_COMBINE(FZ_EXPAND(255), sa); + for (k = 0; k < n1; k++) + dp[k] = FZ_BLEND(color[k], dp[k], ma); + dp[k] = FZ_BLEND(255, dp[k], ma); + dp += n; + } +} + /* Blend a non-premultiplied color in mask over destination */ static inline void @@ -111,14 +140,14 @@ fz_paint_span_with_color_4(byte * restrict dp, byte * restrict mp, int w, byte * static inline void fz_paint_span_with_color_N(byte * restrict dp, byte * restrict mp, int n, int w, byte *color) { - int sa = FZ_EXPAND(color[n-1]); + int n1 = n - 1; + int sa = FZ_EXPAND(color[n1]); int k; - n--; while (w--) { int ma = *mp++; ma = FZ_COMBINE(FZ_EXPAND(ma), sa); - for (k = 0; k < n; k++) + for (k = 0; k < n1; k++) dp[k] = FZ_BLEND(color[k], dp[k], ma); dp[k] = FZ_BLEND(255, dp[k], ma); dp += n; @@ -181,7 +210,6 @@ fz_paint_span_with_mask_4(byte * restrict dp, byte * restrict sp, byte * restric static inline void fz_paint_span_with_mask_N(byte * restrict dp, byte * restrict sp, byte * restrict mp, int n, int w) { - n--; while (w--) { int k = n; |