From 6e20c2574354d1cb071a1201ff166cb5e92c00d2 Mon Sep 17 00:00:00 2001 From: =?utf8?q?S=C3=B8ren=20Sandmann=20Pedersen?= Date: Sun, 21 Jun 2009 18:58:53 -0400 Subject: [PATCH] Turn fbComposeGetSolid() macro into a pixman_image_get_solid() function. --- pixman/pixman-arm-neon.c | 10 +++++----- pixman/pixman-arm-simd.c | 4 ++-- pixman/pixman-fast-path.c | 16 ++++++++-------- pixman/pixman-image.c | 21 +++++++++++++++++++-- pixman/pixman-mmx.c | 22 +++++++++++----------- pixman/pixman-private.h | 21 ++++----------------- pixman/pixman-sse2.c | 22 +++++++++++----------- pixman/pixman-vmx.c | 4 ++-- 8 files changed, 62 insertions(+), 58 deletions(-) diff --git a/pixman/pixman-arm-neon.c b/pixman/pixman-arm-neon.c index 966704a..c33a2ef 100644 --- a/pixman/pixman-arm-neon.c +++ b/pixman/pixman-arm-neon.c @@ -461,7 +461,7 @@ fbCompositeSrc_8888x8x8888neon ( fbComposeGetStart (pDst, xDst, yDst, uint32_t, dstStride, dstLine, 1); fbComposeGetStart (pSrc, xSrc, ySrc, uint32_t, srcStride, srcLine, 1); - fbComposeGetSolid (pMask, mask, pDst->bits.format); + pixman_image_get_solid (pMask, mask, pDst->bits.format); mask_alpha = vdup_n_u8((mask) >> 24); if (width>=8) @@ -658,7 +658,7 @@ fbCompositeSolidMask_nx8x8888neon ( uint8x8_t mask_selector=vreinterpret_u8_u64(vcreate_u64(0x0101010100000000ULL)); uint8x8_t alpha_selector=vreinterpret_u8_u64(vcreate_u64(0x0707070703030303ULL)); - fbComposeGetSolid(pSrc, src, pDst->bits.format); + pixman_image_get_solid(pSrc, src, pDst->bits.format); srca = src >> 24; if (src == 0) @@ -863,7 +863,7 @@ fbCompositeSrcAdd_8888x8x8neon ( fbComposeGetStart (pDst, xDst, yDst, uint8_t, dstStride, dstLine, 1); fbComposeGetStart (pMask, xMask, yMask, uint8_t, maskStride, maskLine, 1); - fbComposeGetSolid (pSrc, src, pDst->bits.format); + pixman_image_get_solid (pSrc, src, pDst->bits.format); sa = vdup_n_u8((src) >> 24); if (width>=8) @@ -1734,7 +1734,7 @@ fbCompositeSolidMask_nx8x0565neon ( uint32_t kernelCount, copyCount; uint8_t kernelOffset, copyOffset; - fbComposeGetSolid(pSrc, src, pDst->bits.format); + pixman_image_get_solid(pSrc, src, pDst->bits.format); // bail out if fully transparent or degenerate srca = src >> 24; @@ -1875,7 +1875,7 @@ fbCompositeSolid_nx0565neon ( uint32_t kernelCount, copyCount; uint8_t kernelOffset, copyOffset; - fbComposeGetSolid(pSrc, src, pDst->bits.format); + pixman_image_get_solid(pSrc, src, pDst->bits.format); // bail out if fully transparent srca = src >> 24; diff --git a/pixman/pixman-arm-simd.c b/pixman/pixman-arm-simd.c index 0b9c529..2030657 100644 --- a/pixman/pixman-arm-simd.c +++ b/pixman/pixman-arm-simd.c @@ -219,7 +219,7 @@ fbCompositeSrc_8888x8x8888arm ( fbComposeGetStart (pDst, xDst, yDst, uint32_t, dstStride, dstLine, 1); fbComposeGetStart (pSrc, xSrc, ySrc, uint32_t, srcStride, srcLine, 1); - fbComposeGetSolid (pMask, mask, pDst->bits.format); + pixman_image_get_solid (pMask, mask, pDst->bits.format); mask = (mask) >> 24; while (height--) @@ -323,7 +323,7 @@ fbCompositeSolidMask_nx8x8888arm ( int dstStride, maskStride; uint16_t w; - fbComposeGetSolid(pSrc, src, pDst->bits.format); + pixman_image_get_solid(pSrc, src, pDst->bits.format); srca = src >> 24; if (src == 0) diff --git a/pixman/pixman-fast-path.c b/pixman/pixman-fast-path.c index 0620420..35065ce 100644 --- a/pixman/pixman-fast-path.c +++ b/pixman/pixman-fast-path.c @@ -151,7 +151,7 @@ fbCompositeSolidMaskIn_nx8x8 (pixman_implementation_t *imp, uint16_t w; uint16_t t; - fbComposeGetSolid(iSrc, src, iDst->bits.format); + src = pixman_image_get_solid(iSrc, iDst->bits.format); srca = src >> 24; @@ -281,7 +281,7 @@ fbCompositeSolidMask_nx8x8888 (pixman_implementation_t *imp, int dstStride, maskStride; uint16_t w; - fbComposeGetSolid(pSrc, src, pDst->bits.format); + src = pixman_image_get_solid(pSrc, pDst->bits.format); srca = src >> 24; if (src == 0) @@ -340,7 +340,7 @@ fbCompositeSolidMask_nx8888x8888C (pixman_implementation_t *imp, uint16_t w; uint32_t m, n, o, p; - fbComposeGetSolid(pSrc, src, pDst->bits.format); + src = pixman_image_get_solid(pSrc, pDst->bits.format); srca = src >> 24; if (src == 0) @@ -413,7 +413,7 @@ fbCompositeSolidMask_nx8x0888 (pixman_implementation_t *imp, int dstStride, maskStride; uint16_t w; - fbComposeGetSolid(pSrc, src, pDst->bits.format); + src = pixman_image_get_solid(pSrc, pDst->bits.format); srca = src >> 24; if (src == 0) @@ -476,7 +476,7 @@ fbCompositeSolidMask_nx8x0565 (pixman_implementation_t *imp, int dstStride, maskStride; uint16_t w; - fbComposeGetSolid(pSrc, src, pDst->bits.format); + src = pixman_image_get_solid(pSrc, pDst->bits.format); srca = src >> 24; if (src == 0) @@ -542,7 +542,7 @@ fbCompositeSolidMask_nx8888x0565C (pixman_implementation_t *imp, uint16_t w; uint32_t m, n, o; - fbComposeGetSolid(pSrc, src, pDst->bits.format); + src = pixman_image_get_solid(pSrc, pDst->bits.format); srca = src >> 24; if (src == 0) @@ -913,7 +913,7 @@ fbCompositeSrcAdd_8888x8x8 (pixman_implementation_t *imp, fbComposeGetStart (pDst, xDst, yDst, uint8_t, dstStride, dstLine, 1); fbComposeGetStart (pMask, xMask, yMask, uint8_t, maskStride, maskLine, 1); - fbComposeGetSolid (pSrc, src, pDst->bits.format); + src = pixman_image_get_solid (pSrc, pDst->bits.format); sa = (src >> 24); while (height--) @@ -963,7 +963,7 @@ fbCompositeSolidFill (pixman_implementation_t *imp, { uint32_t src; - fbComposeGetSolid(pSrc, src, pDst->bits.format); + src = pixman_image_get_solid(pSrc, pDst->bits.format); if (pDst->bits.format == PIXMAN_a8) src = src >> 24; diff --git a/pixman/pixman-image.c b/pixman/pixman-image.c index fcab468..a7fd21d 100644 --- a/pixman/pixman-image.c +++ b/pixman/pixman-image.c @@ -167,8 +167,6 @@ _pixman_image_get_fetcher (pixman_image_t *image, static void image_property_changed (pixman_image_t *image) { - - image->common.property_changed (image); } @@ -543,6 +541,25 @@ pixman_image_can_get_solid (pixman_image_t *image) } } +uint32_t +pixman_image_get_solid (pixman_image_t *image, pixman_format_code_t format) +{ + uint32_t result; + + _pixman_image_get_scanline_32 (image, 0, 0, 1, &result, NULL, 0); + + /* If necessary, convert RGB <--> BGR. */ + if (PIXMAN_FORMAT_TYPE (format) != PIXMAN_TYPE_ARGB) + { + result = (((result & 0xff000000) >> 0) | + ((result & 0x00ff0000) >> 16) | + ((result & 0x0000ff00) >> 0) | + ((result & 0x000000ff) << 16)); + } + + return result; +} + pixman_bool_t pixman_image_is_opaque (pixman_image_t *image) { diff --git a/pixman/pixman-mmx.c b/pixman/pixman-mmx.c index 350a048..0909124 100644 --- a/pixman/pixman-mmx.c +++ b/pixman/pixman-mmx.c @@ -940,7 +940,7 @@ fbCompositeSolid_nx8888mmx (pixman_implementation_t *imp, CHECKPOINT(); - fbComposeGetSolid(pSrc, src, pDst->bits.format); + src = pixman_image_get_solid(pSrc, pDst->bits.format); if (src >> 24 == 0) return; @@ -1019,7 +1019,7 @@ fbCompositeSolid_nx0565mmx (pixman_implementation_t *imp, CHECKPOINT(); - fbComposeGetSolid(pSrc, src, pDst->bits.format); + src = pixman_image_get_solid(pSrc, pDst->bits.format); if (src >> 24 == 0) return; @@ -1105,7 +1105,7 @@ fbCompositeSolidMask_nx8888x8888Cmmx (pixman_implementation_t *imp, CHECKPOINT(); - fbComposeGetSolid(pSrc, src, pDst->bits.format); + src = pixman_image_get_solid(pSrc, pDst->bits.format); srca = src >> 24; if (srca == 0) @@ -1214,7 +1214,7 @@ fbCompositeSrc_8888x8x8888mmx (pixman_implementation_t *imp, fbComposeGetStart (pDst, xDst, yDst, uint32_t, dstStride, dstLine, 1); fbComposeGetStart (pSrc, xSrc, ySrc, uint32_t, srcStride, srcLine, 1); - fbComposeGetSolid (pMask, mask, pDst->bits.format); + mask = pixman_image_get_solid (pMask, pDst->bits.format); mask = mask | mask >> 8 | mask >> 16 | mask >> 24; vmask = load8888 (mask); srca = MC(4x00ff); @@ -1298,7 +1298,7 @@ fbCompositeSrc_x888xnx8888mmx (pixman_implementation_t *imp, fbComposeGetStart (pDst, xDst, yDst, uint32_t, dstStride, dstLine, 1); fbComposeGetStart (pSrc, xSrc, ySrc, uint32_t, srcStride, srcLine, 1); - fbComposeGetSolid (pMask, mask, pDst->bits.format); + mask = pixman_image_get_solid (pMask, pDst->bits.format); mask = mask | mask >> 8 | mask >> 16 | mask >> 24; vmask = load8888 (mask); @@ -1586,7 +1586,7 @@ fbCompositeSolidMask_nx8x8888mmx (pixman_implementation_t *imp, CHECKPOINT(); - fbComposeGetSolid(pSrc, src, pDst->bits.format); + src = pixman_image_get_solid(pSrc, pDst->bits.format); srca = src >> 24; if (srca == 0) @@ -1858,7 +1858,7 @@ fbCompositeSolidMaskSrc_nx8x8888mmx (pixman_implementation_t *imp, CHECKPOINT(); - fbComposeGetSolid(pSrc, src, pDst->bits.format); + src = pixman_image_get_solid(pSrc, pDst->bits.format); srca = src >> 24; if (srca == 0) @@ -1990,7 +1990,7 @@ fbCompositeSolidMask_nx8x0565mmx (pixman_implementation_t *imp, CHECKPOINT(); - fbComposeGetSolid(pSrc, src, pDst->bits.format); + src = pixman_image_get_solid(pSrc, pDst->bits.format); srca = src >> 24; if (srca == 0) @@ -2343,7 +2343,7 @@ fbCompositeSolidMask_nx8888x0565Cmmx (pixman_implementation_t *imp, CHECKPOINT(); - fbComposeGetSolid(pSrc, src, pDst->bits.format); + src = pixman_image_get_solid(pSrc, pDst->bits.format); srca = src >> 24; if (srca == 0) @@ -2454,7 +2454,7 @@ fbCompositeIn_nx8x8mmx (pixman_implementation_t *imp, fbComposeGetStart (pDst, xDst, yDst, uint8_t, dstStride, dstLine, 1); fbComposeGetStart (pMask, xMask, yMask, uint8_t, maskStride, maskLine, 1); - fbComposeGetSolid(pSrc, src, pDst->bits.format); + src = pixman_image_get_solid(pSrc, pDst->bits.format); sa = src >> 24; if (sa == 0) @@ -2604,7 +2604,7 @@ fbCompositeSrcAdd_8888x8x8mmx (pixman_implementation_t *imp, fbComposeGetStart (pDst, xDst, yDst, uint8_t, dstStride, dstLine, 1); fbComposeGetStart (pMask, xMask, yMask, uint8_t, maskStride, maskLine, 1); - fbComposeGetSolid(pSrc, src, pDst->bits.format); + src = pixman_image_get_solid(pSrc, pDst->bits.format); sa = src >> 24; if (sa == 0) diff --git a/pixman/pixman-private.h b/pixman/pixman-private.h index 18a028e..2f545c2 100644 --- a/pixman/pixman-private.h +++ b/pixman/pixman-private.h @@ -502,23 +502,6 @@ _pixman_gradient_walker_pixel (pixman_gradient_walker_t *walker, #endif -#define fbComposeGetSolid(img, res, fmt) \ - { \ - uint32_t __pixel; \ - \ - _pixman_image_get_scanline_32 (img, 0, 0, 1, &__pixel, NULL, 0); \ - \ - /* If necessary, convert RGB <--> BGR. */ \ - if (PIXMAN_FORMAT_TYPE(fmt) != PIXMAN_TYPE_ARGB) \ - { \ - (__pixel) = ((((__pixel) & 0xff000000) >> 0) | \ - (((__pixel) & 0x00ff0000) >> 16) | \ - (((__pixel) & 0x0000ff00) >> 0) | \ - (((__pixel) & 0x000000ff) << 16)); \ - } \ - (res) = __pixel; \ - } - #define fbComposeGetStart(pict,x,y,type,out_stride,line,mul) do { \ uint32_t *__bits__; \ int __stride__; \ @@ -598,6 +581,10 @@ pixman_image_is_opaque(pixman_image_t *image); pixman_bool_t pixman_image_can_get_solid (pixman_image_t *image); +uint32_t +pixman_image_get_solid (pixman_image_t *image, + pixman_format_code_t format); + pixman_bool_t pixman_compute_composite_region32 (pixman_region32_t * pRegion, pixman_image_t * pSrc, diff --git a/pixman/pixman-sse2.c b/pixman/pixman-sse2.c index 0908fc9..00a2a26 100644 --- a/pixman/pixman-sse2.c +++ b/pixman/pixman-sse2.c @@ -2517,7 +2517,7 @@ fbCompositeSolid_nx8888sse2 (pixman_implementation_t *imp, __m128i xmmSrc, xmmAlpha; __m128i xmmDst, xmmDstLo, xmmDstHi; - fbComposeGetSolid(pSrc, src, pDst->bits.format); + src = pixman_image_get_solid(pSrc, pDst->bits.format); if (src == 0) return; @@ -2604,7 +2604,7 @@ fbCompositeSolid_nx0565sse2 (pixman_implementation_t *imp, __m128i xmmSrc, xmmAlpha; __m128i xmmDst, xmmDst0, xmmDst1, xmmDst2, xmmDst3; - fbComposeGetSolid(pSrc, src, pDst->bits.format); + src = pixman_image_get_solid(pSrc, pDst->bits.format); if (src == 0) return; @@ -2699,7 +2699,7 @@ fbCompositeSolidMask_nx8888x8888Csse2 (pixman_implementation_t *imp, __m64 mmxSrc, mmxAlpha, mmxMask, mmxDst; - fbComposeGetSolid(pSrc, src, pDst->bits.format); + src = pixman_image_get_solid(pSrc, pDst->bits.format); if (src == 0) return; @@ -2834,7 +2834,7 @@ fbCompositeSrc_8888x8x8888sse2 (pixman_implementation_t *imp, fbComposeGetStart (pDst, xDst, yDst, uint32_t, dstStride, dstLine, 1); fbComposeGetStart (pSrc, xSrc, ySrc, uint32_t, srcStride, srcLine, 1); - fbComposeGetSolid (pMask, mask, pDst->bits.format); + mask = pixman_image_get_solid (pMask, pDst->bits.format); xmmMask = createMask_16_128 (mask >> 24); @@ -2946,7 +2946,7 @@ fbCompositeSrc_x888xnx8888sse2 (pixman_implementation_t *imp, fbComposeGetStart (pDst, xDst, yDst, uint32_t, dstStride, dstLine, 1); fbComposeGetStart (pSrc, xSrc, ySrc, uint32_t, srcStride, srcLine, 1); - fbComposeGetSolid (pMask, mask, pDst->bits.format); + mask = pixman_image_get_solid (pMask, pDst->bits.format); xmmMask = createMask_16_128 (mask >> 24); xmmAlpha = Mask00ff; @@ -3223,7 +3223,7 @@ fbCompositeSolidMask_nx8x8888sse2 (pixman_implementation_t *imp, __m64 mmxSrc, mmxAlpha, mmxMask, mmxDest; - fbComposeGetSolid(pSrc, src, pDst->bits.format); + src = pixman_image_get_solid(pSrc, pDst->bits.format); srca = src >> 24; if (src == 0) @@ -3498,7 +3498,7 @@ fbCompositeSolidMaskSrc_nx8x8888sse2 (pixman_implementation_t *imp, __m128i xmmSrc, xmmDef; __m128i xmmMask, xmmMaskLo, xmmMaskHi; - fbComposeGetSolid(pSrc, src, pDst->bits.format); + src = pixman_image_get_solid(pSrc, pDst->bits.format); srca = src >> 24; if (src == 0) @@ -3636,7 +3636,7 @@ fbCompositeSolidMask_nx8x0565sse2 (pixman_implementation_t *imp, __m128i xmmMask, xmmMaskLo, xmmMaskHi; __m128i xmmDst, xmmDst0, xmmDst1, xmmDst2, xmmDst3; - fbComposeGetSolid(pSrc, src, pDst->bits.format); + src = pixman_image_get_solid(pSrc, pDst->bits.format); srca = src >> 24; if (src == 0) @@ -4037,7 +4037,7 @@ fbCompositeSolidMask_nx8888x0565Csse2 (pixman_implementation_t *imp, __m64 mmxSrc, mmxAlpha, mmxMask, mmxDest; - fbComposeGetSolid(pSrc, src, pDst->bits.format); + src = pixman_image_get_solid(pSrc, pDst->bits.format); if (src == 0) return; @@ -4186,7 +4186,7 @@ fbCompositeIn_nx8x8sse2 (pixman_implementation_t *imp, fbComposeGetStart (pDst, xDst, yDst, uint8_t, dstStride, dstLine, 1); fbComposeGetStart (pMask, xMask, yMask, uint8_t, maskStride, maskLine, 1); - fbComposeGetSolid(pSrc, src, pDst->bits.format); + src = pixman_image_get_solid(pSrc, pDst->bits.format); sa = src >> 24; if (sa == 0) @@ -4380,7 +4380,7 @@ fbCompositeSrcAdd_8888x8x8sse2 (pixman_implementation_t *imp, fbComposeGetStart (pDst, xDst, yDst, uint8_t, dstStride, dstLine, 1); fbComposeGetStart (pMask, xMask, yMask, uint8_t, maskStride, maskLine, 1); - fbComposeGetSolid(pSrc, src, pDst->bits.format); + src = pixman_image_get_solid(pSrc, pDst->bits.format); sa = src >> 24; if (sa == 0) diff --git a/pixman/pixman-vmx.c b/pixman/pixman-vmx.c index c57cb1e..5a0ed50 100644 --- a/pixman/pixman-vmx.c +++ b/pixman/pixman-vmx.c @@ -1499,7 +1499,7 @@ fbCompositeSolid_nx8888vmx (pixman_operator_t op, uint32_t *dstLine, *dst; int dstStride; - fbComposeGetSolid (pSrc, pDst, src); + pixman_image_get_solid (pSrc, pDst, src); if (src >> 24 == 0) return; @@ -1533,7 +1533,7 @@ fbCompositeSolid_nx0565vmx (pixman_operator_t op, uint16_t w; int dstStride; - fbComposeGetSolid (pSrc, pDst, src); + pixman_image_get_solid (pSrc, pDst, src); if (src >> 24 == 0) return; -- 2.7.4