width, height);
}
+static void
+pixman_fill8 (uint32_t *bits,
+ int stride,
+ int x,
+ int y,
+ int width,
+ int height,
+ uint32_t xor)
+{
+ int byte_stride = stride * (int) sizeof (uint32_t);
+ uint8_t *dst = (uint8_t *) bits;
+ uint8_t v = xor & 0xff;
+ int i;
+
+ dst = dst + y * byte_stride + x;
+
+ while (height--)
+ {
+ for (i = 0; i < width; ++i)
+ dst[i] = v;
+
+ dst += byte_stride;
+ }
+}
+
+static void
+pixman_fill16 (uint32_t *bits,
+ int stride,
+ int x,
+ int y,
+ int width,
+ int height,
+ uint32_t xor)
+{
+ int short_stride = (stride * (int) sizeof (uint32_t)) / (int) sizeof (uint16_t);
+ uint16_t *dst = (uint16_t *)bits;
+ uint16_t v = xor & 0xffff;
+ int i;
+
+ dst = dst + y * short_stride + x;
+
+ while (height--)
+ {
+ for (i = 0; i < width; ++i)
+ dst[i] = v;
+
+ dst += short_stride;
+ }
+}
+
+static void
+pixman_fill32 (uint32_t *bits,
+ int stride,
+ int x,
+ int y,
+ int width,
+ int height,
+ uint32_t xor)
+{
+ int i;
+
+ bits = bits + y * stride + x;
+
+ while (height--)
+ {
+ for (i = 0; i < width; ++i)
+ bits[i] = xor;
+
+ bits += stride;
+ }
+}
+
+static pixman_bool_t
+fast_path_fill (pixman_implementation_t *imp,
+ uint32_t *bits,
+ int stride,
+ int bpp,
+ int x,
+ int y,
+ int width,
+ int height,
+ uint32_t xor)
+{
+ switch (bpp)
+ {
+ case 8:
+ pixman_fill8 (bits, stride, x, y, width, height, xor);
+ break;
+
+ case 16:
+ pixman_fill16 (bits, stride, x, y, width, height, xor);
+ break;
+
+ case 32:
+ pixman_fill32 (bits, stride, x, y, width, height, xor);
+ break;
+
+ default:
+ return _pixman_implementation_fill (
+ imp->delegate, bits, stride, bpp, x, y, width, height, xor);
+ break;
+ }
+
+ return TRUE;
+}
+
pixman_implementation_t *
_pixman_implementation_create_fast_path (pixman_implementation_t *toplevel)
{
pixman_implementation_t *imp = _pixman_implementation_create (toplevel, general);
imp->composite = fast_path_composite;
+ imp->fill = fast_path_fill;
return imp;
}
return FALSE;
}
+static pixman_bool_t
+general_fill (pixman_implementation_t *imp,
+ uint32_t *bits,
+ int stride,
+ int bpp,
+ int x,
+ int y,
+ int width,
+ int height,
+ uint32_t xor)
+{
+ return FALSE;
+}
+
pixman_implementation_t *
_pixman_implementation_create_general (pixman_implementation_t *toplevel)
{
}
imp->composite = general_composite;
imp->blt = general_blt;
-
+ imp->fill = general_fill;
+
return imp;
}
width, height);
}
+static pixman_bool_t
+delegate_fill (pixman_implementation_t *imp,
+ uint32_t *bits,
+ int stride,
+ int bpp,
+ int x,
+ int y,
+ int width,
+ int height,
+ uint32_t xor)
+{
+ return _pixman_implementation_fill (imp->delegate, bits, stride, bpp, x, y, width, height, xor);
+}
+
pixman_implementation_t *
_pixman_implementation_create (pixman_implementation_t *toplevel,
pixman_implementation_t *delegate)
*/
imp->composite = delegate_composite;
imp->blt = delegate_blt;
+ imp->fill = delegate_fill;
for (i = 0; i < PIXMAN_OP_LAST; ++i)
{
src_bpp, dst_bpp, src_x, src_y, dst_x, dst_y,
width, height);
}
+
+pixman_bool_t
+_pixman_implementation_fill (pixman_implementation_t *imp,
+ uint32_t *bits,
+ int stride,
+ int bpp,
+ int x,
+ int y,
+ int width,
+ int height,
+ uint32_t xor)
+{
+ return (* imp->fill) (imp->delegate, bits, stride, bpp, x, y, width, height, xor);
+}
return TRUE;
}
+static pixman_bool_t
+mmx_fill (pixman_implementation_t *imp,
+ uint32_t *bits,
+ int stride,
+ int bpp,
+ int x,
+ int y,
+ int width,
+ int height,
+ uint32_t xor)
+{
+ if (!pixman_fill_mmx (bits, stride, bpp, x, y, width, height, xor))
+ {
+ return _pixman_implementation_fill (
+ imp->delegate, bits, stride, bpp, x, y, width, height, xor);
+ }
+
+ return TRUE;
+}
+
pixman_implementation_t *
_pixman_implementation_create_mmx (pixman_implementation_t *toplevel)
{
imp->composite = mmx_composite;
imp->blt = mmx_blt;
+ imp->fill = mmx_fill;
return imp;
}
dest_x, dest_y,
width, height);
}
+
+PIXMAN_EXPORT pixman_bool_t
+pixman_blt (uint32_t *src_bits,
+ uint32_t *dst_bits,
+ int src_stride,
+ int dst_stride,
+ int src_bpp,
+ int dst_bpp,
+ int src_x, int src_y,
+ int dst_x, int dst_y,
+ int width, int height)
+{
+ if (!imp)
+ imp = _pixman_choose_implementation();
+
+ return _pixman_implementation_blt (imp, src_bits, dst_bits, src_stride, dst_stride,
+ src_bpp, dst_bpp,
+ src_x, src_y,
+ dst_x, dst_y,
+ width, height);
+}
+
+PIXMAN_EXPORT pixman_bool_t
+pixman_fill (uint32_t *bits,
+ int stride,
+ int bpp,
+ int x,
+ int y,
+ int width,
+ int height,
+ uint32_t xor)
+{
+ if (!imp)
+ imp = _pixman_choose_implementation();
+
+ return _pixman_implementation_fill (imp, bits, stride, bpp, x, y, width, height, xor);
+}
int dst_y,
int width,
int height);
+typedef pixman_bool_t (* pixman_fill_func_t) (pixman_implementation_t *imp,
+ uint32_t *bits,
+ int stride,
+ int bpp,
+ int x,
+ int y,
+ int width,
+ int height,
+ uint32_t xor);
void
_pixman_walk_composite_region (pixman_implementation_t *imp,
pixman_composite_func_t composite;
pixman_blt_func_t blt;
+ pixman_fill_func_t fill;
pixman_combine_32_func_t combine_32[PIXMAN_OP_LAST];
pixman_combine_32_func_t combine_32_ca[PIXMAN_OP_LAST];
int dst_y,
int width,
int height);
-
+pixman_bool_t
+_pixman_implementation_fill (pixman_implementation_t * imp,
+ uint32_t *bits,
+ int stride,
+ int bpp,
+ int x,
+ int y,
+ int width,
+ int height,
+ uint32_t xor);
+
/* Specific implementations */
pixman_implementation_t *
_pixman_implementation_create_general (pixman_implementation_t *toplevel);
return TRUE;
}
+__attribute__((__force_align_arg_pointer__))
+static pixman_bool_t
+sse2_fill (pixman_implementation_t *imp,
+ uint32_t *bits,
+ int stride,
+ int bpp,
+ int x,
+ int y,
+ int width,
+ int height,
+ uint32_t xor)
+{
+ if (!pixmanFillsse2 (bits, stride, bpp, x, y, width, height, xor))
+ {
+ return _pixman_implementation_fill (
+ imp->delegate, bits, stride, bpp, x, y, width, height, xor);
+ }
+
+ return TRUE;
+}
+
pixman_implementation_t *
_pixman_implementation_create_sse2 (pixman_implementation_t *toplevel)
{
imp->composite = sse2_composite;
imp->blt = sse2_blt;
+ imp->fill = sse2_fill;
return imp;
}
#include "pixman-mmx.h"
#include "pixman-sse2.h"
-static void
-pixman_fill8 (uint32_t *bits,
- int stride,
- int x,
- int y,
- int width,
- int height,
- uint32_t xor)
-{
- int byte_stride = stride * (int) sizeof (uint32_t);
- uint8_t *dst = (uint8_t *) bits;
- uint8_t v = xor & 0xff;
- int i;
-
- dst = dst + y * byte_stride + x;
-
- while (height--)
- {
- for (i = 0; i < width; ++i)
- dst[i] = v;
-
- dst += byte_stride;
- }
-}
-
-static void
-pixman_fill16 (uint32_t *bits,
- int stride,
- int x,
- int y,
- int width,
- int height,
- uint32_t xor)
-{
- int short_stride = (stride * (int) sizeof (uint32_t)) / (int) sizeof (uint16_t);
- uint16_t *dst = (uint16_t *)bits;
- uint16_t v = xor & 0xffff;
- int i;
-
- dst = dst + y * short_stride + x;
-
- while (height--)
- {
- for (i = 0; i < width; ++i)
- dst[i] = v;
-
- dst += short_stride;
- }
-}
-
-static void
-pixman_fill32 (uint32_t *bits,
- int stride,
- int x,
- int y,
- int width,
- int height,
- uint32_t xor)
-{
- int i;
-
- bits = bits + y * stride + x;
-
- while (height--)
- {
- for (i = 0; i < width; ++i)
- bits[i] = xor;
-
- bits += stride;
- }
-}
-
-#if defined(USE_SSE2) && defined(__GNUC__) && !defined(__x86_64__) && !defined(__amd64__)
-__attribute__((__force_align_arg_pointer__))
-#endif
-PIXMAN_EXPORT pixman_bool_t
-pixman_fill (uint32_t *bits,
- int stride,
- int bpp,
- int x,
- int y,
- int width,
- int height,
- uint32_t xor)
-{
-#if 0
- printf ("filling: %d %d %d %d (stride: %d, bpp: %d) pixel: %x\n",
- x, y, width, height, stride, bpp, xor);
-#endif
-
-#ifdef USE_SSE2
- if (pixman_have_sse2() && pixmanFillsse2 (bits, stride, bpp, x, y, width, height, xor))
- return TRUE;
-#endif
-
-#ifdef USE_MMX
- if (pixman_have_mmx() && pixman_fill_mmx (bits, stride, bpp, x, y, width, height, xor))
- return TRUE;
-#endif
-
- switch (bpp)
- {
- case 8:
- pixman_fill8 (bits, stride, x, y, width, height, xor);
- break;
-
- case 16:
- pixman_fill16 (bits, stride, x, y, width, height, xor);
- break;
-
- case 32:
- pixman_fill32 (bits, stride, x, y, width, height, xor);
- break;
-
- default:
- return FALSE;
- break;
- }
-
- return TRUE;
-}
-
-
/*
* Compute the smallest value no less than y which is on a
* grid row