30,12 → 30,12 |
#include <stdlib.h> |
#include "pixman-private.h" |
#include "pixman-combine32.h" |
#include "pixman-fast-path.h" |
#include "pixman-inlines.h" |
|
static force_inline uint32_t |
fetch_24 (uint8_t *a) |
{ |
if (((unsigned long)a) & 1) |
if (((uintptr_t)a) & 1) |
{ |
#ifdef WORDS_BIGENDIAN |
return (*a << 16) | (*(uint16_t *)(a + 1)); |
57,7 → 57,7 |
store_24 (uint8_t *a, |
uint32_t v) |
{ |
if (((unsigned long)a) & 1) |
if (((uintptr_t)a) & 1) |
{ |
#ifdef WORDS_BIGENDIAN |
*a = (uint8_t) (v >> 16); |
90,7 → 90,7 |
return dest; |
} |
|
static uint32_t |
static force_inline uint32_t |
in (uint32_t x, |
uint8_t y) |
{ |
108,19 → 108,9 |
*/ |
static void |
fast_composite_over_x888_8_8888 (pixman_implementation_t *imp, |
pixman_op_t op, |
pixman_image_t * src_image, |
pixman_image_t * mask_image, |
pixman_image_t * dst_image, |
int32_t src_x, |
int32_t src_y, |
int32_t mask_x, |
int32_t mask_y, |
int32_t dest_x, |
int32_t dest_y, |
int32_t width, |
int32_t height) |
pixman_composite_info_t *info) |
{ |
PIXMAN_COMPOSITE_ARGS (info); |
uint32_t *src, *src_line; |
uint32_t *dst, *dst_line; |
uint8_t *mask, *mask_line; |
129,7 → 119,7 |
uint32_t s, d; |
int32_t w; |
|
PIXMAN_IMAGE_GET_LINE (dst_image, dest_x, dest_y, uint32_t, dst_stride, dst_line, 1); |
PIXMAN_IMAGE_GET_LINE (dest_image, dest_x, dest_y, uint32_t, dst_stride, dst_line, 1); |
PIXMAN_IMAGE_GET_LINE (mask_image, mask_x, mask_y, uint8_t, mask_stride, mask_line, 1); |
PIXMAN_IMAGE_GET_LINE (src_image, src_x, src_y, uint32_t, src_stride, src_line, 1); |
|
168,19 → 158,9 |
|
static void |
fast_composite_in_n_8_8 (pixman_implementation_t *imp, |
pixman_op_t op, |
pixman_image_t * src_image, |
pixman_image_t * mask_image, |
pixman_image_t * dest_image, |
int32_t src_x, |
int32_t src_y, |
int32_t mask_x, |
int32_t mask_y, |
int32_t dest_x, |
int32_t dest_y, |
int32_t width, |
int32_t height) |
pixman_composite_info_t *info) |
{ |
PIXMAN_COMPOSITE_ARGS (info); |
uint32_t src, srca; |
uint8_t *dst_line, *dst; |
uint8_t *mask_line, *mask, m; |
188,7 → 168,7 |
int32_t w; |
uint16_t t; |
|
src = _pixman_image_get_solid (src_image, dest_image->bits.format); |
src = _pixman_image_get_solid (imp, src_image, dest_image->bits.format); |
|
srca = src >> 24; |
|
246,19 → 226,9 |
|
static void |
fast_composite_in_8_8 (pixman_implementation_t *imp, |
pixman_op_t op, |
pixman_image_t * src_image, |
pixman_image_t * mask_image, |
pixman_image_t * dest_image, |
int32_t src_x, |
int32_t src_y, |
int32_t mask_x, |
int32_t mask_y, |
int32_t dest_x, |
int32_t dest_y, |
int32_t width, |
int32_t height) |
pixman_composite_info_t *info) |
{ |
PIXMAN_COMPOSITE_ARGS (info); |
uint8_t *dst_line, *dst; |
uint8_t *src_line, *src; |
int dst_stride, src_stride; |
293,19 → 263,9 |
|
static void |
fast_composite_over_n_8_8888 (pixman_implementation_t *imp, |
pixman_op_t op, |
pixman_image_t * src_image, |
pixman_image_t * mask_image, |
pixman_image_t * dst_image, |
int32_t src_x, |
int32_t src_y, |
int32_t mask_x, |
int32_t mask_y, |
int32_t dest_x, |
int32_t dest_y, |
int32_t width, |
int32_t height) |
pixman_composite_info_t *info) |
{ |
PIXMAN_COMPOSITE_ARGS (info); |
uint32_t src, srca; |
uint32_t *dst_line, *dst, d; |
uint8_t *mask_line, *mask, m; |
312,13 → 272,13 |
int dst_stride, mask_stride; |
int32_t w; |
|
src = _pixman_image_get_solid (src_image, dst_image->bits.format); |
src = _pixman_image_get_solid (imp, src_image, dest_image->bits.format); |
|
srca = src >> 24; |
if (src == 0) |
return; |
|
PIXMAN_IMAGE_GET_LINE (dst_image, dest_x, dest_y, uint32_t, dst_stride, dst_line, 1); |
PIXMAN_IMAGE_GET_LINE (dest_image, dest_x, dest_y, uint32_t, dst_stride, dst_line, 1); |
PIXMAN_IMAGE_GET_LINE (mask_image, mask_x, mask_y, uint8_t, mask_stride, mask_line, 1); |
|
while (height--) |
351,32 → 311,21 |
|
static void |
fast_composite_add_n_8888_8888_ca (pixman_implementation_t *imp, |
pixman_op_t op, |
pixman_image_t * src_image, |
pixman_image_t * mask_image, |
pixman_image_t * dst_image, |
int32_t src_x, |
int32_t src_y, |
int32_t mask_x, |
int32_t mask_y, |
int32_t dest_x, |
int32_t dest_y, |
int32_t width, |
int32_t height) |
pixman_composite_info_t *info) |
{ |
uint32_t src, srca, s; |
PIXMAN_COMPOSITE_ARGS (info); |
uint32_t src, s; |
uint32_t *dst_line, *dst, d; |
uint32_t *mask_line, *mask, ma; |
int dst_stride, mask_stride; |
int32_t w; |
|
src = _pixman_image_get_solid (src_image, dst_image->bits.format); |
src = _pixman_image_get_solid (imp, src_image, dest_image->bits.format); |
|
srca = src >> 24; |
if (src == 0) |
return; |
|
PIXMAN_IMAGE_GET_LINE (dst_image, dest_x, dest_y, uint32_t, dst_stride, dst_line, 1); |
PIXMAN_IMAGE_GET_LINE (dest_image, dest_x, dest_y, uint32_t, dst_stride, dst_line, 1); |
PIXMAN_IMAGE_GET_LINE (mask_image, mask_x, mask_y, uint32_t, mask_stride, mask_line, 1); |
|
while (height--) |
408,19 → 357,9 |
|
static void |
fast_composite_over_n_8888_8888_ca (pixman_implementation_t *imp, |
pixman_op_t op, |
pixman_image_t * src_image, |
pixman_image_t * mask_image, |
pixman_image_t * dst_image, |
int32_t src_x, |
int32_t src_y, |
int32_t mask_x, |
int32_t mask_y, |
int32_t dest_x, |
int32_t dest_y, |
int32_t width, |
int32_t height) |
pixman_composite_info_t *info) |
{ |
PIXMAN_COMPOSITE_ARGS (info); |
uint32_t src, srca, s; |
uint32_t *dst_line, *dst, d; |
uint32_t *mask_line, *mask, ma; |
427,13 → 366,13 |
int dst_stride, mask_stride; |
int32_t w; |
|
src = _pixman_image_get_solid (src_image, dst_image->bits.format); |
src = _pixman_image_get_solid (imp, src_image, dest_image->bits.format); |
|
srca = src >> 24; |
if (src == 0) |
return; |
|
PIXMAN_IMAGE_GET_LINE (dst_image, dest_x, dest_y, uint32_t, dst_stride, dst_line, 1); |
PIXMAN_IMAGE_GET_LINE (dest_image, dest_x, dest_y, uint32_t, dst_stride, dst_line, 1); |
PIXMAN_IMAGE_GET_LINE (mask_image, mask_x, mask_y, uint32_t, mask_stride, mask_line, 1); |
|
while (height--) |
474,19 → 413,9 |
|
static void |
fast_composite_over_n_8_0888 (pixman_implementation_t *imp, |
pixman_op_t op, |
pixman_image_t * src_image, |
pixman_image_t * mask_image, |
pixman_image_t * dst_image, |
int32_t src_x, |
int32_t src_y, |
int32_t mask_x, |
int32_t mask_y, |
int32_t dest_x, |
int32_t dest_y, |
int32_t width, |
int32_t height) |
pixman_composite_info_t *info) |
{ |
PIXMAN_COMPOSITE_ARGS (info); |
uint32_t src, srca; |
uint8_t *dst_line, *dst; |
uint32_t d; |
494,13 → 423,13 |
int dst_stride, mask_stride; |
int32_t w; |
|
src = _pixman_image_get_solid (src_image, dst_image->bits.format); |
src = _pixman_image_get_solid (imp, src_image, dest_image->bits.format); |
|
srca = src >> 24; |
if (src == 0) |
return; |
|
PIXMAN_IMAGE_GET_LINE (dst_image, dest_x, dest_y, uint8_t, dst_stride, dst_line, 3); |
PIXMAN_IMAGE_GET_LINE (dest_image, dest_x, dest_y, uint8_t, dst_stride, dst_line, 3); |
PIXMAN_IMAGE_GET_LINE (mask_image, mask_x, mask_y, uint8_t, mask_stride, mask_line, 1); |
|
while (height--) |
539,19 → 468,9 |
|
static void |
fast_composite_over_n_8_0565 (pixman_implementation_t *imp, |
pixman_op_t op, |
pixman_image_t * src_image, |
pixman_image_t * mask_image, |
pixman_image_t * dst_image, |
int32_t src_x, |
int32_t src_y, |
int32_t mask_x, |
int32_t mask_y, |
int32_t dest_x, |
int32_t dest_y, |
int32_t width, |
int32_t height) |
pixman_composite_info_t *info) |
{ |
PIXMAN_COMPOSITE_ARGS (info); |
uint32_t src, srca; |
uint16_t *dst_line, *dst; |
uint32_t d; |
559,13 → 478,13 |
int dst_stride, mask_stride; |
int32_t w; |
|
src = _pixman_image_get_solid (src_image, dst_image->bits.format); |
src = _pixman_image_get_solid (imp, src_image, dest_image->bits.format); |
|
srca = src >> 24; |
if (src == 0) |
return; |
|
PIXMAN_IMAGE_GET_LINE (dst_image, dest_x, dest_y, uint16_t, dst_stride, dst_line, 1); |
PIXMAN_IMAGE_GET_LINE (dest_image, dest_x, dest_y, uint16_t, dst_stride, dst_line, 1); |
PIXMAN_IMAGE_GET_LINE (mask_image, mask_x, mask_y, uint8_t, mask_stride, mask_line, 1); |
|
while (height--) |
588,15 → 507,15 |
else |
{ |
d = *dst; |
d = over (src, CONVERT_0565_TO_0888 (d)); |
d = over (src, convert_0565_to_0888 (d)); |
} |
*dst = CONVERT_8888_TO_0565 (d); |
*dst = convert_8888_to_0565 (d); |
} |
else if (m) |
{ |
d = *dst; |
d = over (in (src, m), CONVERT_0565_TO_0888 (d)); |
*dst = CONVERT_8888_TO_0565 (d); |
d = over (in (src, m), convert_0565_to_0888 (d)); |
*dst = convert_8888_to_0565 (d); |
} |
dst++; |
} |
605,19 → 524,9 |
|
static void |
fast_composite_over_n_8888_0565_ca (pixman_implementation_t *imp, |
pixman_op_t op, |
pixman_image_t * src_image, |
pixman_image_t * mask_image, |
pixman_image_t * dst_image, |
int32_t src_x, |
int32_t src_y, |
int32_t mask_x, |
int32_t mask_y, |
int32_t dest_x, |
int32_t dest_y, |
int32_t width, |
int32_t height) |
pixman_composite_info_t *info) |
{ |
PIXMAN_COMPOSITE_ARGS (info); |
uint32_t src, srca, s; |
uint16_t src16; |
uint16_t *dst_line, *dst; |
626,15 → 535,15 |
int dst_stride, mask_stride; |
int32_t w; |
|
src = _pixman_image_get_solid (src_image, dst_image->bits.format); |
src = _pixman_image_get_solid (imp, src_image, dest_image->bits.format); |
|
srca = src >> 24; |
if (src == 0) |
return; |
|
src16 = CONVERT_8888_TO_0565 (src); |
src16 = convert_8888_to_0565 (src); |
|
PIXMAN_IMAGE_GET_LINE (dst_image, dest_x, dest_y, uint16_t, dst_stride, dst_line, 1); |
PIXMAN_IMAGE_GET_LINE (dest_image, dest_x, dest_y, uint16_t, dst_stride, dst_line, 1); |
PIXMAN_IMAGE_GET_LINE (mask_image, mask_x, mask_y, uint32_t, mask_stride, mask_line, 1); |
|
while (height--) |
657,14 → 566,14 |
else |
{ |
d = *dst; |
d = over (src, CONVERT_0565_TO_0888 (d)); |
*dst = CONVERT_8888_TO_0565 (d); |
d = over (src, convert_0565_to_0888 (d)); |
*dst = convert_8888_to_0565 (d); |
} |
} |
else if (ma) |
{ |
d = *dst; |
d = CONVERT_0565_TO_0888 (d); |
d = convert_0565_to_0888 (d); |
|
s = src; |
|
673,7 → 582,7 |
ma = ~ma; |
UN8x4_MUL_UN8x4_ADD_UN8x4 (d, ma, s); |
|
*dst = CONVERT_8888_TO_0565 (d); |
*dst = convert_8888_to_0565 (d); |
} |
dst++; |
} |
682,19 → 591,9 |
|
static void |
fast_composite_over_8888_8888 (pixman_implementation_t *imp, |
pixman_op_t op, |
pixman_image_t * src_image, |
pixman_image_t * mask_image, |
pixman_image_t * dst_image, |
int32_t src_x, |
int32_t src_y, |
int32_t mask_x, |
int32_t mask_y, |
int32_t dest_x, |
int32_t dest_y, |
int32_t width, |
int32_t height) |
pixman_composite_info_t *info) |
{ |
PIXMAN_COMPOSITE_ARGS (info); |
uint32_t *dst_line, *dst; |
uint32_t *src_line, *src, s; |
int dst_stride, src_stride; |
701,7 → 600,7 |
uint8_t a; |
int32_t w; |
|
PIXMAN_IMAGE_GET_LINE (dst_image, dest_x, dest_y, uint32_t, dst_stride, dst_line, 1); |
PIXMAN_IMAGE_GET_LINE (dest_image, dest_x, dest_y, uint32_t, dst_stride, dst_line, 1); |
PIXMAN_IMAGE_GET_LINE (src_image, src_x, src_y, uint32_t, src_stride, src_line, 1); |
|
while (height--) |
727,25 → 626,15 |
|
static void |
fast_composite_src_x888_8888 (pixman_implementation_t *imp, |
pixman_op_t op, |
pixman_image_t * src_image, |
pixman_image_t * mask_image, |
pixman_image_t * dst_image, |
int32_t src_x, |
int32_t src_y, |
int32_t mask_x, |
int32_t mask_y, |
int32_t dest_x, |
int32_t dest_y, |
int32_t width, |
int32_t height) |
pixman_composite_info_t *info) |
{ |
PIXMAN_COMPOSITE_ARGS (info); |
uint32_t *dst_line, *dst; |
uint32_t *src_line, *src; |
int dst_stride, src_stride; |
int32_t w; |
|
PIXMAN_IMAGE_GET_LINE (dst_image, dest_x, dest_y, uint32_t, dst_stride, dst_line, 1); |
PIXMAN_IMAGE_GET_LINE (dest_image, dest_x, dest_y, uint32_t, dst_stride, dst_line, 1); |
PIXMAN_IMAGE_GET_LINE (src_image, src_x, src_y, uint32_t, src_stride, src_line, 1); |
|
while (height--) |
764,19 → 653,9 |
#if 0 |
static void |
fast_composite_over_8888_0888 (pixman_implementation_t *imp, |
pixman_op_t op, |
pixman_image_t * src_image, |
pixman_image_t * mask_image, |
pixman_image_t * dst_image, |
int32_t src_x, |
int32_t src_y, |
int32_t mask_x, |
int32_t mask_y, |
int32_t dest_x, |
int32_t dest_y, |
int32_t width, |
int32_t height) |
pixman_composite_info_t *info) |
{ |
PIXMAN_COMPOSITE_ARGS (info); |
uint8_t *dst_line, *dst; |
uint32_t d; |
uint32_t *src_line, *src, s; |
784,7 → 663,7 |
int dst_stride, src_stride; |
int32_t w; |
|
PIXMAN_IMAGE_GET_LINE (dst_image, dest_x, dest_y, uint8_t, dst_stride, dst_line, 3); |
PIXMAN_IMAGE_GET_LINE (dest_image, dest_x, dest_y, uint8_t, dst_stride, dst_line, 3); |
PIXMAN_IMAGE_GET_LINE (src_image, src_x, src_y, uint32_t, src_stride, src_line, 1); |
|
while (height--) |
816,19 → 695,9 |
|
static void |
fast_composite_over_8888_0565 (pixman_implementation_t *imp, |
pixman_op_t op, |
pixman_image_t * src_image, |
pixman_image_t * mask_image, |
pixman_image_t * dst_image, |
int32_t src_x, |
int32_t src_y, |
int32_t mask_x, |
int32_t mask_y, |
int32_t dest_x, |
int32_t dest_y, |
int32_t width, |
int32_t height) |
pixman_composite_info_t *info) |
{ |
PIXMAN_COMPOSITE_ARGS (info); |
uint16_t *dst_line, *dst; |
uint32_t d; |
uint32_t *src_line, *src, s; |
837,7 → 706,7 |
int32_t w; |
|
PIXMAN_IMAGE_GET_LINE (src_image, src_x, src_y, uint32_t, src_stride, src_line, 1); |
PIXMAN_IMAGE_GET_LINE (dst_image, dest_x, dest_y, uint16_t, dst_stride, dst_line, 1); |
PIXMAN_IMAGE_GET_LINE (dest_image, dest_x, dest_y, uint16_t, dst_stride, dst_line, 1); |
|
while (height--) |
{ |
860,9 → 729,9 |
else |
{ |
d = *dst; |
d = over (s, CONVERT_0565_TO_0888 (d)); |
d = over (s, convert_0565_to_0888 (d)); |
} |
*dst = CONVERT_8888_TO_0565 (d); |
*dst = convert_8888_to_0565 (d); |
} |
dst++; |
} |
870,27 → 739,19 |
} |
|
static void |
fast_composite_src_x888_0565 (pixman_implementation_t *imp, |
pixman_op_t op, |
pixman_image_t * src_image, |
pixman_image_t * mask_image, |
pixman_image_t * dst_image, |
int32_t src_x, |
int32_t src_y, |
int32_t mask_x, |
int32_t mask_y, |
int32_t dest_x, |
int32_t dest_y, |
int32_t width, |
int32_t height) |
fast_composite_add_8_8 (pixman_implementation_t *imp, |
pixman_composite_info_t *info) |
{ |
uint16_t *dst_line, *dst; |
uint32_t *src_line, *src, s; |
PIXMAN_COMPOSITE_ARGS (info); |
uint8_t *dst_line, *dst; |
uint8_t *src_line, *src; |
int dst_stride, src_stride; |
int32_t w; |
uint8_t s, d; |
uint16_t t; |
|
PIXMAN_IMAGE_GET_LINE (src_image, src_x, src_y, uint32_t, src_stride, src_line, 1); |
PIXMAN_IMAGE_GET_LINE (dst_image, dest_x, dest_y, uint16_t, dst_stride, dst_line, 1); |
PIXMAN_IMAGE_GET_LINE (src_image, src_x, src_y, uint8_t, src_stride, src_line, 1); |
PIXMAN_IMAGE_GET_LINE (dest_image, dest_x, dest_y, uint8_t, dst_stride, dst_line, 1); |
|
while (height--) |
{ |
903,7 → 764,16 |
while (w--) |
{ |
s = *src++; |
*dst = CONVERT_8888_TO_0565 (s); |
if (s) |
{ |
if (s != 0xff) |
{ |
d = *dst; |
t = d + s; |
s = t | (0 - (t >> 8)); |
} |
*dst = s; |
} |
dst++; |
} |
} |
910,29 → 780,19 |
} |
|
static void |
fast_composite_add_8_8 (pixman_implementation_t *imp, |
pixman_op_t op, |
pixman_image_t * src_image, |
pixman_image_t * mask_image, |
pixman_image_t * dst_image, |
int32_t src_x, |
int32_t src_y, |
int32_t mask_x, |
int32_t mask_y, |
int32_t dest_x, |
int32_t dest_y, |
int32_t width, |
int32_t height) |
fast_composite_add_0565_0565 (pixman_implementation_t *imp, |
pixman_composite_info_t *info) |
{ |
uint8_t *dst_line, *dst; |
uint8_t *src_line, *src; |
PIXMAN_COMPOSITE_ARGS (info); |
uint16_t *dst_line, *dst; |
uint32_t d; |
uint16_t *src_line, *src; |
uint32_t s; |
int dst_stride, src_stride; |
int32_t w; |
uint8_t s, d; |
uint16_t t; |
|
PIXMAN_IMAGE_GET_LINE (src_image, src_x, src_y, uint8_t, src_stride, src_line, 1); |
PIXMAN_IMAGE_GET_LINE (dst_image, dest_x, dest_y, uint8_t, dst_stride, dst_line, 1); |
PIXMAN_IMAGE_GET_LINE (src_image, src_x, src_y, uint16_t, src_stride, src_line, 1); |
PIXMAN_IMAGE_GET_LINE (dest_image, dest_x, dest_y, uint16_t, dst_stride, dst_line, 1); |
|
while (height--) |
{ |
947,13 → 807,14 |
s = *src++; |
if (s) |
{ |
if (s != 0xff) |
d = *dst; |
s = convert_0565_to_8888 (s); |
if (d) |
{ |
d = *dst; |
t = d + s; |
s = t | (0 - (t >> 8)); |
d = convert_0565_to_8888 (d); |
UN8x4_ADD_UN8x4 (s, d); |
} |
*dst = s; |
*dst = convert_8888_to_0565 (s); |
} |
dst++; |
} |
962,19 → 823,9 |
|
static void |
fast_composite_add_8888_8888 (pixman_implementation_t *imp, |
pixman_op_t op, |
pixman_image_t * src_image, |
pixman_image_t * mask_image, |
pixman_image_t * dst_image, |
int32_t src_x, |
int32_t src_y, |
int32_t mask_x, |
int32_t mask_y, |
int32_t dest_x, |
int32_t dest_y, |
int32_t width, |
int32_t height) |
pixman_composite_info_t *info) |
{ |
PIXMAN_COMPOSITE_ARGS (info); |
uint32_t *dst_line, *dst; |
uint32_t *src_line, *src; |
int dst_stride, src_stride; |
982,7 → 833,7 |
uint32_t s, d; |
|
PIXMAN_IMAGE_GET_LINE (src_image, src_x, src_y, uint32_t, src_stride, src_line, 1); |
PIXMAN_IMAGE_GET_LINE (dst_image, dest_x, dest_y, uint32_t, dst_stride, dst_line, 1); |
PIXMAN_IMAGE_GET_LINE (dest_image, dest_x, dest_y, uint32_t, dst_stride, dst_line, 1); |
|
while (height--) |
{ |
1012,19 → 863,9 |
|
static void |
fast_composite_add_n_8_8 (pixman_implementation_t *imp, |
pixman_op_t op, |
pixman_image_t * src_image, |
pixman_image_t * mask_image, |
pixman_image_t * dst_image, |
int32_t src_x, |
int32_t src_y, |
int32_t mask_x, |
int32_t mask_y, |
int32_t dest_x, |
int32_t dest_y, |
int32_t width, |
int32_t height) |
pixman_composite_info_t *info) |
{ |
PIXMAN_COMPOSITE_ARGS (info); |
uint8_t *dst_line, *dst; |
uint8_t *mask_line, *mask; |
int dst_stride, mask_stride; |
1032,9 → 873,9 |
uint32_t src; |
uint8_t sa; |
|
PIXMAN_IMAGE_GET_LINE (dst_image, dest_x, dest_y, uint8_t, dst_stride, dst_line, 1); |
PIXMAN_IMAGE_GET_LINE (dest_image, dest_x, dest_y, uint8_t, dst_stride, dst_line, 1); |
PIXMAN_IMAGE_GET_LINE (mask_image, mask_x, mask_y, uint8_t, mask_stride, mask_line, 1); |
src = _pixman_image_get_solid (src_image, dst_image->bits.format); |
src = _pixman_image_get_solid (imp, src_image, dest_image->bits.format); |
sa = (src >> 24); |
|
while (height--) |
1077,20 → 918,10 |
do { *((p) + ((n) >> 5)) |= CREATE_BITMASK ((n) & 31); } while (0); |
|
static void |
fast_composite_add_1000_1000 (pixman_implementation_t *imp, |
pixman_op_t op, |
pixman_image_t * src_image, |
pixman_image_t * mask_image, |
pixman_image_t * dst_image, |
int32_t src_x, |
int32_t src_y, |
int32_t mask_x, |
int32_t mask_y, |
int32_t dest_x, |
int32_t dest_y, |
int32_t width, |
int32_t height) |
fast_composite_add_1_1 (pixman_implementation_t *imp, |
pixman_composite_info_t *info) |
{ |
PIXMAN_COMPOSITE_ARGS (info); |
uint32_t *dst_line, *dst; |
uint32_t *src_line, *src; |
int dst_stride, src_stride; |
1098,7 → 929,7 |
|
PIXMAN_IMAGE_GET_LINE (src_image, 0, src_y, uint32_t, |
src_stride, src_line, 1); |
PIXMAN_IMAGE_GET_LINE (dst_image, 0, dest_y, uint32_t, |
PIXMAN_IMAGE_GET_LINE (dest_image, 0, dest_y, uint32_t, |
dst_stride, dst_line, 1); |
|
while (height--) |
1123,19 → 954,9 |
|
static void |
fast_composite_over_n_1_8888 (pixman_implementation_t *imp, |
pixman_op_t op, |
pixman_image_t * src_image, |
pixman_image_t * mask_image, |
pixman_image_t * dst_image, |
int32_t src_x, |
int32_t src_y, |
int32_t mask_x, |
int32_t mask_y, |
int32_t dest_x, |
int32_t dest_y, |
int32_t width, |
int32_t height) |
pixman_composite_info_t *info) |
{ |
PIXMAN_COMPOSITE_ARGS (info); |
uint32_t src, srca; |
uint32_t *dst, *dst_line; |
uint32_t *mask, *mask_line; |
1146,12 → 967,12 |
if (width <= 0) |
return; |
|
src = _pixman_image_get_solid (src_image, dst_image->bits.format); |
src = _pixman_image_get_solid (imp, src_image, dest_image->bits.format); |
srca = src >> 24; |
if (src == 0) |
return; |
|
PIXMAN_IMAGE_GET_LINE (dst_image, dest_x, dest_y, uint32_t, |
PIXMAN_IMAGE_GET_LINE (dest_image, dest_x, dest_y, uint32_t, |
dst_stride, dst_line, 1); |
PIXMAN_IMAGE_GET_LINE (mask_image, 0, mask_y, uint32_t, |
mask_stride, mask_line, 1); |
1215,19 → 1036,9 |
|
static void |
fast_composite_over_n_1_0565 (pixman_implementation_t *imp, |
pixman_op_t op, |
pixman_image_t * src_image, |
pixman_image_t * mask_image, |
pixman_image_t * dst_image, |
int32_t src_x, |
int32_t src_y, |
int32_t mask_x, |
int32_t mask_y, |
int32_t dest_x, |
int32_t dest_y, |
int32_t width, |
int32_t height) |
pixman_composite_info_t *info) |
{ |
PIXMAN_COMPOSITE_ARGS (info); |
uint32_t src, srca; |
uint16_t *dst, *dst_line; |
uint32_t *mask, *mask_line; |
1240,12 → 1051,12 |
if (width <= 0) |
return; |
|
src = _pixman_image_get_solid (src_image, dst_image->bits.format); |
src = _pixman_image_get_solid (imp, src_image, dest_image->bits.format); |
srca = src >> 24; |
if (src == 0) |
return; |
|
PIXMAN_IMAGE_GET_LINE (dst_image, dest_x, dest_y, uint16_t, |
PIXMAN_IMAGE_GET_LINE (dest_image, dest_x, dest_y, uint16_t, |
dst_stride, dst_line, 1); |
PIXMAN_IMAGE_GET_LINE (mask_image, 0, mask_y, uint32_t, |
mask_stride, mask_line, 1); |
1253,7 → 1064,7 |
|
if (srca == 0xff) |
{ |
src565 = CONVERT_8888_TO_0565 (src); |
src565 = convert_8888_to_0565 (src); |
while (height--) |
{ |
dst = dst_line; |
1301,8 → 1112,8 |
} |
if (bitcache & bitmask) |
{ |
d = over (src, CONVERT_0565_TO_0888 (*dst)); |
*dst = CONVERT_8888_TO_0565 (d); |
d = over (src, convert_0565_to_0888 (*dst)); |
*dst = convert_8888_to_0565 (d); |
} |
bitmask = UPDATE_BITMASK (bitmask); |
dst++; |
1317,35 → 1128,29 |
|
static void |
fast_composite_solid_fill (pixman_implementation_t *imp, |
pixman_op_t op, |
pixman_image_t * src_image, |
pixman_image_t * mask_image, |
pixman_image_t * dst_image, |
int32_t src_x, |
int32_t src_y, |
int32_t mask_x, |
int32_t mask_y, |
int32_t dest_x, |
int32_t dest_y, |
int32_t width, |
int32_t height) |
pixman_composite_info_t *info) |
{ |
PIXMAN_COMPOSITE_ARGS (info); |
uint32_t src; |
|
src = _pixman_image_get_solid (src_image, dst_image->bits.format); |
src = _pixman_image_get_solid (imp, src_image, dest_image->bits.format); |
|
if (dst_image->bits.format == PIXMAN_a8) |
if (dest_image->bits.format == PIXMAN_a1) |
{ |
src = src >> 31; |
} |
else if (dest_image->bits.format == PIXMAN_a8) |
{ |
src = src >> 24; |
} |
else if (dst_image->bits.format == PIXMAN_r5g6b5 || |
dst_image->bits.format == PIXMAN_b5g6r5) |
else if (dest_image->bits.format == PIXMAN_r5g6b5 || |
dest_image->bits.format == PIXMAN_b5g6r5) |
{ |
src = CONVERT_8888_TO_0565 (src); |
src = convert_8888_to_0565 (src); |
} |
|
pixman_fill (dst_image->bits.bits, dst_image->bits.rowstride, |
PIXMAN_FORMAT_BPP (dst_image->bits.format), |
pixman_fill (dest_image->bits.bits, dest_image->bits.rowstride, |
PIXMAN_FORMAT_BPP (dest_image->bits.format), |
dest_x, dest_y, |
width, height, |
src); |
1353,20 → 1158,10 |
|
static void |
fast_composite_src_memcpy (pixman_implementation_t *imp, |
pixman_op_t op, |
pixman_image_t * src_image, |
pixman_image_t * mask_image, |
pixman_image_t * dst_image, |
int32_t src_x, |
int32_t src_y, |
int32_t mask_x, |
int32_t mask_y, |
int32_t dest_x, |
int32_t dest_y, |
int32_t width, |
int32_t height) |
pixman_composite_info_t *info) |
{ |
int bpp = PIXMAN_FORMAT_BPP (dst_image->bits.format) / 8; |
PIXMAN_COMPOSITE_ARGS (info); |
int bpp = PIXMAN_FORMAT_BPP (dest_image->bits.format) / 8; |
uint32_t n_bytes = width * bpp; |
int dst_stride, src_stride; |
uint8_t *dst; |
1373,10 → 1168,10 |
uint8_t *src; |
|
src_stride = src_image->bits.rowstride * 4; |
dst_stride = dst_image->bits.rowstride * 4; |
dst_stride = dest_image->bits.rowstride * 4; |
|
src = (uint8_t *)src_image->bits.bits + src_y * src_stride + src_x * bpp; |
dst = (uint8_t *)dst_image->bits.bits + dest_y * dst_stride + dest_x * bpp; |
dst = (uint8_t *)dest_image->bits.bits + dest_y * dst_stride + dest_x * bpp; |
|
while (height--) |
{ |
1387,43 → 1182,211 |
} |
} |
|
FAST_NEAREST (8888_8888_cover, 8888, 8888, uint32_t, uint32_t, SRC, COVER); |
FAST_NEAREST (8888_8888_none, 8888, 8888, uint32_t, uint32_t, SRC, NONE); |
FAST_NEAREST (8888_8888_pad, 8888, 8888, uint32_t, uint32_t, SRC, PAD); |
FAST_NEAREST (8888_8888_normal, 8888, 8888, uint32_t, uint32_t, SRC, NORMAL); |
FAST_NEAREST (8888_8888_cover, 8888, 8888, uint32_t, uint32_t, OVER, COVER); |
FAST_NEAREST (8888_8888_none, 8888, 8888, uint32_t, uint32_t, OVER, NONE); |
FAST_NEAREST (8888_8888_pad, 8888, 8888, uint32_t, uint32_t, OVER, PAD); |
FAST_NEAREST (8888_8888_normal, 8888, 8888, uint32_t, uint32_t, OVER, NORMAL); |
FAST_NEAREST (8888_565_cover, 8888, 0565, uint32_t, uint16_t, SRC, COVER); |
FAST_NEAREST (8888_565_none, 8888, 0565, uint32_t, uint16_t, SRC, NONE); |
FAST_NEAREST (8888_565_pad, 8888, 0565, uint32_t, uint16_t, SRC, PAD); |
FAST_NEAREST (8888_565_normal, 8888, 0565, uint32_t, uint16_t, SRC, NORMAL); |
FAST_NEAREST (565_565_normal, 0565, 0565, uint16_t, uint16_t, SRC, NORMAL); |
FAST_NEAREST (8888_565_cover, 8888, 0565, uint32_t, uint16_t, OVER, COVER); |
FAST_NEAREST (8888_565_none, 8888, 0565, uint32_t, uint16_t, OVER, NONE); |
FAST_NEAREST (8888_565_pad, 8888, 0565, uint32_t, uint16_t, OVER, PAD); |
FAST_NEAREST (8888_565_normal, 8888, 0565, uint32_t, uint16_t, OVER, NORMAL); |
FAST_NEAREST (8888_8888_cover, 8888, 8888, uint32_t, uint32_t, SRC, COVER) |
FAST_NEAREST (8888_8888_none, 8888, 8888, uint32_t, uint32_t, SRC, NONE) |
FAST_NEAREST (8888_8888_pad, 8888, 8888, uint32_t, uint32_t, SRC, PAD) |
FAST_NEAREST (8888_8888_normal, 8888, 8888, uint32_t, uint32_t, SRC, NORMAL) |
FAST_NEAREST (x888_8888_cover, x888, 8888, uint32_t, uint32_t, SRC, COVER) |
FAST_NEAREST (x888_8888_pad, x888, 8888, uint32_t, uint32_t, SRC, PAD) |
FAST_NEAREST (x888_8888_normal, x888, 8888, uint32_t, uint32_t, SRC, NORMAL) |
FAST_NEAREST (8888_8888_cover, 8888, 8888, uint32_t, uint32_t, OVER, COVER) |
FAST_NEAREST (8888_8888_none, 8888, 8888, uint32_t, uint32_t, OVER, NONE) |
FAST_NEAREST (8888_8888_pad, 8888, 8888, uint32_t, uint32_t, OVER, PAD) |
FAST_NEAREST (8888_8888_normal, 8888, 8888, uint32_t, uint32_t, OVER, NORMAL) |
FAST_NEAREST (8888_565_cover, 8888, 0565, uint32_t, uint16_t, SRC, COVER) |
FAST_NEAREST (8888_565_none, 8888, 0565, uint32_t, uint16_t, SRC, NONE) |
FAST_NEAREST (8888_565_pad, 8888, 0565, uint32_t, uint16_t, SRC, PAD) |
FAST_NEAREST (8888_565_normal, 8888, 0565, uint32_t, uint16_t, SRC, NORMAL) |
FAST_NEAREST (565_565_normal, 0565, 0565, uint16_t, uint16_t, SRC, NORMAL) |
FAST_NEAREST (8888_565_cover, 8888, 0565, uint32_t, uint16_t, OVER, COVER) |
FAST_NEAREST (8888_565_none, 8888, 0565, uint32_t, uint16_t, OVER, NONE) |
FAST_NEAREST (8888_565_pad, 8888, 0565, uint32_t, uint16_t, OVER, PAD) |
FAST_NEAREST (8888_565_normal, 8888, 0565, uint32_t, uint16_t, OVER, NORMAL) |
|
#define REPEAT_MIN_WIDTH 32 |
|
static void |
fast_composite_tiled_repeat (pixman_implementation_t *imp, |
pixman_composite_info_t *info) |
{ |
PIXMAN_COMPOSITE_ARGS (info); |
pixman_composite_func_t func; |
pixman_format_code_t mask_format; |
uint32_t src_flags, mask_flags; |
int32_t sx, sy; |
int32_t width_remain; |
int32_t num_pixels; |
int32_t src_width; |
int32_t i, j; |
pixman_image_t extended_src_image; |
uint32_t extended_src[REPEAT_MIN_WIDTH * 2]; |
pixman_bool_t need_src_extension; |
uint32_t *src_line; |
int32_t src_stride; |
int32_t src_bpp; |
pixman_composite_info_t info2 = *info; |
|
src_flags = (info->src_flags & ~FAST_PATH_NORMAL_REPEAT) | |
FAST_PATH_SAMPLES_COVER_CLIP_NEAREST; |
|
if (mask_image) |
{ |
mask_format = mask_image->common.extended_format_code; |
mask_flags = info->mask_flags; |
} |
else |
{ |
mask_format = PIXMAN_null; |
mask_flags = FAST_PATH_IS_OPAQUE; |
} |
|
_pixman_implementation_lookup_composite ( |
imp->toplevel, info->op, |
src_image->common.extended_format_code, src_flags, |
mask_format, mask_flags, |
dest_image->common.extended_format_code, info->dest_flags, |
&imp, &func); |
|
src_bpp = PIXMAN_FORMAT_BPP (src_image->bits.format); |
|
if (src_image->bits.width < REPEAT_MIN_WIDTH && |
(src_bpp == 32 || src_bpp == 16 || src_bpp == 8) && |
!src_image->bits.indexed) |
{ |
sx = src_x; |
sx = MOD (sx, src_image->bits.width); |
sx += width; |
src_width = 0; |
|
while (src_width < REPEAT_MIN_WIDTH && src_width <= sx) |
src_width += src_image->bits.width; |
|
src_stride = (src_width * (src_bpp >> 3) + 3) / (int) sizeof (uint32_t); |
|
/* Initialize/validate stack-allocated temporary image */ |
_pixman_bits_image_init (&extended_src_image, src_image->bits.format, |
src_width, 1, &extended_src[0], src_stride, |
FALSE); |
_pixman_image_validate (&extended_src_image); |
|
info2.src_image = &extended_src_image; |
need_src_extension = TRUE; |
} |
else |
{ |
src_width = src_image->bits.width; |
need_src_extension = FALSE; |
} |
|
sx = src_x; |
sy = src_y; |
|
while (--height >= 0) |
{ |
sx = MOD (sx, src_width); |
sy = MOD (sy, src_image->bits.height); |
|
if (need_src_extension) |
{ |
if (src_bpp == 32) |
{ |
PIXMAN_IMAGE_GET_LINE (src_image, 0, sy, uint32_t, src_stride, src_line, 1); |
|
for (i = 0; i < src_width; ) |
{ |
for (j = 0; j < src_image->bits.width; j++, i++) |
extended_src[i] = src_line[j]; |
} |
} |
else if (src_bpp == 16) |
{ |
uint16_t *src_line_16; |
|
PIXMAN_IMAGE_GET_LINE (src_image, 0, sy, uint16_t, src_stride, |
src_line_16, 1); |
src_line = (uint32_t*)src_line_16; |
|
for (i = 0; i < src_width; ) |
{ |
for (j = 0; j < src_image->bits.width; j++, i++) |
((uint16_t*)extended_src)[i] = ((uint16_t*)src_line)[j]; |
} |
} |
else if (src_bpp == 8) |
{ |
uint8_t *src_line_8; |
|
PIXMAN_IMAGE_GET_LINE (src_image, 0, sy, uint8_t, src_stride, |
src_line_8, 1); |
src_line = (uint32_t*)src_line_8; |
|
for (i = 0; i < src_width; ) |
{ |
for (j = 0; j < src_image->bits.width; j++, i++) |
((uint8_t*)extended_src)[i] = ((uint8_t*)src_line)[j]; |
} |
} |
|
info2.src_y = 0; |
} |
else |
{ |
info2.src_y = sy; |
} |
|
width_remain = width; |
|
while (width_remain > 0) |
{ |
num_pixels = src_width - sx; |
|
if (num_pixels > width_remain) |
num_pixels = width_remain; |
|
info2.src_x = sx; |
info2.width = num_pixels; |
info2.height = 1; |
|
func (imp, &info2); |
|
width_remain -= num_pixels; |
info2.mask_x += num_pixels; |
info2.dest_x += num_pixels; |
sx = 0; |
} |
|
sx = src_x; |
sy++; |
info2.mask_x = info->mask_x; |
info2.mask_y++; |
info2.dest_x = info->dest_x; |
info2.dest_y++; |
} |
|
if (need_src_extension) |
_pixman_image_fini (&extended_src_image); |
} |
|
/* Use more unrolling for src_0565_0565 because it is typically CPU bound */ |
static force_inline void |
scaled_nearest_scanline_565_565_SRC (uint16_t * dst, |
uint16_t * src, |
const uint16_t * src, |
int32_t w, |
pixman_fixed_t vx, |
pixman_fixed_t unit_x, |
pixman_fixed_t max_vx) |
pixman_fixed_t max_vx, |
pixman_bool_t fully_transparent_src) |
{ |
uint16_t tmp1, tmp2, tmp3, tmp4; |
while ((w -= 4) >= 0) |
{ |
tmp1 = src[pixman_fixed_to_int (vx)]; |
tmp1 = *(src + pixman_fixed_to_int (vx)); |
vx += unit_x; |
tmp2 = src[pixman_fixed_to_int (vx)]; |
tmp2 = *(src + pixman_fixed_to_int (vx)); |
vx += unit_x; |
tmp3 = src[pixman_fixed_to_int (vx)]; |
tmp3 = *(src + pixman_fixed_to_int (vx)); |
vx += unit_x; |
tmp4 = src[pixman_fixed_to_int (vx)]; |
tmp4 = *(src + pixman_fixed_to_int (vx)); |
vx += unit_x; |
*dst++ = tmp1; |
*dst++ = tmp2; |
1432,26 → 1395,26 |
} |
if (w & 2) |
{ |
tmp1 = src[pixman_fixed_to_int (vx)]; |
tmp1 = *(src + pixman_fixed_to_int (vx)); |
vx += unit_x; |
tmp2 = src[pixman_fixed_to_int (vx)]; |
tmp2 = *(src + pixman_fixed_to_int (vx)); |
vx += unit_x; |
*dst++ = tmp1; |
*dst++ = tmp2; |
} |
if (w & 1) |
*dst++ = src[pixman_fixed_to_int (vx)]; |
*dst = *(src + pixman_fixed_to_int (vx)); |
} |
|
FAST_NEAREST_MAINLOOP (565_565_cover_SRC, |
scaled_nearest_scanline_565_565_SRC, |
uint16_t, uint16_t, COVER); |
uint16_t, uint16_t, COVER) |
FAST_NEAREST_MAINLOOP (565_565_none_SRC, |
scaled_nearest_scanline_565_565_SRC, |
uint16_t, uint16_t, NONE); |
uint16_t, uint16_t, NONE) |
FAST_NEAREST_MAINLOOP (565_565_pad_SRC, |
scaled_nearest_scanline_565_565_SRC, |
uint16_t, uint16_t, PAD); |
uint16_t, uint16_t, PAD) |
|
static force_inline uint32_t |
fetch_nearest (pixman_repeat_t src_repeat, |
1460,7 → 1423,7 |
{ |
if (repeat (src_repeat, &x, src_width)) |
{ |
if (format == PIXMAN_x8r8g8b8) |
if (format == PIXMAN_x8r8g8b8 || format == PIXMAN_x8b8g8r8) |
return *(src + x) | 0xff000000; |
else |
return *(src + x); |
1493,19 → 1456,9 |
|
static void |
fast_composite_scaled_nearest (pixman_implementation_t *imp, |
pixman_op_t op, |
pixman_image_t * src_image, |
pixman_image_t * mask_image, |
pixman_image_t * dst_image, |
int32_t src_x, |
int32_t src_y, |
int32_t mask_x, |
int32_t mask_y, |
int32_t dest_x, |
int32_t dest_y, |
int32_t width, |
int32_t height) |
pixman_composite_info_t *info) |
{ |
PIXMAN_COMPOSITE_ARGS (info); |
uint32_t *dst_line; |
uint32_t *src_line; |
int dst_stride, src_stride; |
1516,7 → 1469,7 |
pixman_vector_t v; |
pixman_fixed_t vy; |
|
PIXMAN_IMAGE_GET_LINE (dst_image, dest_x, dest_y, uint32_t, dst_stride, dst_line, 1); |
PIXMAN_IMAGE_GET_LINE (dest_image, dest_x, dest_y, uint32_t, dst_stride, dst_line, 1); |
/* pass in 0 instead of src_x and src_y because src_x and src_y need to be |
* transformed from destination space to source space |
*/ |
1613,6 → 1566,252 |
} |
} |
|
#define CACHE_LINE_SIZE 64 |
|
#define FAST_SIMPLE_ROTATE(suffix, pix_type) \ |
\ |
static void \ |
blt_rotated_90_trivial_##suffix (pix_type *dst, \ |
int dst_stride, \ |
const pix_type *src, \ |
int src_stride, \ |
int w, \ |
int h) \ |
{ \ |
int x, y; \ |
for (y = 0; y < h; y++) \ |
{ \ |
const pix_type *s = src + (h - y - 1); \ |
pix_type *d = dst + dst_stride * y; \ |
for (x = 0; x < w; x++) \ |
{ \ |
*d++ = *s; \ |
s += src_stride; \ |
} \ |
} \ |
} \ |
\ |
static void \ |
blt_rotated_270_trivial_##suffix (pix_type *dst, \ |
int dst_stride, \ |
const pix_type *src, \ |
int src_stride, \ |
int w, \ |
int h) \ |
{ \ |
int x, y; \ |
for (y = 0; y < h; y++) \ |
{ \ |
const pix_type *s = src + src_stride * (w - 1) + y; \ |
pix_type *d = dst + dst_stride * y; \ |
for (x = 0; x < w; x++) \ |
{ \ |
*d++ = *s; \ |
s -= src_stride; \ |
} \ |
} \ |
} \ |
\ |
static void \ |
blt_rotated_90_##suffix (pix_type *dst, \ |
int dst_stride, \ |
const pix_type *src, \ |
int src_stride, \ |
int W, \ |
int H) \ |
{ \ |
int x; \ |
int leading_pixels = 0, trailing_pixels = 0; \ |
const int TILE_SIZE = CACHE_LINE_SIZE / sizeof(pix_type); \ |
\ |
/* \ |
* split processing into handling destination as TILE_SIZExH cache line \ |
* aligned vertical stripes (optimistically assuming that destination \ |
* stride is a multiple of cache line, if not - it will be just a bit \ |
* slower) \ |
*/ \ |
\ |
if ((uintptr_t)dst & (CACHE_LINE_SIZE - 1)) \ |
{ \ |
leading_pixels = TILE_SIZE - (((uintptr_t)dst & \ |
(CACHE_LINE_SIZE - 1)) / sizeof(pix_type)); \ |
if (leading_pixels > W) \ |
leading_pixels = W; \ |
\ |
/* unaligned leading part NxH (where N < TILE_SIZE) */ \ |
blt_rotated_90_trivial_##suffix ( \ |
dst, \ |
dst_stride, \ |
src, \ |
src_stride, \ |
leading_pixels, \ |
H); \ |
\ |
dst += leading_pixels; \ |
src += leading_pixels * src_stride; \ |
W -= leading_pixels; \ |
} \ |
\ |
if ((uintptr_t)(dst + W) & (CACHE_LINE_SIZE - 1)) \ |
{ \ |
trailing_pixels = (((uintptr_t)(dst + W) & \ |
(CACHE_LINE_SIZE - 1)) / sizeof(pix_type)); \ |
if (trailing_pixels > W) \ |
trailing_pixels = W; \ |
W -= trailing_pixels; \ |
} \ |
\ |
for (x = 0; x < W; x += TILE_SIZE) \ |
{ \ |
/* aligned middle part TILE_SIZExH */ \ |
blt_rotated_90_trivial_##suffix ( \ |
dst + x, \ |
dst_stride, \ |
src + src_stride * x, \ |
src_stride, \ |
TILE_SIZE, \ |
H); \ |
} \ |
\ |
if (trailing_pixels) \ |
{ \ |
/* unaligned trailing part NxH (where N < TILE_SIZE) */ \ |
blt_rotated_90_trivial_##suffix ( \ |
dst + W, \ |
dst_stride, \ |
src + W * src_stride, \ |
src_stride, \ |
trailing_pixels, \ |
H); \ |
} \ |
} \ |
\ |
static void \ |
blt_rotated_270_##suffix (pix_type *dst, \ |
int dst_stride, \ |
const pix_type *src, \ |
int src_stride, \ |
int W, \ |
int H) \ |
{ \ |
int x; \ |
int leading_pixels = 0, trailing_pixels = 0; \ |
const int TILE_SIZE = CACHE_LINE_SIZE / sizeof(pix_type); \ |
\ |
/* \ |
* split processing into handling destination as TILE_SIZExH cache line \ |
* aligned vertical stripes (optimistically assuming that destination \ |
* stride is a multiple of cache line, if not - it will be just a bit \ |
* slower) \ |
*/ \ |
\ |
if ((uintptr_t)dst & (CACHE_LINE_SIZE - 1)) \ |
{ \ |
leading_pixels = TILE_SIZE - (((uintptr_t)dst & \ |
(CACHE_LINE_SIZE - 1)) / sizeof(pix_type)); \ |
if (leading_pixels > W) \ |
leading_pixels = W; \ |
\ |
/* unaligned leading part NxH (where N < TILE_SIZE) */ \ |
blt_rotated_270_trivial_##suffix ( \ |
dst, \ |
dst_stride, \ |
src + src_stride * (W - leading_pixels), \ |
src_stride, \ |
leading_pixels, \ |
H); \ |
\ |
dst += leading_pixels; \ |
W -= leading_pixels; \ |
} \ |
\ |
if ((uintptr_t)(dst + W) & (CACHE_LINE_SIZE - 1)) \ |
{ \ |
trailing_pixels = (((uintptr_t)(dst + W) & \ |
(CACHE_LINE_SIZE - 1)) / sizeof(pix_type)); \ |
if (trailing_pixels > W) \ |
trailing_pixels = W; \ |
W -= trailing_pixels; \ |
src += trailing_pixels * src_stride; \ |
} \ |
\ |
for (x = 0; x < W; x += TILE_SIZE) \ |
{ \ |
/* aligned middle part TILE_SIZExH */ \ |
blt_rotated_270_trivial_##suffix ( \ |
dst + x, \ |
dst_stride, \ |
src + src_stride * (W - x - TILE_SIZE), \ |
src_stride, \ |
TILE_SIZE, \ |
H); \ |
} \ |
\ |
if (trailing_pixels) \ |
{ \ |
/* unaligned trailing part NxH (where N < TILE_SIZE) */ \ |
blt_rotated_270_trivial_##suffix ( \ |
dst + W, \ |
dst_stride, \ |
src - trailing_pixels * src_stride, \ |
src_stride, \ |
trailing_pixels, \ |
H); \ |
} \ |
} \ |
\ |
static void \ |
fast_composite_rotate_90_##suffix (pixman_implementation_t *imp, \ |
pixman_composite_info_t *info) \ |
{ \ |
PIXMAN_COMPOSITE_ARGS (info); \ |
pix_type *dst_line; \ |
pix_type *src_line; \ |
int dst_stride, src_stride; \ |
int src_x_t, src_y_t; \ |
\ |
PIXMAN_IMAGE_GET_LINE (dest_image, dest_x, dest_y, pix_type, \ |
dst_stride, dst_line, 1); \ |
src_x_t = -src_y + pixman_fixed_to_int ( \ |
src_image->common.transform->matrix[0][2] + \ |
pixman_fixed_1 / 2 - pixman_fixed_e) - height;\ |
src_y_t = src_x + pixman_fixed_to_int ( \ |
src_image->common.transform->matrix[1][2] + \ |
pixman_fixed_1 / 2 - pixman_fixed_e); \ |
PIXMAN_IMAGE_GET_LINE (src_image, src_x_t, src_y_t, pix_type, \ |
src_stride, src_line, 1); \ |
blt_rotated_90_##suffix (dst_line, dst_stride, src_line, src_stride, \ |
width, height); \ |
} \ |
\ |
static void \ |
fast_composite_rotate_270_##suffix (pixman_implementation_t *imp, \ |
pixman_composite_info_t *info) \ |
{ \ |
PIXMAN_COMPOSITE_ARGS (info); \ |
pix_type *dst_line; \ |
pix_type *src_line; \ |
int dst_stride, src_stride; \ |
int src_x_t, src_y_t; \ |
\ |
PIXMAN_IMAGE_GET_LINE (dest_image, dest_x, dest_y, pix_type, \ |
dst_stride, dst_line, 1); \ |
src_x_t = src_y + pixman_fixed_to_int ( \ |
src_image->common.transform->matrix[0][2] + \ |
pixman_fixed_1 / 2 - pixman_fixed_e); \ |
src_y_t = -src_x + pixman_fixed_to_int ( \ |
src_image->common.transform->matrix[1][2] + \ |
pixman_fixed_1 / 2 - pixman_fixed_e) - width; \ |
PIXMAN_IMAGE_GET_LINE (src_image, src_x_t, src_y_t, pix_type, \ |
src_stride, src_line, 1); \ |
blt_rotated_270_##suffix (dst_line, dst_stride, src_line, src_stride, \ |
width, height); \ |
} |
|
FAST_SIMPLE_ROTATE (8, uint8_t) |
FAST_SIMPLE_ROTATE (565, uint16_t) |
FAST_SIMPLE_ROTATE (8888, uint32_t) |
|
static const pixman_fast_path_t c_fast_paths[] = |
{ |
PIXMAN_STD_FAST_PATH (OVER, solid, a8, r5g6b5, fast_composite_over_n_8_0565), |
1645,10 → 1844,12 |
PIXMAN_STD_FAST_PATH (OVER, a8b8g8r8, null, a8b8g8r8, fast_composite_over_8888_8888), |
PIXMAN_STD_FAST_PATH (OVER, a8b8g8r8, null, x8b8g8r8, fast_composite_over_8888_8888), |
PIXMAN_STD_FAST_PATH (OVER, a8b8g8r8, null, b5g6r5, fast_composite_over_8888_0565), |
PIXMAN_STD_FAST_PATH (ADD, r5g6b5, null, r5g6b5, fast_composite_add_0565_0565), |
PIXMAN_STD_FAST_PATH (ADD, b5g6r5, null, b5g6r5, fast_composite_add_0565_0565), |
PIXMAN_STD_FAST_PATH (ADD, a8r8g8b8, null, a8r8g8b8, fast_composite_add_8888_8888), |
PIXMAN_STD_FAST_PATH (ADD, a8b8g8r8, null, a8b8g8r8, fast_composite_add_8888_8888), |
PIXMAN_STD_FAST_PATH (ADD, a8, null, a8, fast_composite_add_8_8), |
PIXMAN_STD_FAST_PATH (ADD, a1, null, a1, fast_composite_add_1000_1000), |
PIXMAN_STD_FAST_PATH (ADD, a1, null, a1, fast_composite_add_1_1), |
PIXMAN_STD_FAST_PATH_CA (ADD, solid, a8r8g8b8, a8r8g8b8, fast_composite_add_n_8888_8888_ca), |
PIXMAN_STD_FAST_PATH (ADD, solid, a8, a8, fast_composite_add_n_8_8), |
PIXMAN_STD_FAST_PATH (SRC, solid, null, a8r8g8b8, fast_composite_solid_fill), |
1655,6 → 1856,7 |
PIXMAN_STD_FAST_PATH (SRC, solid, null, x8r8g8b8, fast_composite_solid_fill), |
PIXMAN_STD_FAST_PATH (SRC, solid, null, a8b8g8r8, fast_composite_solid_fill), |
PIXMAN_STD_FAST_PATH (SRC, solid, null, x8b8g8r8, fast_composite_solid_fill), |
PIXMAN_STD_FAST_PATH (SRC, solid, null, a1, fast_composite_solid_fill), |
PIXMAN_STD_FAST_PATH (SRC, solid, null, a8, fast_composite_solid_fill), |
PIXMAN_STD_FAST_PATH (SRC, solid, null, r5g6b5, fast_composite_solid_fill), |
PIXMAN_STD_FAST_PATH (SRC, x8r8g8b8, null, a8r8g8b8, fast_composite_src_x888_8888), |
1675,10 → 1877,6 |
PIXMAN_STD_FAST_PATH (SRC, x1r5g5b5, null, x1r5g5b5, fast_composite_src_memcpy), |
PIXMAN_STD_FAST_PATH (SRC, a1r5g5b5, null, x1r5g5b5, fast_composite_src_memcpy), |
PIXMAN_STD_FAST_PATH (SRC, a8, null, a8, fast_composite_src_memcpy), |
PIXMAN_STD_FAST_PATH (SRC, a8r8g8b8, null, r5g6b5, fast_composite_src_x888_0565), |
PIXMAN_STD_FAST_PATH (SRC, x8r8g8b8, null, r5g6b5, fast_composite_src_x888_0565), |
PIXMAN_STD_FAST_PATH (SRC, a8b8g8r8, null, b5g6r5, fast_composite_src_x888_0565), |
PIXMAN_STD_FAST_PATH (SRC, x8b8g8r8, null, b5g6r5, fast_composite_src_x888_0565), |
PIXMAN_STD_FAST_PATH (IN, a8, null, a8, fast_composite_in_8_8), |
PIXMAN_STD_FAST_PATH (IN, solid, a8, a8, fast_composite_in_n_8_8), |
|
1695,6 → 1893,13 |
|
SIMPLE_NEAREST_FAST_PATH (SRC, r5g6b5, r5g6b5, 565_565), |
|
SIMPLE_NEAREST_FAST_PATH_COVER (SRC, x8r8g8b8, a8r8g8b8, x888_8888), |
SIMPLE_NEAREST_FAST_PATH_COVER (SRC, x8b8g8r8, a8b8g8r8, x888_8888), |
SIMPLE_NEAREST_FAST_PATH_PAD (SRC, x8r8g8b8, a8r8g8b8, x888_8888), |
SIMPLE_NEAREST_FAST_PATH_PAD (SRC, x8b8g8r8, a8b8g8r8, x888_8888), |
SIMPLE_NEAREST_FAST_PATH_NORMAL (SRC, x8r8g8b8, a8r8g8b8, x888_8888), |
SIMPLE_NEAREST_FAST_PATH_NORMAL (SRC, x8b8g8r8, a8b8g8r8, x888_8888), |
|
SIMPLE_NEAREST_FAST_PATH (OVER, a8r8g8b8, x8r8g8b8, 8888_8888), |
SIMPLE_NEAREST_FAST_PATH (OVER, a8b8g8r8, x8b8g8r8, 8888_8888), |
SIMPLE_NEAREST_FAST_PATH (OVER, a8r8g8b8, a8r8g8b8, 8888_8888), |
1730,10 → 1935,122 |
NEAREST_FAST_PATH (OVER, x8b8g8r8, a8b8g8r8), |
NEAREST_FAST_PATH (OVER, a8b8g8r8, a8b8g8r8), |
|
#define SIMPLE_ROTATE_FLAGS(angle) \ |
(FAST_PATH_ROTATE_ ## angle ## _TRANSFORM | \ |
FAST_PATH_NEAREST_FILTER | \ |
FAST_PATH_SAMPLES_COVER_CLIP_NEAREST | \ |
FAST_PATH_STANDARD_FLAGS) |
|
#define SIMPLE_ROTATE_FAST_PATH(op,s,d,suffix) \ |
{ PIXMAN_OP_ ## op, \ |
PIXMAN_ ## s, SIMPLE_ROTATE_FLAGS (90), \ |
PIXMAN_null, 0, \ |
PIXMAN_ ## d, FAST_PATH_STD_DEST_FLAGS, \ |
fast_composite_rotate_90_##suffix, \ |
}, \ |
{ PIXMAN_OP_ ## op, \ |
PIXMAN_ ## s, SIMPLE_ROTATE_FLAGS (270), \ |
PIXMAN_null, 0, \ |
PIXMAN_ ## d, FAST_PATH_STD_DEST_FLAGS, \ |
fast_composite_rotate_270_##suffix, \ |
} |
|
SIMPLE_ROTATE_FAST_PATH (SRC, a8r8g8b8, a8r8g8b8, 8888), |
SIMPLE_ROTATE_FAST_PATH (SRC, a8r8g8b8, x8r8g8b8, 8888), |
SIMPLE_ROTATE_FAST_PATH (SRC, x8r8g8b8, x8r8g8b8, 8888), |
SIMPLE_ROTATE_FAST_PATH (SRC, r5g6b5, r5g6b5, 565), |
SIMPLE_ROTATE_FAST_PATH (SRC, a8, a8, 8), |
|
/* Simple repeat fast path entry. */ |
{ PIXMAN_OP_any, |
PIXMAN_any, |
(FAST_PATH_STANDARD_FLAGS | FAST_PATH_ID_TRANSFORM | FAST_PATH_BITS_IMAGE | |
FAST_PATH_NORMAL_REPEAT), |
PIXMAN_any, 0, |
PIXMAN_any, FAST_PATH_STD_DEST_FLAGS, |
fast_composite_tiled_repeat |
}, |
|
{ PIXMAN_OP_NONE }, |
}; |
|
#ifdef WORDS_BIGENDIAN |
#define A1_FILL_MASK(n, offs) (((1U << (n)) - 1) << (32 - (offs) - (n))) |
#else |
#define A1_FILL_MASK(n, offs) (((1U << (n)) - 1) << (offs)) |
#endif |
|
static force_inline void |
pixman_fill1_line (uint32_t *dst, int offs, int width, int v) |
{ |
if (offs) |
{ |
int leading_pixels = 32 - offs; |
if (leading_pixels >= width) |
{ |
if (v) |
*dst |= A1_FILL_MASK (width, offs); |
else |
*dst &= ~A1_FILL_MASK (width, offs); |
return; |
} |
else |
{ |
if (v) |
*dst++ |= A1_FILL_MASK (leading_pixels, offs); |
else |
*dst++ &= ~A1_FILL_MASK (leading_pixels, offs); |
width -= leading_pixels; |
} |
} |
while (width >= 32) |
{ |
if (v) |
*dst++ = 0xFFFFFFFF; |
else |
*dst++ = 0; |
width -= 32; |
} |
if (width > 0) |
{ |
if (v) |
*dst |= A1_FILL_MASK (width, 0); |
else |
*dst &= ~A1_FILL_MASK (width, 0); |
} |
} |
|
static void |
pixman_fill1 (uint32_t *bits, |
int stride, |
int x, |
int y, |
int width, |
int height, |
uint32_t filler) |
{ |
uint32_t *dst = bits + y * stride + (x >> 5); |
int offs = x & 31; |
|
if (filler & 1) |
{ |
while (height--) |
{ |
pixman_fill1_line (dst, offs, width, 1); |
dst += stride; |
} |
} |
else |
{ |
while (height--) |
{ |
pixman_fill1_line (dst, offs, width, 0); |
dst += stride; |
} |
} |
} |
|
static void |
pixman_fill8 (uint32_t *bits, |
int stride, |
int x, |
1740,11 → 2057,11 |
int y, |
int width, |
int height, |
uint32_t xor) |
uint32_t filler) |
{ |
int byte_stride = stride * (int) sizeof (uint32_t); |
uint8_t *dst = (uint8_t *) bits; |
uint8_t v = xor & 0xff; |
uint8_t v = filler & 0xff; |
int i; |
|
dst = dst + y * byte_stride + x; |
1765,12 → 2082,12 |
int y, |
int width, |
int height, |
uint32_t xor) |
uint32_t filler) |
{ |
int short_stride = |
(stride * (int)sizeof (uint32_t)) / (int)sizeof (uint16_t); |
uint16_t *dst = (uint16_t *)bits; |
uint16_t v = xor & 0xffff; |
uint16_t v = filler & 0xffff; |
int i; |
|
dst = dst + y * short_stride + x; |
1791,7 → 2108,7 |
int y, |
int width, |
int height, |
uint32_t xor) |
uint32_t filler) |
{ |
int i; |
|
1800,7 → 2117,7 |
while (height--) |
{ |
for (i = 0; i < width; ++i) |
bits[i] = xor; |
bits[i] = filler; |
|
bits += stride; |
} |
1815,38 → 2132,227 |
int y, |
int width, |
int height, |
uint32_t xor) |
uint32_t filler) |
{ |
switch (bpp) |
{ |
case 1: |
pixman_fill1 (bits, stride, x, y, width, height, filler); |
break; |
|
case 8: |
pixman_fill8 (bits, stride, x, y, width, height, xor); |
pixman_fill8 (bits, stride, x, y, width, height, filler); |
break; |
|
case 16: |
pixman_fill16 (bits, stride, x, y, width, height, xor); |
pixman_fill16 (bits, stride, x, y, width, height, filler); |
break; |
|
case 32: |
pixman_fill32 (bits, stride, x, y, width, height, xor); |
pixman_fill32 (bits, stride, x, y, width, height, filler); |
break; |
|
default: |
return _pixman_implementation_fill ( |
imp->delegate, bits, stride, bpp, x, y, width, height, xor); |
break; |
return FALSE; |
} |
|
return TRUE; |
} |
|
/*****************************************************************************/ |
|
static uint32_t * |
fast_fetch_r5g6b5 (pixman_iter_t *iter, const uint32_t *mask) |
{ |
int32_t w = iter->width; |
uint32_t *dst = iter->buffer; |
const uint16_t *src = (const uint16_t *)iter->bits; |
|
iter->bits += iter->stride; |
|
/* Align the source buffer at 4 bytes boundary */ |
if (w > 0 && ((uintptr_t)src & 3)) |
{ |
*dst++ = convert_0565_to_8888 (*src++); |
w--; |
} |
/* Process two pixels per iteration */ |
while ((w -= 2) >= 0) |
{ |
uint32_t sr, sb, sg, t0, t1; |
uint32_t s = *(const uint32_t *)src; |
src += 2; |
sr = (s >> 8) & 0x00F800F8; |
sb = (s << 3) & 0x00F800F8; |
sg = (s >> 3) & 0x00FC00FC; |
sr |= sr >> 5; |
sb |= sb >> 5; |
sg |= sg >> 6; |
t0 = ((sr << 16) & 0x00FF0000) | ((sg << 8) & 0x0000FF00) | |
(sb & 0xFF) | 0xFF000000; |
t1 = (sr & 0x00FF0000) | ((sg >> 8) & 0x0000FF00) | |
(sb >> 16) | 0xFF000000; |
#ifdef WORDS_BIGENDIAN |
*dst++ = t1; |
*dst++ = t0; |
#else |
*dst++ = t0; |
*dst++ = t1; |
#endif |
} |
if (w & 1) |
{ |
*dst = convert_0565_to_8888 (*src); |
} |
|
return iter->buffer; |
} |
|
static uint32_t * |
fast_dest_fetch_noop (pixman_iter_t *iter, const uint32_t *mask) |
{ |
iter->bits += iter->stride; |
return iter->buffer; |
} |
|
/* Helper function for a workaround, which tries to ensure that 0x1F001F |
* constant is always allocated in a register on RISC architectures. |
*/ |
static force_inline uint32_t |
convert_8888_to_0565_workaround (uint32_t s, uint32_t x1F001F) |
{ |
uint32_t a, b; |
a = (s >> 3) & x1F001F; |
b = s & 0xFC00; |
a |= a >> 5; |
a |= b >> 5; |
return a; |
} |
|
static void |
fast_write_back_r5g6b5 (pixman_iter_t *iter) |
{ |
int32_t w = iter->width; |
uint16_t *dst = (uint16_t *)(iter->bits - iter->stride); |
const uint32_t *src = iter->buffer; |
/* Workaround to ensure that x1F001F variable is allocated in a register */ |
static volatile uint32_t volatile_x1F001F = 0x1F001F; |
uint32_t x1F001F = volatile_x1F001F; |
|
while ((w -= 4) >= 0) |
{ |
uint32_t s1 = *src++; |
uint32_t s2 = *src++; |
uint32_t s3 = *src++; |
uint32_t s4 = *src++; |
*dst++ = convert_8888_to_0565_workaround (s1, x1F001F); |
*dst++ = convert_8888_to_0565_workaround (s2, x1F001F); |
*dst++ = convert_8888_to_0565_workaround (s3, x1F001F); |
*dst++ = convert_8888_to_0565_workaround (s4, x1F001F); |
} |
if (w & 2) |
{ |
*dst++ = convert_8888_to_0565_workaround (*src++, x1F001F); |
*dst++ = convert_8888_to_0565_workaround (*src++, x1F001F); |
} |
if (w & 1) |
{ |
*dst = convert_8888_to_0565_workaround (*src, x1F001F); |
} |
} |
|
typedef struct |
{ |
pixman_format_code_t format; |
pixman_iter_get_scanline_t get_scanline; |
pixman_iter_write_back_t write_back; |
} fetcher_info_t; |
|
static const fetcher_info_t fetchers[] = |
{ |
{ PIXMAN_r5g6b5, fast_fetch_r5g6b5, fast_write_back_r5g6b5 }, |
{ PIXMAN_null } |
}; |
|
static pixman_bool_t |
fast_src_iter_init (pixman_implementation_t *imp, pixman_iter_t *iter) |
{ |
pixman_image_t *image = iter->image; |
|
#define FLAGS \ |
(FAST_PATH_STANDARD_FLAGS | FAST_PATH_ID_TRANSFORM | \ |
FAST_PATH_BITS_IMAGE | FAST_PATH_SAMPLES_COVER_CLIP_NEAREST) |
|
if ((iter->iter_flags & ITER_NARROW) && |
(iter->image_flags & FLAGS) == FLAGS) |
{ |
const fetcher_info_t *f; |
|
for (f = &fetchers[0]; f->format != PIXMAN_null; f++) |
{ |
if (image->common.extended_format_code == f->format) |
{ |
uint8_t *b = (uint8_t *)image->bits.bits; |
int s = image->bits.rowstride * 4; |
|
iter->bits = b + s * iter->y + iter->x * PIXMAN_FORMAT_BPP (f->format) / 8; |
iter->stride = s; |
|
iter->get_scanline = f->get_scanline; |
return TRUE; |
} |
} |
} |
|
return FALSE; |
} |
|
static pixman_bool_t |
fast_dest_iter_init (pixman_implementation_t *imp, pixman_iter_t *iter) |
{ |
pixman_image_t *image = iter->image; |
|
if ((iter->iter_flags & ITER_NARROW) && |
(iter->image_flags & FAST_PATH_STD_DEST_FLAGS) == FAST_PATH_STD_DEST_FLAGS) |
{ |
const fetcher_info_t *f; |
|
for (f = &fetchers[0]; f->format != PIXMAN_null; f++) |
{ |
if (image->common.extended_format_code == f->format) |
{ |
uint8_t *b = (uint8_t *)image->bits.bits; |
int s = image->bits.rowstride * 4; |
|
iter->bits = b + s * iter->y + iter->x * PIXMAN_FORMAT_BPP (f->format) / 8; |
iter->stride = s; |
|
if ((iter->iter_flags & (ITER_IGNORE_RGB | ITER_IGNORE_ALPHA)) == |
(ITER_IGNORE_RGB | ITER_IGNORE_ALPHA)) |
{ |
iter->get_scanline = fast_dest_fetch_noop; |
} |
else |
{ |
iter->get_scanline = f->get_scanline; |
} |
iter->write_back = f->write_back; |
return TRUE; |
} |
} |
} |
return FALSE; |
} |
|
|
pixman_implementation_t * |
_pixman_implementation_create_fast_path (void) |
_pixman_implementation_create_fast_path (pixman_implementation_t *fallback) |
{ |
pixman_implementation_t *general = _pixman_implementation_create_general (); |
pixman_implementation_t *imp = _pixman_implementation_create (general, c_fast_paths); |
pixman_implementation_t *imp = _pixman_implementation_create (fallback, c_fast_paths); |
|
imp->fill = fast_path_fill; |
imp->src_iter_init = fast_src_iter_init; |
imp->dest_iter_init = fast_dest_iter_init; |
|
return imp; |
} |