[Pixman] [PATCH 4/7] C variant of bilinear scaled 'src_8888_8_8888' fast path
Siarhei Siamashka
siarhei.siamashka at gmail.com
Tue Feb 22 13:23:45 PST 2011
From: Siarhei Siamashka <siarhei.siamashka at nokia.com>
Serves no real practical purpose other than testing a8 mask support
in bilinear scaling main loop template.
---
pixman/pixman-fast-path.c | 80 +++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 80 insertions(+), 0 deletions(-)
diff --git a/pixman/pixman-fast-path.c b/pixman/pixman-fast-path.c
index 1e3094e..a2125c0 100644
--- a/pixman/pixman-fast-path.c
+++ b/pixman/pixman-fast-path.c
@@ -1594,6 +1594,82 @@ FAST_BILINEAR_MAINLOOP_COMMON (8888_8888_none_SRC,
uint32_t, uint32_t, uint32_t,
NONE, FALSE, FALSE)
+static void
+bilinear_interpolate_a8_line (uint32_t * dst,
+ const uint8_t * mask,
+ const uint32_t * top_row,
+ const uint32_t * bottom_row,
+ int wt,
+ int wb,
+ pixman_fixed_t x,
+ pixman_fixed_t ux,
+ int width)
+{
+ while (--width >= 0)
+ {
+ uint8_t m = *mask++;
+ if (m)
+ {
+ uint32_t s;
+ uint32_t tl, tr, bl, br;
+ int distx;
+
+ tl = top_row [pixman_fixed_to_int (x)];
+ tr = top_row [pixman_fixed_to_int (x) + 1];
+ bl = bottom_row [pixman_fixed_to_int (x)];
+ br = bottom_row [pixman_fixed_to_int (x) + 1];
+
+ distx = (x >> 8) & 0xff;
+
+ s = bilinear_interpolation (tl, tr, bl, br, distx, wt, wb);
+ if (m == 0xff)
+ {
+ *dst = s;
+ }
+ else
+ {
+ *dst = in (s, m);
+ }
+ }
+ else
+ {
+ *dst = 0;
+ }
+ x += ux;
+ dst++;
+ }
+}
+
+static force_inline void
+scaled_bilinear_scanline_8888_8_8888_SRC (uint32_t * dst,
+ const uint8_t * mask,
+ const uint32_t * src_top,
+ const uint32_t * src_bottom,
+ int32_t w,
+ int wt,
+ int wb,
+ pixman_fixed_t vx,
+ pixman_fixed_t unit_x,
+ pixman_fixed_t max_vx,
+ pixman_bool_t zero_src)
+{
+ bilinear_interpolate_a8_line (dst, mask, src_top, src_bottom,
+ wt, wb, vx, unit_x, w);
+}
+
+FAST_BILINEAR_MAINLOOP_COMMON (8888_8_8888_cover_SRC,
+ scaled_bilinear_scanline_8888_8_8888_SRC,
+ uint32_t, uint8_t, uint32_t,
+ COVER, TRUE, FALSE)
+FAST_BILINEAR_MAINLOOP_COMMON (8888_8_8888_pad_SRC,
+ scaled_bilinear_scanline_8888_8_8888_SRC,
+ uint32_t, uint8_t, uint32_t,
+ PAD, TRUE, FALSE)
+FAST_BILINEAR_MAINLOOP_COMMON (8888_8_8888_none_SRC,
+ scaled_bilinear_scanline_8888_8_8888_SRC,
+ uint32_t, uint8_t, uint32_t,
+ NONE, TRUE, FALSE)
+
static force_inline uint32_t
fetch_nearest (pixman_repeat_t src_repeat,
pixman_format_code_t format,
@@ -2117,6 +2193,10 @@ static const pixman_fast_path_t c_fast_paths[] =
SIMPLE_BILINEAR_FAST_PATH (SRC, x8r8g8b8, x8r8g8b8, 8888_8888),
SIMPLE_BILINEAR_FAST_PATH (SRC, x8b8g8r8, x8b8g8r8, 8888_8888),
+ SIMPLE_BILINEAR_A8_MASK_FAST_PATH (SRC, a8r8g8b8, a8r8g8b8, 8888_8_8888),
+ SIMPLE_BILINEAR_A8_MASK_FAST_PATH (SRC, a8r8g8b8, x8r8g8b8, 8888_8_8888),
+ SIMPLE_BILINEAR_A8_MASK_FAST_PATH (SRC, x8r8g8b8, x8r8g8b8, 8888_8_8888),
+
#define NEAREST_FAST_PATH(op,s,d) \
{ PIXMAN_OP_ ## op, \
PIXMAN_ ## s, SCALED_NEAREST_FLAGS, \
--
1.7.3.4
More information about the Pixman
mailing list