[Pixman] [PATCH 5/7] C variant of bilinear scaled 'src_8888_n_8888' fast path
Siarhei Siamashka
siarhei.siamashka at gmail.com
Tue Feb 22 13:23:46 PST 2011
From: Siarhei Siamashka <siarhei.siamashka at nokia.com>
Serves no real practical purpose other than testing solid 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 a2125c0..fdaad64 100644
--- a/pixman/pixman-fast-path.c
+++ b/pixman/pixman-fast-path.c
@@ -1670,6 +1670,82 @@ FAST_BILINEAR_MAINLOOP_COMMON (8888_8_8888_none_SRC,
uint32_t, uint8_t, uint32_t,
NONE, TRUE, FALSE)
+static void
+bilinear_interpolate_s_line (uint32_t * dst,
+ const uint32_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)
+{
+ uint8_t m = *mask >> 24;
+ while (--width >= 0)
+ {
+ 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_n_8888_SRC (uint32_t * dst,
+ const uint32_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_s_line (dst, mask, src_top, src_bottom,
+ wt, wb, vx, unit_x, w);
+}
+
+FAST_BILINEAR_MAINLOOP_COMMON (8888_n_8888_cover_SRC,
+ scaled_bilinear_scanline_8888_n_8888_SRC,
+ uint32_t, uint32_t, uint32_t,
+ COVER, TRUE, TRUE)
+FAST_BILINEAR_MAINLOOP_COMMON (8888_n_8888_pad_SRC,
+ scaled_bilinear_scanline_8888_n_8888_SRC,
+ uint32_t, uint32_t, uint32_t,
+ PAD, TRUE, TRUE)
+FAST_BILINEAR_MAINLOOP_COMMON (8888_n_8888_none_SRC,
+ scaled_bilinear_scanline_8888_n_8888_SRC,
+ uint32_t, uint32_t, uint32_t,
+ NONE, TRUE, TRUE)
+
static force_inline uint32_t
fetch_nearest (pixman_repeat_t src_repeat,
pixman_format_code_t format,
@@ -2197,6 +2273,10 @@ static const pixman_fast_path_t c_fast_paths[] =
SIMPLE_BILINEAR_A8_MASK_FAST_PATH (SRC, a8r8g8b8, x8r8g8b8, 8888_8_8888),
SIMPLE_BILINEAR_A8_MASK_FAST_PATH (SRC, x8r8g8b8, x8r8g8b8, 8888_8_8888),
+ SIMPLE_BILINEAR_SOLID_MASK_FAST_PATH (SRC, a8r8g8b8, a8r8g8b8, 8888_n_8888),
+ SIMPLE_BILINEAR_SOLID_MASK_FAST_PATH (SRC, a8r8g8b8, x8r8g8b8, 8888_n_8888),
+ SIMPLE_BILINEAR_SOLID_MASK_FAST_PATH (SRC, x8r8g8b8, x8r8g8b8, 8888_n_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