mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-10-06 00:30:10 -06:00
Sdraw...
git-svn-id: svn://ultimatepp.org/upp/trunk@733 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
4b13bd3c3a
commit
b7eba97090
227 changed files with 128457 additions and 16 deletions
3
uppdev/plugin/pixman/init
Normal file
3
uppdev/plugin/pixman/init
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
#ifndef _plugin_pixman_icpp_init_stub
|
||||
#define _plugin_pixman_icpp_init_stub
|
||||
#endif
|
||||
3
uppdev/plugin/pixman/lib/pixman-access-accessors.c
Normal file
3
uppdev/plugin/pixman/lib/pixman-access-accessors.c
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
#define PIXMAN_FB_ACCESSORS
|
||||
|
||||
#include "pixman-access.c"
|
||||
1986
uppdev/plugin/pixman/lib/pixman-access.c
Normal file
1986
uppdev/plugin/pixman/lib/pixman-access.c
Normal file
File diff suppressed because it is too large
Load diff
407
uppdev/plugin/pixman/lib/pixman-arm-simd.c
Normal file
407
uppdev/plugin/pixman/lib/pixman-arm-simd.c
Normal file
|
|
@ -0,0 +1,407 @@
|
|||
/*
|
||||
* Copyright © 2008 Mozilla Corporation
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and its
|
||||
* documentation for any purpose is hereby granted without fee, provided that
|
||||
* the above copyright notice appear in all copies and that both that
|
||||
* copyright notice and this permission notice appear in supporting
|
||||
* documentation, and that the name of Mozilla Corporation not be used in
|
||||
* advertising or publicity pertaining to distribution of the software without
|
||||
* specific, written prior permission. Mozilla Corporation makes no
|
||||
* representations about the suitability of this software for any purpose. It
|
||||
* is provided "as is" without express or implied warranty.
|
||||
*
|
||||
* THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
|
||||
* SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
* FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
* SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
|
||||
* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
|
||||
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
|
||||
* SOFTWARE.
|
||||
*
|
||||
* Author: Jeff Muizelaar (jeff@infidigm.net)
|
||||
*
|
||||
*/
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include "pixman-arm-simd.h"
|
||||
|
||||
void
|
||||
fbCompositeSrcAdd_8000x8000arm (pixman_op_t op,
|
||||
pixman_image_t * pSrc,
|
||||
pixman_image_t * pMask,
|
||||
pixman_image_t * pDst,
|
||||
int16_t xSrc,
|
||||
int16_t ySrc,
|
||||
int16_t xMask,
|
||||
int16_t yMask,
|
||||
int16_t xDst,
|
||||
int16_t yDst,
|
||||
uint16_t width,
|
||||
uint16_t height)
|
||||
{
|
||||
uint8_t *dstLine, *dst;
|
||||
uint8_t *srcLine, *src;
|
||||
int dstStride, srcStride;
|
||||
uint16_t w;
|
||||
uint8_t s, d;
|
||||
|
||||
fbComposeGetStart (pSrc, xSrc, ySrc, uint8_t, srcStride, srcLine, 1);
|
||||
fbComposeGetStart (pDst, xDst, yDst, uint8_t, dstStride, dstLine, 1);
|
||||
|
||||
while (height--)
|
||||
{
|
||||
dst = dstLine;
|
||||
dstLine += dstStride;
|
||||
src = srcLine;
|
||||
srcLine += srcStride;
|
||||
w = width;
|
||||
|
||||
while (w && (unsigned long)dst & 3)
|
||||
{
|
||||
s = *src;
|
||||
d = *dst;
|
||||
asm("uqadd8 %0, %1, %2" : "+r"(d) : "r"(s));
|
||||
*dst = d;
|
||||
|
||||
dst++;
|
||||
src++;
|
||||
w--;
|
||||
}
|
||||
|
||||
while (w >= 4)
|
||||
{
|
||||
asm("uqadd8 %0, %1, %2" : "=r"(*(uint32_t*)dst) : "r"(*(uint32_t*)src), "r"(*(uint32_t*)dst));
|
||||
dst += 4;
|
||||
src += 4;
|
||||
w -= 4;
|
||||
}
|
||||
|
||||
while (w)
|
||||
{
|
||||
s = *src;
|
||||
d = *dst;
|
||||
asm("uqadd8 %0, %1, %2" : "+r"(d) : "r"(s));
|
||||
*dst = d;
|
||||
|
||||
dst++;
|
||||
src++;
|
||||
w--;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
fbCompositeSrc_8888x8888arm (pixman_op_t op,
|
||||
pixman_image_t * pSrc,
|
||||
pixman_image_t * pMask,
|
||||
pixman_image_t * pDst,
|
||||
int16_t xSrc,
|
||||
int16_t ySrc,
|
||||
int16_t xMask,
|
||||
int16_t yMask,
|
||||
int16_t xDst,
|
||||
int16_t yDst,
|
||||
uint16_t width,
|
||||
uint16_t height)
|
||||
{
|
||||
uint32_t *dstLine, *dst;
|
||||
uint32_t *srcLine, *src;
|
||||
int dstStride, srcStride;
|
||||
uint16_t w;
|
||||
uint32_t component_half = 0x800080;
|
||||
uint32_t upper_component_mask = 0xff00ff00;
|
||||
uint32_t alpha_mask = 0xff;
|
||||
|
||||
fbComposeGetStart (pDst, xDst, yDst, uint32_t, dstStride, dstLine, 1);
|
||||
fbComposeGetStart (pSrc, xSrc, ySrc, uint32_t, srcStride, srcLine, 1);
|
||||
|
||||
while (height--)
|
||||
{
|
||||
dst = dstLine;
|
||||
dstLine += dstStride;
|
||||
src = srcLine;
|
||||
srcLine += srcStride;
|
||||
w = width;
|
||||
|
||||
//#define inner_branch
|
||||
asm volatile (
|
||||
"cmp %[w], #0\n\t"
|
||||
"beq 2f\n\t"
|
||||
"1:\n\t"
|
||||
/* load src */
|
||||
"ldr r5, [%[src]], #4\n\t"
|
||||
#ifdef inner_branch
|
||||
/* We can avoid doing the multiplication in two cases: 0x0 or 0xff.
|
||||
* The 0x0 case also allows us to avoid doing an unecessary data
|
||||
* write which is more valuable so we only check for that */
|
||||
"cmp r5, #0\n\t"
|
||||
"beq 3f\n\t"
|
||||
|
||||
/* = 255 - alpha */
|
||||
"sub r8, %[alpha_mask], r5, lsr #24\n\t"
|
||||
|
||||
"ldr r4, [%[dest]] \n\t"
|
||||
|
||||
#else
|
||||
"ldr r4, [%[dest]] \n\t"
|
||||
|
||||
/* = 255 - alpha */
|
||||
"sub r8, %[alpha_mask], r5, lsr #24\n\t"
|
||||
#endif
|
||||
"uxtb16 r6, r4\n\t"
|
||||
"uxtb16 r7, r4, ror #8\n\t"
|
||||
|
||||
/* multiply by 257 and divide by 65536 */
|
||||
"mla r6, r6, r8, %[component_half]\n\t"
|
||||
"mla r7, r7, r8, %[component_half]\n\t"
|
||||
|
||||
"uxtab16 r6, r6, r6, ror #8\n\t"
|
||||
"uxtab16 r7, r7, r7, ror #8\n\t"
|
||||
|
||||
/* recombine the 0xff00ff00 bytes of r6 and r7 */
|
||||
"and r7, r7, %[upper_component_mask]\n\t"
|
||||
"uxtab16 r6, r7, r6, ror #8\n\t"
|
||||
|
||||
"uqadd8 r5, r6, r5\n\t"
|
||||
|
||||
#ifdef inner_branch
|
||||
"3:\n\t"
|
||||
|
||||
#endif
|
||||
"str r5, [%[dest]], #4\n\t"
|
||||
/* increment counter and jmp to top */
|
||||
"subs %[w], %[w], #1\n\t"
|
||||
"bne 1b\n\t"
|
||||
"2:\n\t"
|
||||
: [w] "+r" (w), [dest] "+r" (dst), [src] "+r" (src)
|
||||
: [component_half] "r" (component_half), [upper_component_mask] "r" (upper_component_mask),
|
||||
[alpha_mask] "r" (alpha_mask)
|
||||
: "r4", "r5", "r6", "r7", "r8", "cc", "memory"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
fbCompositeSrc_8888x8x8888arm (pixman_op_t op,
|
||||
pixman_image_t * pSrc,
|
||||
pixman_image_t * pMask,
|
||||
pixman_image_t * pDst,
|
||||
int16_t xSrc,
|
||||
int16_t ySrc,
|
||||
int16_t xMask,
|
||||
int16_t yMask,
|
||||
int16_t xDst,
|
||||
int16_t yDst,
|
||||
uint16_t width,
|
||||
uint16_t height)
|
||||
{
|
||||
uint32_t *dstLine, *dst;
|
||||
uint32_t *srcLine, *src;
|
||||
uint32_t mask;
|
||||
int dstStride, srcStride;
|
||||
uint16_t w;
|
||||
uint32_t component_half = 0x800080;
|
||||
uint32_t alpha_mask = 0xff;
|
||||
|
||||
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 = (mask) >> 24;
|
||||
|
||||
while (height--)
|
||||
{
|
||||
dst = dstLine;
|
||||
dstLine += dstStride;
|
||||
src = srcLine;
|
||||
srcLine += srcStride;
|
||||
w = width;
|
||||
|
||||
//#define inner_branch
|
||||
asm volatile (
|
||||
"cmp %[w], #0\n\t"
|
||||
"beq 2f\n\t"
|
||||
"1:\n\t"
|
||||
/* load src */
|
||||
"ldr r5, [%[src]], #4\n\t"
|
||||
#ifdef inner_branch
|
||||
/* We can avoid doing the multiplication in two cases: 0x0 or 0xff.
|
||||
* The 0x0 case also allows us to avoid doing an unecessary data
|
||||
* write which is more valuable so we only check for that */
|
||||
"cmp r5, #0\n\t"
|
||||
"beq 3f\n\t"
|
||||
|
||||
#endif
|
||||
"ldr r4, [%[dest]] \n\t"
|
||||
|
||||
"uxtb16 r6, r5\n\t"
|
||||
"uxtb16 r7, r5, ror #8\n\t"
|
||||
|
||||
/* multiply by alpha (r8) then by 257 and divide by 65536 */
|
||||
"mla r6, r6, %[mask_alpha], %[component_half]\n\t"
|
||||
"mla r7, r7, %[mask_alpha], %[component_half]\n\t"
|
||||
|
||||
"uxtab16 r6, r6, r6, ror #8\n\t"
|
||||
"uxtab16 r7, r7, r7, ror #8\n\t"
|
||||
|
||||
"uxtb16 r6, r6, ror #8\n\t"
|
||||
"uxtb16 r7, r7, ror #8\n\t"
|
||||
|
||||
/* recombine */
|
||||
"orr r5, r6, r7, lsl #8\n\t"
|
||||
|
||||
"uxtb16 r6, r4\n\t"
|
||||
"uxtb16 r7, r4, ror #8\n\t"
|
||||
|
||||
/* 255 - alpha */
|
||||
"sub r8, %[alpha_mask], r5, lsr #24\n\t"
|
||||
|
||||
/* multiply by alpha (r8) then by 257 and divide by 65536 */
|
||||
"mla r6, r6, r8, %[component_half]\n\t"
|
||||
"mla r7, r7, r8, %[component_half]\n\t"
|
||||
|
||||
"uxtab16 r6, r6, r6, ror #8\n\t"
|
||||
"uxtab16 r7, r7, r7, ror #8\n\t"
|
||||
|
||||
"uxtb16 r6, r6, ror #8\n\t"
|
||||
"uxtb16 r7, r7, ror #8\n\t"
|
||||
|
||||
/* recombine */
|
||||
"orr r6, r6, r7, lsl #8\n\t"
|
||||
|
||||
"uqadd8 r5, r6, r5\n\t"
|
||||
|
||||
#ifdef inner_branch
|
||||
"3:\n\t"
|
||||
|
||||
#endif
|
||||
"str r5, [%[dest]], #4\n\t"
|
||||
/* increment counter and jmp to top */
|
||||
"subs %[w], %[w], #1\n\t"
|
||||
"bne 1b\n\t"
|
||||
"2:\n\t"
|
||||
: [w] "+r" (w), [dest] "+r" (dst), [src] "+r" (src)
|
||||
: [component_half] "r" (component_half), [mask_alpha] "r" (mask),
|
||||
[alpha_mask] "r" (alpha_mask)
|
||||
: "r4", "r5", "r6", "r7", "r8", "r9", "cc", "memory"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
fbCompositeSolidMask_nx8x8888arm (pixman_op_t op,
|
||||
pixman_image_t * pSrc,
|
||||
pixman_image_t * pMask,
|
||||
pixman_image_t * pDst,
|
||||
int16_t xSrc,
|
||||
int16_t ySrc,
|
||||
int16_t xMask,
|
||||
int16_t yMask,
|
||||
int16_t xDst,
|
||||
int16_t yDst,
|
||||
uint16_t width,
|
||||
uint16_t height)
|
||||
{
|
||||
uint32_t src, srca;
|
||||
uint32_t *dstLine, *dst;
|
||||
uint8_t *maskLine, *mask;
|
||||
int dstStride, maskStride;
|
||||
uint16_t w;
|
||||
|
||||
fbComposeGetSolid(pSrc, src, pDst->bits.format);
|
||||
|
||||
srca = src >> 24;
|
||||
if (src == 0)
|
||||
return;
|
||||
|
||||
uint32_t component_mask = 0xff00ff;
|
||||
uint32_t component_half = 0x800080;
|
||||
|
||||
uint32_t src_hi = (src >> 8) & component_mask;
|
||||
uint32_t src_lo = src & component_mask;
|
||||
|
||||
fbComposeGetStart (pDst, xDst, yDst, uint32_t, dstStride, dstLine, 1);
|
||||
fbComposeGetStart (pMask, xMask, yMask, uint8_t, maskStride, maskLine, 1);
|
||||
|
||||
while (height--)
|
||||
{
|
||||
dst = dstLine;
|
||||
dstLine += dstStride;
|
||||
mask = maskLine;
|
||||
maskLine += maskStride;
|
||||
w = width;
|
||||
|
||||
//#define inner_branch
|
||||
asm volatile (
|
||||
"cmp %[w], #0\n\t"
|
||||
"beq 2f\n\t"
|
||||
"1:\n\t"
|
||||
/* load mask */
|
||||
"ldrb r5, [%[mask]], #1\n\t"
|
||||
#ifdef inner_branch
|
||||
/* We can avoid doing the multiplication in two cases: 0x0 or 0xff.
|
||||
* The 0x0 case also allows us to avoid doing an unecessary data
|
||||
* write which is more valuable so we only check for that */
|
||||
"cmp r5, #0\n\t"
|
||||
"beq 3f\n\t"
|
||||
|
||||
#endif
|
||||
"ldr r4, [%[dest]] \n\t"
|
||||
|
||||
/* multiply by alpha (r8) then by 257 and divide by 65536 */
|
||||
"mla r6, %[src_lo], r5, %[component_half]\n\t"
|
||||
"mla r7, %[src_hi], r5, %[component_half]\n\t"
|
||||
|
||||
"uxtab16 r6, r6, r6, ror #8\n\t"
|
||||
"uxtab16 r7, r7, r7, ror #8\n\t"
|
||||
|
||||
"uxtb16 r6, r6, ror #8\n\t"
|
||||
"uxtb16 r7, r7, ror #8\n\t"
|
||||
|
||||
/* recombine */
|
||||
"orr r5, r6, r7, lsl #8\n\t"
|
||||
|
||||
"uxtb16 r6, r4\n\t"
|
||||
"uxtb16 r7, r4, ror #8\n\t"
|
||||
|
||||
/* we could simplify this to use 'sub' if we were
|
||||
* willing to give up a register for alpha_mask */
|
||||
"mvn r8, r5\n\t"
|
||||
"mov r8, r8, lsr #24\n\t"
|
||||
|
||||
/* multiply by alpha (r8) then by 257 and divide by 65536 */
|
||||
"mla r6, r6, r8, %[component_half]\n\t"
|
||||
"mla r7, r7, r8, %[component_half]\n\t"
|
||||
|
||||
"uxtab16 r6, r6, r6, ror #8\n\t"
|
||||
"uxtab16 r7, r7, r7, ror #8\n\t"
|
||||
|
||||
"uxtb16 r6, r6, ror #8\n\t"
|
||||
"uxtb16 r7, r7, ror #8\n\t"
|
||||
|
||||
/* recombine */
|
||||
"orr r6, r6, r7, lsl #8\n\t"
|
||||
|
||||
"uqadd8 r5, r6, r5\n\t"
|
||||
|
||||
#ifdef inner_branch
|
||||
"3:\n\t"
|
||||
|
||||
#endif
|
||||
"str r5, [%[dest]], #4\n\t"
|
||||
/* increment counter and jmp to top */
|
||||
"subs %[w], %[w], #1\n\t"
|
||||
"bne 1b\n\t"
|
||||
"2:\n\t"
|
||||
: [w] "+r" (w), [dest] "+r" (dst), [src] "+r" (src), [mask] "+r" (mask)
|
||||
: [component_half] "r" (component_half),
|
||||
[src_hi] "r" (src_hi), [src_lo] "r" (src_lo)
|
||||
: "r4", "r5", "r6", "r7", "r8", "cc", "memory"
|
||||
);
|
||||
}
|
||||
}
|
||||
94
uppdev/plugin/pixman/lib/pixman-arm-simd.h
Normal file
94
uppdev/plugin/pixman/lib/pixman-arm-simd.h
Normal file
|
|
@ -0,0 +1,94 @@
|
|||
/*
|
||||
* Copyright © 2008 Mozilla Corporation
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and its
|
||||
* documentation for any purpose is hereby granted without fee, provided that
|
||||
* the above copyright notice appear in all copies and that both that
|
||||
* copyright notice and this permission notice appear in supporting
|
||||
* documentation, and that the name of Mozilla Corporation not be used in
|
||||
* advertising or publicity pertaining to distribution of the software without
|
||||
* specific, written prior permission. Mozilla Corporation makes no
|
||||
* representations about the suitability of this software for any purpose. It
|
||||
* is provided "as is" without express or implied warranty.
|
||||
*
|
||||
* THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
|
||||
* SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
* FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
* SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
|
||||
* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
|
||||
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
|
||||
* SOFTWARE.
|
||||
*
|
||||
* Author: Jeff Muizelaar (jeff@infidigm.net)
|
||||
*
|
||||
*/
|
||||
|
||||
#include "pixman-private.h"
|
||||
|
||||
#ifdef USE_ARM_SIMD
|
||||
|
||||
static inline pixman_bool_t pixman_have_arm_simd(void) { return TRUE; }
|
||||
|
||||
#else
|
||||
#define pixman_have_arm_simd() FALSE
|
||||
#endif
|
||||
|
||||
#ifdef USE_ARM_SIMD
|
||||
|
||||
void
|
||||
fbCompositeSrcAdd_8000x8000arm (pixman_op_t op,
|
||||
pixman_image_t * pSrc,
|
||||
pixman_image_t * pMask,
|
||||
pixman_image_t * pDst,
|
||||
int16_t xSrc,
|
||||
int16_t ySrc,
|
||||
int16_t xMask,
|
||||
int16_t yMask,
|
||||
int16_t xDst,
|
||||
int16_t yDst,
|
||||
uint16_t width,
|
||||
uint16_t height);
|
||||
void
|
||||
fbCompositeSrc_8888x8888arm (pixman_op_t op,
|
||||
pixman_image_t * pSrc,
|
||||
pixman_image_t * pMask,
|
||||
pixman_image_t * pDst,
|
||||
int16_t xSrc,
|
||||
int16_t ySrc,
|
||||
int16_t xMask,
|
||||
int16_t yMask,
|
||||
int16_t xDst,
|
||||
int16_t yDst,
|
||||
uint16_t width,
|
||||
uint16_t height);
|
||||
|
||||
void
|
||||
fbCompositeSrc_8888x8x8888arm (pixman_op_t op,
|
||||
pixman_image_t * pSrc,
|
||||
pixman_image_t * pMask,
|
||||
pixman_image_t * pDst,
|
||||
int16_t xSrc,
|
||||
int16_t ySrc,
|
||||
int16_t xMask,
|
||||
int16_t yMask,
|
||||
int16_t xDst,
|
||||
int16_t yDst,
|
||||
uint16_t width,
|
||||
uint16_t height);
|
||||
void
|
||||
fbCompositeSolidMask_nx8x8888arm (pixman_op_t op,
|
||||
pixman_image_t * pSrc,
|
||||
pixman_image_t * pMask,
|
||||
pixman_image_t * pDst,
|
||||
int16_t xSrc,
|
||||
int16_t ySrc,
|
||||
int16_t xMask,
|
||||
int16_t yMask,
|
||||
int16_t xDst,
|
||||
int16_t yDst,
|
||||
uint16_t width,
|
||||
uint16_t height);
|
||||
|
||||
|
||||
#endif /* USE_ARM */
|
||||
1273
uppdev/plugin/pixman/lib/pixman-combine32.c
Normal file
1273
uppdev/plugin/pixman/lib/pixman-combine32.c
Normal file
File diff suppressed because it is too large
Load diff
217
uppdev/plugin/pixman/lib/pixman-combine32.h
Normal file
217
uppdev/plugin/pixman/lib/pixman-combine32.h
Normal file
|
|
@ -0,0 +1,217 @@
|
|||
/* WARNING: This file is generated by combine.pl from combine.inc.
|
||||
Please edit one of those files rather than this one. */
|
||||
|
||||
#line 1 "combine.inc"
|
||||
|
||||
#define COMPONENT_SIZE 8
|
||||
#define MASK 0xff
|
||||
#define ONE_HALF 0x80
|
||||
|
||||
#define A_SHIFT 8 * 3
|
||||
#define R_SHIFT 8 * 2
|
||||
#define G_SHIFT 8
|
||||
#define A_MASK 0xff000000
|
||||
#define R_MASK 0xff0000
|
||||
#define G_MASK 0xff00
|
||||
|
||||
#define RB_MASK 0xff00ff
|
||||
#define AG_MASK 0xff00ff00
|
||||
#define RB_ONE_HALF 0x800080
|
||||
#define RB_MASK_PLUS_ONE 0x10000100
|
||||
|
||||
#define Alpha(x) ((x) >> A_SHIFT)
|
||||
|
||||
/*
|
||||
* Helper macros.
|
||||
*/
|
||||
|
||||
#define IntMult(a,b,t) ( (t) = (a) * (b) + ONE_HALF, ( ( ( (t)>>G_SHIFT ) + (t) )>>G_SHIFT ) )
|
||||
#define IntDiv(a,b) (((uint16_t) (a) * MASK) / (b))
|
||||
|
||||
#define GetComp(v,i) ((uint16_t) (uint8_t) ((v) >> i))
|
||||
|
||||
#define Add(x,y,i,t) ((t) = GetComp(x,i) + GetComp(y,i), \
|
||||
(uint32_t) ((uint8_t) ((t) | (0 - ((t) >> G_SHIFT)))) << (i))
|
||||
|
||||
#define FbGen(x,y,i,ax,ay,t,u,v) ((t) = (IntMult(GetComp(y,i),ay,(u)) + \
|
||||
IntMult(GetComp(x,i),ax,(v))), \
|
||||
(uint32_t) ((uint8_t) ((t) | \
|
||||
(0 - ((t) >> G_SHIFT)))) << (i))
|
||||
|
||||
/*
|
||||
The methods below use some tricks to be able to do two color
|
||||
components at the same time.
|
||||
*/
|
||||
|
||||
/*
|
||||
x_c = (x_c * a) / 255
|
||||
*/
|
||||
#define FbByteMul(x, a) do { \
|
||||
uint32_t t = ((x & RB_MASK) * a) + RB_ONE_HALF; \
|
||||
t = (t + ((t >> COMPONENT_SIZE) & RB_MASK)) >> COMPONENT_SIZE; \
|
||||
t &= RB_MASK; \
|
||||
\
|
||||
x = (((x >> COMPONENT_SIZE) & RB_MASK) * a) + RB_ONE_HALF; \
|
||||
x = (x + ((x >> COMPONENT_SIZE) & RB_MASK)); \
|
||||
x &= RB_MASK << COMPONENT_SIZE; \
|
||||
x += t; \
|
||||
} while (0)
|
||||
|
||||
/*
|
||||
x_c = (x_c * a) / 255 + y
|
||||
*/
|
||||
#define FbByteMulAdd(x, a, y) do { \
|
||||
/* multiply and divide: trunc((i + 128)*257/65536) */ \
|
||||
uint32_t t = ((x & RB_MASK) * a) + RB_ONE_HALF; \
|
||||
t = (t + ((t >> COMPONENT_SIZE) & RB_MASK)) >> COMPONENT_SIZE; \
|
||||
t &= RB_MASK; \
|
||||
\
|
||||
/* add */ \
|
||||
t += y & RB_MASK; \
|
||||
\
|
||||
/* saturate */ \
|
||||
t |= RB_MASK_PLUS_ONE - ((t >> COMPONENT_SIZE) & RB_MASK); \
|
||||
t &= RB_MASK; \
|
||||
\
|
||||
/* multiply and divide */ \
|
||||
x = (((x >> COMPONENT_SIZE) & RB_MASK) * a) + RB_ONE_HALF; \
|
||||
x = (x + ((x >> COMPONENT_SIZE) & RB_MASK)) >> COMPONENT_SIZE; \
|
||||
x &= RB_MASK; \
|
||||
\
|
||||
/* add */ \
|
||||
x += (y >> COMPONENT_SIZE) & RB_MASK; \
|
||||
\
|
||||
/* saturate */ \
|
||||
x |= RB_MASK_PLUS_ONE - ((x >> COMPONENT_SIZE) & RB_MASK); \
|
||||
x &= RB_MASK; \
|
||||
\
|
||||
/* recombine */ \
|
||||
x <<= COMPONENT_SIZE; \
|
||||
x += t; \
|
||||
} while (0)
|
||||
|
||||
/*
|
||||
x_c = (x_c * a + y_c * b) / 255
|
||||
*/
|
||||
#define FbByteAddMul(x, a, y, b) do { \
|
||||
uint32_t t; \
|
||||
uint32_t r = (x >> A_SHIFT) * a + (y >> A_SHIFT) * b + ONE_HALF; \
|
||||
r += (r >> G_SHIFT); \
|
||||
r >>= G_SHIFT; \
|
||||
\
|
||||
t = (x & G_MASK) * a + (y & G_MASK) * b; \
|
||||
t += (t >> G_SHIFT) + (ONE_HALF << G_SHIFT); \
|
||||
t >>= R_SHIFT; \
|
||||
\
|
||||
t |= r << R_SHIFT; \
|
||||
t |= RB_MASK_PLUS_ONE - ((t >> G_SHIFT) & RB_MASK); \
|
||||
t &= RB_MASK; \
|
||||
t <<= G_SHIFT; \
|
||||
\
|
||||
r = ((x >> R_SHIFT) & MASK) * a + \
|
||||
((y >> R_SHIFT) & MASK) * b + ONE_HALF; \
|
||||
r += (r >> G_SHIFT); \
|
||||
r >>= G_SHIFT; \
|
||||
\
|
||||
x = (x & MASK) * a + (y & MASK) * b + ONE_HALF; \
|
||||
x += (x >> G_SHIFT); \
|
||||
x >>= G_SHIFT; \
|
||||
x |= r << R_SHIFT; \
|
||||
x |= RB_MASK_PLUS_ONE - ((x >> G_SHIFT) & RB_MASK); \
|
||||
x &= RB_MASK; \
|
||||
x |= t; \
|
||||
} while (0)
|
||||
|
||||
/*
|
||||
x_c = (x_c * a_c) / 255
|
||||
*/
|
||||
#define FbByteMulC(x, a) do { \
|
||||
uint32_t t; \
|
||||
uint32_t r = (x & MASK) * (a & MASK); \
|
||||
r |= (x & R_MASK) * ((a >> R_SHIFT) & MASK); \
|
||||
r += RB_ONE_HALF; \
|
||||
r = (r + ((r >> G_SHIFT) & RB_MASK)) >> G_SHIFT; \
|
||||
r &= RB_MASK; \
|
||||
\
|
||||
x >>= G_SHIFT; \
|
||||
t = (x & MASK) * ((a >> G_SHIFT) & MASK); \
|
||||
t |= (x & R_MASK) * (a >> A_SHIFT); \
|
||||
t += RB_ONE_HALF; \
|
||||
t = t + ((t >> G_SHIFT) & RB_MASK); \
|
||||
x = r | (t & AG_MASK); \
|
||||
} while (0)
|
||||
|
||||
/*
|
||||
x_c = (x_c * a) / 255 + y
|
||||
*/
|
||||
#define FbByteMulAddC(x, a, y) do { \
|
||||
uint32_t t; \
|
||||
uint32_t r = (x & MASK) * (a & MASK); \
|
||||
r |= (x & R_MASK) * ((a >> R_SHIFT) & MASK); \
|
||||
r += RB_ONE_HALF; \
|
||||
r = (r + ((r >> G_SHIFT) & RB_MASK)) >> G_SHIFT; \
|
||||
r &= RB_MASK; \
|
||||
r += y & RB_MASK; \
|
||||
r |= RB_MASK_PLUS_ONE - ((r >> G_SHIFT) & RB_MASK); \
|
||||
r &= RB_MASK; \
|
||||
\
|
||||
x >>= G_SHIFT; \
|
||||
t = (x & MASK) * ((a >> G_SHIFT) & MASK); \
|
||||
t |= (x & R_MASK) * (a >> A_SHIFT); \
|
||||
t += RB_ONE_HALF; \
|
||||
t = (t + ((t >> G_SHIFT) & RB_MASK)) >> G_SHIFT; \
|
||||
t &= RB_MASK; \
|
||||
t += (y >> G_SHIFT) & RB_MASK; \
|
||||
t |= RB_MASK_PLUS_ONE - ((t >> G_SHIFT) & RB_MASK); \
|
||||
t &= RB_MASK; \
|
||||
x = r | (t << G_SHIFT); \
|
||||
} while (0)
|
||||
|
||||
/*
|
||||
x_c = (x_c * a_c + y_c * b) / 255
|
||||
*/
|
||||
#define FbByteAddMulC(x, a, y, b) do { \
|
||||
uint32_t t; \
|
||||
uint32_t r = (x >> A_SHIFT) * (a >> A_SHIFT) + \
|
||||
(y >> A_SHIFT) * b; \
|
||||
r += (r >> G_SHIFT) + ONE_HALF; \
|
||||
r >>= G_SHIFT; \
|
||||
\
|
||||
t = (x & G_MASK) * ((a >> G_SHIFT) & MASK) + (y & G_MASK) * b; \
|
||||
t += (t >> G_SHIFT) + (ONE_HALF << G_SHIFT); \
|
||||
t >>= R_SHIFT; \
|
||||
\
|
||||
t |= r << R_SHIFT; \
|
||||
t |= RB_MASK_PLUS_ONE - ((t >> G_SHIFT) & RB_MASK); \
|
||||
t &= RB_MASK; \
|
||||
t <<= G_SHIFT; \
|
||||
\
|
||||
r = ((x >> R_SHIFT) & MASK) * ((a >> R_SHIFT) & MASK) + \
|
||||
((y >> R_SHIFT) & MASK) * b + ONE_HALF; \
|
||||
r += (r >> G_SHIFT); \
|
||||
r >>= G_SHIFT; \
|
||||
\
|
||||
x = (x & MASK) * (a & MASK) + (y & MASK) * b + ONE_HALF; \
|
||||
x += (x >> G_SHIFT); \
|
||||
x >>= G_SHIFT; \
|
||||
x |= r << R_SHIFT; \
|
||||
x |= RB_MASK_PLUS_ONE - ((x >> G_SHIFT) & RB_MASK); \
|
||||
x &= RB_MASK; \
|
||||
x |= t; \
|
||||
} while (0)
|
||||
|
||||
/*
|
||||
x_c = min(x_c + y_c, 255)
|
||||
*/
|
||||
#define FbByteAdd(x, y) do { \
|
||||
uint32_t t; \
|
||||
uint32_t r = (x & RB_MASK) + (y & RB_MASK); \
|
||||
r |= RB_MASK_PLUS_ONE - ((r >> G_SHIFT) & RB_MASK); \
|
||||
r &= RB_MASK; \
|
||||
\
|
||||
t = ((x >> G_SHIFT) & RB_MASK) + ((y >> G_SHIFT) & RB_MASK); \
|
||||
t |= RB_MASK_PLUS_ONE - ((t >> G_SHIFT) & RB_MASK); \
|
||||
r |= (t & RB_MASK) << G_SHIFT; \
|
||||
x = r; \
|
||||
} while (0)
|
||||
|
||||
1273
uppdev/plugin/pixman/lib/pixman-combine64.c
Normal file
1273
uppdev/plugin/pixman/lib/pixman-combine64.c
Normal file
File diff suppressed because it is too large
Load diff
217
uppdev/plugin/pixman/lib/pixman-combine64.h
Normal file
217
uppdev/plugin/pixman/lib/pixman-combine64.h
Normal file
|
|
@ -0,0 +1,217 @@
|
|||
/* WARNING: This file is generated by combine.pl from combine.inc.
|
||||
Please edit one of those files rather than this one. */
|
||||
|
||||
#line 1 "combine.inc"
|
||||
|
||||
#define COMPONENT_SIZE 16
|
||||
#define MASK 0xffffULL
|
||||
#define ONE_HALF 0x8000ULL
|
||||
|
||||
#define A_SHIFT 16 * 3
|
||||
#define R_SHIFT 16 * 2
|
||||
#define G_SHIFT 16
|
||||
#define A_MASK 0xffff000000000000ULL
|
||||
#define R_MASK 0xffff00000000ULL
|
||||
#define G_MASK 0xffff0000ULL
|
||||
|
||||
#define RB_MASK 0xffff0000ffffULL
|
||||
#define AG_MASK 0xffff0000ffff0000ULL
|
||||
#define RB_ONE_HALF 0x800000008000ULL
|
||||
#define RB_MASK_PLUS_ONE 0x10000000010000ULL
|
||||
|
||||
#define Alpha(x) ((x) >> A_SHIFT)
|
||||
|
||||
/*
|
||||
* Helper macros.
|
||||
*/
|
||||
|
||||
#define IntMult(a,b,t) ( (t) = (a) * (b) + ONE_HALF, ( ( ( (t)>>G_SHIFT ) + (t) )>>G_SHIFT ) )
|
||||
#define IntDiv(a,b) (((uint32_t) (a) * MASK) / (b))
|
||||
|
||||
#define GetComp(v,i) ((uint32_t) (uint16_t) ((v) >> i))
|
||||
|
||||
#define Add(x,y,i,t) ((t) = GetComp(x,i) + GetComp(y,i), \
|
||||
(uint64_t) ((uint16_t) ((t) | (0 - ((t) >> G_SHIFT)))) << (i))
|
||||
|
||||
#define FbGen(x,y,i,ax,ay,t,u,v) ((t) = (IntMult(GetComp(y,i),ay,(u)) + \
|
||||
IntMult(GetComp(x,i),ax,(v))), \
|
||||
(uint64_t) ((uint16_t) ((t) | \
|
||||
(0 - ((t) >> G_SHIFT)))) << (i))
|
||||
|
||||
/*
|
||||
The methods below use some tricks to be able to do two color
|
||||
components at the same time.
|
||||
*/
|
||||
|
||||
/*
|
||||
x_c = (x_c * a) / 255
|
||||
*/
|
||||
#define FbByteMul(x, a) do { \
|
||||
uint64_t t = ((x & RB_MASK) * a) + RB_ONE_HALF; \
|
||||
t = (t + ((t >> COMPONENT_SIZE) & RB_MASK)) >> COMPONENT_SIZE; \
|
||||
t &= RB_MASK; \
|
||||
\
|
||||
x = (((x >> COMPONENT_SIZE) & RB_MASK) * a) + RB_ONE_HALF; \
|
||||
x = (x + ((x >> COMPONENT_SIZE) & RB_MASK)); \
|
||||
x &= RB_MASK << COMPONENT_SIZE; \
|
||||
x += t; \
|
||||
} while (0)
|
||||
|
||||
/*
|
||||
x_c = (x_c * a) / 255 + y
|
||||
*/
|
||||
#define FbByteMulAdd(x, a, y) do { \
|
||||
/* multiply and divide: trunc((i + 128)*257/65536) */ \
|
||||
uint64_t t = ((x & RB_MASK) * a) + RB_ONE_HALF; \
|
||||
t = (t + ((t >> COMPONENT_SIZE) & RB_MASK)) >> COMPONENT_SIZE; \
|
||||
t &= RB_MASK; \
|
||||
\
|
||||
/* add */ \
|
||||
t += y & RB_MASK; \
|
||||
\
|
||||
/* saturate */ \
|
||||
t |= RB_MASK_PLUS_ONE - ((t >> COMPONENT_SIZE) & RB_MASK); \
|
||||
t &= RB_MASK; \
|
||||
\
|
||||
/* multiply and divide */ \
|
||||
x = (((x >> COMPONENT_SIZE) & RB_MASK) * a) + RB_ONE_HALF; \
|
||||
x = (x + ((x >> COMPONENT_SIZE) & RB_MASK)) >> COMPONENT_SIZE; \
|
||||
x &= RB_MASK; \
|
||||
\
|
||||
/* add */ \
|
||||
x += (y >> COMPONENT_SIZE) & RB_MASK; \
|
||||
\
|
||||
/* saturate */ \
|
||||
x |= RB_MASK_PLUS_ONE - ((x >> COMPONENT_SIZE) & RB_MASK); \
|
||||
x &= RB_MASK; \
|
||||
\
|
||||
/* recombine */ \
|
||||
x <<= COMPONENT_SIZE; \
|
||||
x += t; \
|
||||
} while (0)
|
||||
|
||||
/*
|
||||
x_c = (x_c * a + y_c * b) / 255
|
||||
*/
|
||||
#define FbByteAddMul(x, a, y, b) do { \
|
||||
uint64_t t; \
|
||||
uint64_t r = (x >> A_SHIFT) * a + (y >> A_SHIFT) * b + ONE_HALF; \
|
||||
r += (r >> G_SHIFT); \
|
||||
r >>= G_SHIFT; \
|
||||
\
|
||||
t = (x & G_MASK) * a + (y & G_MASK) * b; \
|
||||
t += (t >> G_SHIFT) + (ONE_HALF << G_SHIFT); \
|
||||
t >>= R_SHIFT; \
|
||||
\
|
||||
t |= r << R_SHIFT; \
|
||||
t |= RB_MASK_PLUS_ONE - ((t >> G_SHIFT) & RB_MASK); \
|
||||
t &= RB_MASK; \
|
||||
t <<= G_SHIFT; \
|
||||
\
|
||||
r = ((x >> R_SHIFT) & MASK) * a + \
|
||||
((y >> R_SHIFT) & MASK) * b + ONE_HALF; \
|
||||
r += (r >> G_SHIFT); \
|
||||
r >>= G_SHIFT; \
|
||||
\
|
||||
x = (x & MASK) * a + (y & MASK) * b + ONE_HALF; \
|
||||
x += (x >> G_SHIFT); \
|
||||
x >>= G_SHIFT; \
|
||||
x |= r << R_SHIFT; \
|
||||
x |= RB_MASK_PLUS_ONE - ((x >> G_SHIFT) & RB_MASK); \
|
||||
x &= RB_MASK; \
|
||||
x |= t; \
|
||||
} while (0)
|
||||
|
||||
/*
|
||||
x_c = (x_c * a_c) / 255
|
||||
*/
|
||||
#define FbByteMulC(x, a) do { \
|
||||
uint64_t t; \
|
||||
uint64_t r = (x & MASK) * (a & MASK); \
|
||||
r |= (x & R_MASK) * ((a >> R_SHIFT) & MASK); \
|
||||
r += RB_ONE_HALF; \
|
||||
r = (r + ((r >> G_SHIFT) & RB_MASK)) >> G_SHIFT; \
|
||||
r &= RB_MASK; \
|
||||
\
|
||||
x >>= G_SHIFT; \
|
||||
t = (x & MASK) * ((a >> G_SHIFT) & MASK); \
|
||||
t |= (x & R_MASK) * (a >> A_SHIFT); \
|
||||
t += RB_ONE_HALF; \
|
||||
t = t + ((t >> G_SHIFT) & RB_MASK); \
|
||||
x = r | (t & AG_MASK); \
|
||||
} while (0)
|
||||
|
||||
/*
|
||||
x_c = (x_c * a) / 255 + y
|
||||
*/
|
||||
#define FbByteMulAddC(x, a, y) do { \
|
||||
uint64_t t; \
|
||||
uint64_t r = (x & MASK) * (a & MASK); \
|
||||
r |= (x & R_MASK) * ((a >> R_SHIFT) & MASK); \
|
||||
r += RB_ONE_HALF; \
|
||||
r = (r + ((r >> G_SHIFT) & RB_MASK)) >> G_SHIFT; \
|
||||
r &= RB_MASK; \
|
||||
r += y & RB_MASK; \
|
||||
r |= RB_MASK_PLUS_ONE - ((r >> G_SHIFT) & RB_MASK); \
|
||||
r &= RB_MASK; \
|
||||
\
|
||||
x >>= G_SHIFT; \
|
||||
t = (x & MASK) * ((a >> G_SHIFT) & MASK); \
|
||||
t |= (x & R_MASK) * (a >> A_SHIFT); \
|
||||
t += RB_ONE_HALF; \
|
||||
t = (t + ((t >> G_SHIFT) & RB_MASK)) >> G_SHIFT; \
|
||||
t &= RB_MASK; \
|
||||
t += (y >> G_SHIFT) & RB_MASK; \
|
||||
t |= RB_MASK_PLUS_ONE - ((t >> G_SHIFT) & RB_MASK); \
|
||||
t &= RB_MASK; \
|
||||
x = r | (t << G_SHIFT); \
|
||||
} while (0)
|
||||
|
||||
/*
|
||||
x_c = (x_c * a_c + y_c * b) / 255
|
||||
*/
|
||||
#define FbByteAddMulC(x, a, y, b) do { \
|
||||
uint64_t t; \
|
||||
uint64_t r = (x >> A_SHIFT) * (a >> A_SHIFT) + \
|
||||
(y >> A_SHIFT) * b; \
|
||||
r += (r >> G_SHIFT) + ONE_HALF; \
|
||||
r >>= G_SHIFT; \
|
||||
\
|
||||
t = (x & G_MASK) * ((a >> G_SHIFT) & MASK) + (y & G_MASK) * b; \
|
||||
t += (t >> G_SHIFT) + (ONE_HALF << G_SHIFT); \
|
||||
t >>= R_SHIFT; \
|
||||
\
|
||||
t |= r << R_SHIFT; \
|
||||
t |= RB_MASK_PLUS_ONE - ((t >> G_SHIFT) & RB_MASK); \
|
||||
t &= RB_MASK; \
|
||||
t <<= G_SHIFT; \
|
||||
\
|
||||
r = ((x >> R_SHIFT) & MASK) * ((a >> R_SHIFT) & MASK) + \
|
||||
((y >> R_SHIFT) & MASK) * b + ONE_HALF; \
|
||||
r += (r >> G_SHIFT); \
|
||||
r >>= G_SHIFT; \
|
||||
\
|
||||
x = (x & MASK) * (a & MASK) + (y & MASK) * b + ONE_HALF; \
|
||||
x += (x >> G_SHIFT); \
|
||||
x >>= G_SHIFT; \
|
||||
x |= r << R_SHIFT; \
|
||||
x |= RB_MASK_PLUS_ONE - ((x >> G_SHIFT) & RB_MASK); \
|
||||
x &= RB_MASK; \
|
||||
x |= t; \
|
||||
} while (0)
|
||||
|
||||
/*
|
||||
x_c = min(x_c + y_c, 255)
|
||||
*/
|
||||
#define FbByteAdd(x, y) do { \
|
||||
uint64_t t; \
|
||||
uint64_t r = (x & RB_MASK) + (y & RB_MASK); \
|
||||
r |= RB_MASK_PLUS_ONE - ((r >> G_SHIFT) & RB_MASK); \
|
||||
r &= RB_MASK; \
|
||||
\
|
||||
t = ((x >> G_SHIFT) & RB_MASK) + ((y >> G_SHIFT) & RB_MASK); \
|
||||
t |= RB_MASK_PLUS_ONE - ((t >> G_SHIFT) & RB_MASK); \
|
||||
r |= (t & RB_MASK) << G_SHIFT; \
|
||||
x = r; \
|
||||
} while (0)
|
||||
|
||||
4
uppdev/plugin/pixman/lib/pixman-compose-accessors.c
Normal file
4
uppdev/plugin/pixman/lib/pixman-compose-accessors.c
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
|
||||
#define PIXMAN_FB_ACCESSORS
|
||||
|
||||
#include "pixman-compose.c"
|
||||
596
uppdev/plugin/pixman/lib/pixman-compose.c
Normal file
596
uppdev/plugin/pixman/lib/pixman-compose.c
Normal file
|
|
@ -0,0 +1,596 @@
|
|||
/*
|
||||
*
|
||||
* Copyright © 2000 Keith Packard, member of The XFree86 Project, Inc.
|
||||
* 2005 Lars Knoll & Zack Rusin, Trolltech
|
||||
* 2008 Aaron Plattner, NVIDIA Corporation
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and its
|
||||
* documentation for any purpose is hereby granted without fee, provided that
|
||||
* the above copyright notice appear in all copies and that both that
|
||||
* copyright notice and this permission notice appear in supporting
|
||||
* documentation, and that the name of Keith Packard not be used in
|
||||
* advertising or publicity pertaining to distribution of the software without
|
||||
* specific, written prior permission. Keith Packard makes no
|
||||
* representations about the suitability of this software for any purpose. It
|
||||
* is provided "as is" without express or implied warranty.
|
||||
*
|
||||
* THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
|
||||
* SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
* FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
* SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
|
||||
* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
|
||||
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
#include <assert.h>
|
||||
#include <limits.h>
|
||||
|
||||
#include "pixman-private.h"
|
||||
|
||||
#ifdef PIXMAN_FB_ACCESSORS
|
||||
#define PIXMAN_COMPOSITE_RECT_GENERAL pixman_composite_rect_general_accessors
|
||||
#else
|
||||
#define PIXMAN_COMPOSITE_RECT_GENERAL pixman_composite_rect_general_no_accessors
|
||||
#endif
|
||||
|
||||
static unsigned int
|
||||
SourcePictureClassify (source_image_t *pict,
|
||||
int x,
|
||||
int y,
|
||||
int width,
|
||||
int height)
|
||||
{
|
||||
if (pict->common.type == SOLID)
|
||||
{
|
||||
pict->class = SOURCE_IMAGE_CLASS_HORIZONTAL;
|
||||
}
|
||||
else if (pict->common.type == LINEAR)
|
||||
{
|
||||
linear_gradient_t *linear = (linear_gradient_t *)pict;
|
||||
pixman_vector_t v;
|
||||
pixman_fixed_32_32_t l;
|
||||
pixman_fixed_48_16_t dx, dy, a, b, off;
|
||||
pixman_fixed_48_16_t factors[4];
|
||||
int i;
|
||||
|
||||
dx = linear->p2.x - linear->p1.x;
|
||||
dy = linear->p2.y - linear->p1.y;
|
||||
l = dx * dx + dy * dy;
|
||||
if (l)
|
||||
{
|
||||
a = (dx << 32) / l;
|
||||
b = (dy << 32) / l;
|
||||
}
|
||||
else
|
||||
{
|
||||
a = b = 0;
|
||||
}
|
||||
|
||||
off = (-a * linear->p1.x
|
||||
-b * linear->p1.y) >> 16;
|
||||
|
||||
for (i = 0; i < 3; i++)
|
||||
{
|
||||
v.vector[0] = pixman_int_to_fixed ((i % 2) * (width - 1) + x);
|
||||
v.vector[1] = pixman_int_to_fixed ((i / 2) * (height - 1) + y);
|
||||
v.vector[2] = pixman_fixed_1;
|
||||
|
||||
if (pict->common.transform)
|
||||
{
|
||||
if (!pixman_transform_point_3d (pict->common.transform, &v))
|
||||
return SOURCE_IMAGE_CLASS_UNKNOWN;
|
||||
}
|
||||
|
||||
factors[i] = ((a * v.vector[0] + b * v.vector[1]) >> 16) + off;
|
||||
}
|
||||
|
||||
if (factors[2] == factors[0])
|
||||
pict->class = SOURCE_IMAGE_CLASS_HORIZONTAL;
|
||||
else if (factors[1] == factors[0])
|
||||
pict->class = SOURCE_IMAGE_CLASS_VERTICAL;
|
||||
}
|
||||
|
||||
return pict->class;
|
||||
}
|
||||
|
||||
static void fbFetchSolid(bits_image_t * pict, int x, int y, int width, uint32_t *buffer, uint32_t *mask, uint32_t maskBits)
|
||||
{
|
||||
uint32_t color;
|
||||
uint32_t *end;
|
||||
fetchPixelProc32 fetch = ACCESS(pixman_fetchPixelProcForPicture32)(pict);
|
||||
|
||||
color = fetch(pict, 0, 0);
|
||||
|
||||
end = buffer + width;
|
||||
while (buffer < end)
|
||||
*(buffer++) = color;
|
||||
}
|
||||
|
||||
static void fbFetchSolid64(bits_image_t * pict, int x, int y, int width, uint64_t *buffer, void *unused, uint32_t unused2)
|
||||
{
|
||||
uint64_t color;
|
||||
uint64_t *end;
|
||||
fetchPixelProc64 fetch = ACCESS(pixman_fetchPixelProcForPicture64)(pict);
|
||||
|
||||
color = fetch(pict, 0, 0);
|
||||
|
||||
end = buffer + width;
|
||||
while (buffer < end)
|
||||
*(buffer++) = color;
|
||||
}
|
||||
|
||||
static void fbFetch(bits_image_t * pict, int x, int y, int width, uint32_t *buffer, uint32_t *mask, uint32_t maskBits)
|
||||
{
|
||||
fetchProc32 fetch = ACCESS(pixman_fetchProcForPicture32)(pict);
|
||||
|
||||
fetch(pict, x, y, width, buffer);
|
||||
}
|
||||
|
||||
static void fbFetch64(bits_image_t * pict, int x, int y, int width, uint64_t *buffer, void *unused, uint32_t unused2)
|
||||
{
|
||||
fetchProc64 fetch = ACCESS(pixman_fetchProcForPicture64)(pict);
|
||||
|
||||
fetch(pict, x, y, width, buffer);
|
||||
}
|
||||
|
||||
static void
|
||||
fbStore(bits_image_t * pict, int x, int y, int width, uint32_t *buffer)
|
||||
{
|
||||
uint32_t *bits;
|
||||
int32_t stride;
|
||||
storeProc32 store = ACCESS(pixman_storeProcForPicture32)(pict);
|
||||
const pixman_indexed_t * indexed = pict->indexed;
|
||||
|
||||
bits = pict->bits;
|
||||
stride = pict->rowstride;
|
||||
bits += y*stride;
|
||||
store((pixman_image_t *)pict, bits, buffer, x, width, indexed);
|
||||
}
|
||||
|
||||
static void
|
||||
fbStore64(bits_image_t * pict, int x, int y, int width, uint64_t *buffer)
|
||||
{
|
||||
uint32_t *bits;
|
||||
int32_t stride;
|
||||
storeProc64 store = ACCESS(pixman_storeProcForPicture64)(pict);
|
||||
const pixman_indexed_t * indexed = pict->indexed;
|
||||
|
||||
bits = pict->bits;
|
||||
stride = pict->rowstride;
|
||||
bits += y*stride;
|
||||
store((pixman_image_t *)pict, bits, buffer, x, width, indexed);
|
||||
}
|
||||
|
||||
typedef void (*scanStoreProc)(pixman_image_t *, int, int, int, uint32_t *);
|
||||
typedef void (*scanFetchProc)(pixman_image_t *, int, int, int, uint32_t *,
|
||||
uint32_t *, uint32_t);
|
||||
|
||||
static inline scanFetchProc get_fetch_source_pict(const int wide)
|
||||
{
|
||||
if (wide)
|
||||
return (scanFetchProc)pixmanFetchSourcePict64;
|
||||
else
|
||||
return (scanFetchProc)pixmanFetchSourcePict;
|
||||
}
|
||||
|
||||
static inline scanFetchProc get_fetch_solid(const int wide)
|
||||
{
|
||||
if (wide)
|
||||
return (scanFetchProc)fbFetchSolid64;
|
||||
else
|
||||
return (scanFetchProc)fbFetchSolid;
|
||||
}
|
||||
|
||||
static inline scanFetchProc get_fetch(const int wide)
|
||||
{
|
||||
if (wide)
|
||||
return (scanFetchProc)fbFetch64;
|
||||
else
|
||||
return (scanFetchProc)fbFetch;
|
||||
}
|
||||
|
||||
static inline scanFetchProc get_fetch_external_alpha(const int wide)
|
||||
{
|
||||
if (wide)
|
||||
return (scanFetchProc)ACCESS(fbFetchExternalAlpha64);
|
||||
else
|
||||
return (scanFetchProc)ACCESS(fbFetchExternalAlpha);
|
||||
}
|
||||
|
||||
static inline scanFetchProc get_fetch_transformed(const int wide)
|
||||
{
|
||||
if (wide)
|
||||
return (scanFetchProc)ACCESS(fbFetchTransformed64);
|
||||
else
|
||||
return (scanFetchProc)ACCESS(fbFetchTransformed);
|
||||
}
|
||||
|
||||
static inline scanStoreProc get_store(const int wide)
|
||||
{
|
||||
if (wide)
|
||||
return (scanStoreProc)fbStore64;
|
||||
else
|
||||
return (scanStoreProc)fbStore;
|
||||
}
|
||||
|
||||
static inline scanStoreProc get_store_external_alpha(const int wide)
|
||||
{
|
||||
if (wide)
|
||||
return (scanStoreProc)ACCESS(fbStoreExternalAlpha64);
|
||||
else
|
||||
return (scanStoreProc)ACCESS(fbStoreExternalAlpha);
|
||||
}
|
||||
|
||||
#ifndef PIXMAN_FB_ACCESSORS
|
||||
static
|
||||
#endif
|
||||
void
|
||||
PIXMAN_COMPOSITE_RECT_GENERAL (const FbComposeData *data,
|
||||
void *src_buffer, void *mask_buffer,
|
||||
void *dest_buffer, const int wide)
|
||||
{
|
||||
int i;
|
||||
scanStoreProc store;
|
||||
scanFetchProc fetchSrc = NULL, fetchMask = NULL, fetchDest = NULL;
|
||||
unsigned int srcClass = SOURCE_IMAGE_CLASS_UNKNOWN;
|
||||
unsigned int maskClass = SOURCE_IMAGE_CLASS_UNKNOWN;
|
||||
uint32_t *bits;
|
||||
int32_t stride;
|
||||
int xoff, yoff;
|
||||
|
||||
if (data->op == PIXMAN_OP_CLEAR)
|
||||
fetchSrc = NULL;
|
||||
else if (IS_SOURCE_IMAGE (data->src))
|
||||
{
|
||||
fetchSrc = get_fetch_source_pict(wide);
|
||||
srcClass = SourcePictureClassify ((source_image_t *)data->src,
|
||||
data->xSrc, data->ySrc,
|
||||
data->width, data->height);
|
||||
}
|
||||
else
|
||||
{
|
||||
bits_image_t *bits = (bits_image_t *)data->src;
|
||||
|
||||
if (bits->common.alpha_map)
|
||||
{
|
||||
fetchSrc = get_fetch_external_alpha(wide);
|
||||
}
|
||||
else if ((bits->common.repeat == PIXMAN_REPEAT_NORMAL || bits->common.repeat == PIXMAN_REPEAT_PAD) &&
|
||||
bits->width == 1 &&
|
||||
bits->height == 1)
|
||||
{
|
||||
fetchSrc = get_fetch_solid(wide);
|
||||
srcClass = SOURCE_IMAGE_CLASS_HORIZONTAL;
|
||||
}
|
||||
else if (!bits->common.transform && bits->common.filter != PIXMAN_FILTER_CONVOLUTION
|
||||
&& bits->common.repeat != PIXMAN_REPEAT_PAD)
|
||||
{
|
||||
fetchSrc = get_fetch(wide);
|
||||
}
|
||||
else
|
||||
{
|
||||
fetchSrc = get_fetch_transformed(wide);
|
||||
}
|
||||
}
|
||||
|
||||
if (!data->mask || data->op == PIXMAN_OP_CLEAR)
|
||||
{
|
||||
fetchMask = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (IS_SOURCE_IMAGE (data->mask))
|
||||
{
|
||||
fetchMask = (scanFetchProc)pixmanFetchSourcePict;
|
||||
maskClass = SourcePictureClassify ((source_image_t *)data->mask,
|
||||
data->xMask, data->yMask,
|
||||
data->width, data->height);
|
||||
}
|
||||
else
|
||||
{
|
||||
bits_image_t *bits = (bits_image_t *)data->mask;
|
||||
|
||||
if (bits->common.alpha_map)
|
||||
{
|
||||
fetchMask = get_fetch_external_alpha(wide);
|
||||
}
|
||||
else if ((bits->common.repeat == PIXMAN_REPEAT_NORMAL || bits->common.repeat == PIXMAN_REPEAT_PAD) &&
|
||||
bits->width == 1 && bits->height == 1)
|
||||
{
|
||||
fetchMask = get_fetch_solid(wide);
|
||||
maskClass = SOURCE_IMAGE_CLASS_HORIZONTAL;
|
||||
}
|
||||
else if (!bits->common.transform && bits->common.filter != PIXMAN_FILTER_CONVOLUTION
|
||||
&& bits->common.repeat != PIXMAN_REPEAT_PAD)
|
||||
fetchMask = get_fetch(wide);
|
||||
else
|
||||
fetchMask = get_fetch_transformed(wide);
|
||||
}
|
||||
}
|
||||
|
||||
if (data->dest->common.alpha_map)
|
||||
{
|
||||
fetchDest = get_fetch_external_alpha(wide);
|
||||
store = get_store_external_alpha(wide);
|
||||
|
||||
if (data->op == PIXMAN_OP_CLEAR || data->op == PIXMAN_OP_SRC)
|
||||
fetchDest = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
fetchDest = get_fetch(wide);
|
||||
store = get_store(wide);
|
||||
|
||||
switch (data->op)
|
||||
{
|
||||
case PIXMAN_OP_CLEAR:
|
||||
case PIXMAN_OP_SRC:
|
||||
fetchDest = NULL;
|
||||
#ifndef PIXMAN_FB_ACCESSORS
|
||||
/* fall-through */
|
||||
case PIXMAN_OP_ADD:
|
||||
case PIXMAN_OP_OVER:
|
||||
switch (data->dest->bits.format) {
|
||||
case PIXMAN_a8r8g8b8:
|
||||
case PIXMAN_x8r8g8b8:
|
||||
// Skip the store step and composite directly into the
|
||||
// destination if the output format of the compose func matches
|
||||
// the destination format.
|
||||
if (!wide)
|
||||
store = NULL;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!store)
|
||||
{
|
||||
bits = data->dest->bits.bits;
|
||||
stride = data->dest->bits.rowstride;
|
||||
xoff = yoff = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
bits = NULL;
|
||||
stride = 0;
|
||||
xoff = yoff = 0;
|
||||
}
|
||||
|
||||
if (fetchSrc &&
|
||||
fetchMask &&
|
||||
data->mask &&
|
||||
data->mask->common.type == BITS &&
|
||||
data->mask->common.component_alpha &&
|
||||
PIXMAN_FORMAT_RGB (data->mask->bits.format))
|
||||
{
|
||||
CombineFuncC32 compose =
|
||||
wide ? (CombineFuncC32)pixman_composeFunctions64.combineC[data->op] :
|
||||
pixman_composeFunctions.combineC[data->op];
|
||||
if (!compose)
|
||||
return;
|
||||
|
||||
for (i = 0; i < data->height; ++i) {
|
||||
/* fill first half of scanline with source */
|
||||
if (fetchSrc)
|
||||
{
|
||||
if (fetchMask)
|
||||
{
|
||||
/* fetch mask before source so that fetching of
|
||||
source can be optimized */
|
||||
fetchMask (data->mask, data->xMask, data->yMask + i,
|
||||
data->width, mask_buffer, 0, 0);
|
||||
|
||||
if (maskClass == SOURCE_IMAGE_CLASS_HORIZONTAL)
|
||||
fetchMask = NULL;
|
||||
}
|
||||
|
||||
if (srcClass == SOURCE_IMAGE_CLASS_HORIZONTAL)
|
||||
{
|
||||
fetchSrc (data->src, data->xSrc, data->ySrc + i,
|
||||
data->width, src_buffer, 0, 0);
|
||||
fetchSrc = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
fetchSrc (data->src, data->xSrc, data->ySrc + i,
|
||||
data->width, src_buffer, mask_buffer,
|
||||
0xffffffff);
|
||||
}
|
||||
}
|
||||
else if (fetchMask)
|
||||
{
|
||||
fetchMask (data->mask, data->xMask, data->yMask + i,
|
||||
data->width, mask_buffer, 0, 0);
|
||||
}
|
||||
|
||||
if (store)
|
||||
{
|
||||
/* fill dest into second half of scanline */
|
||||
if (fetchDest)
|
||||
fetchDest (data->dest, data->xDest, data->yDest + i,
|
||||
data->width, dest_buffer, 0, 0);
|
||||
|
||||
/* blend */
|
||||
compose (dest_buffer, src_buffer, mask_buffer, data->width);
|
||||
|
||||
/* write back */
|
||||
store (data->dest, data->xDest, data->yDest + i, data->width,
|
||||
dest_buffer);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* blend */
|
||||
compose (bits + (data->yDest + i+ yoff) * stride +
|
||||
data->xDest + xoff,
|
||||
src_buffer, mask_buffer, data->width);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
void *src_mask_buffer = 0;
|
||||
const int useMask = (fetchMask != NULL);
|
||||
CombineFuncU32 compose =
|
||||
wide ? (CombineFuncU32)pixman_composeFunctions64.combineU[data->op] :
|
||||
pixman_composeFunctions.combineU[data->op];
|
||||
if (!compose)
|
||||
return;
|
||||
|
||||
for (i = 0; i < data->height; ++i) {
|
||||
/* fill first half of scanline with source */
|
||||
if (fetchSrc)
|
||||
{
|
||||
if (fetchMask)
|
||||
{
|
||||
/* fetch mask before source so that fetching of
|
||||
source can be optimized */
|
||||
fetchMask (data->mask, data->xMask, data->yMask + i,
|
||||
data->width, mask_buffer, 0, 0);
|
||||
|
||||
if (maskClass == SOURCE_IMAGE_CLASS_HORIZONTAL)
|
||||
fetchMask = NULL;
|
||||
}
|
||||
|
||||
if (srcClass == SOURCE_IMAGE_CLASS_HORIZONTAL)
|
||||
{
|
||||
fetchSrc (data->src, data->xSrc, data->ySrc + i,
|
||||
data->width, src_buffer, 0, 0);
|
||||
|
||||
if (useMask)
|
||||
{
|
||||
if (wide)
|
||||
pixman_composeFunctions64.combineU[PIXMAN_OP_IN] (mask_buffer, src_buffer, data->width);
|
||||
else
|
||||
pixman_composeFunctions.combineU[PIXMAN_OP_IN] (mask_buffer, src_buffer, data->width);
|
||||
|
||||
src_mask_buffer = mask_buffer;
|
||||
}
|
||||
else
|
||||
src_mask_buffer = src_buffer;
|
||||
|
||||
fetchSrc = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
fetchSrc (data->src, data->xSrc, data->ySrc + i,
|
||||
data->width, src_buffer,
|
||||
useMask ? mask_buffer : NULL, 0xff000000);
|
||||
|
||||
if (useMask) {
|
||||
if (wide)
|
||||
pixman_composeFunctions64.combineMaskU (src_buffer,
|
||||
mask_buffer,
|
||||
data->width);
|
||||
else
|
||||
pixman_composeFunctions.combineMaskU (src_buffer,
|
||||
mask_buffer,
|
||||
data->width);
|
||||
}
|
||||
|
||||
src_mask_buffer = src_buffer;
|
||||
}
|
||||
}
|
||||
else if (fetchMask)
|
||||
{
|
||||
fetchMask (data->mask, data->xMask, data->yMask + i,
|
||||
data->width, mask_buffer, 0, 0);
|
||||
|
||||
if (wide)
|
||||
pixman_composeFunctions64.combineU[PIXMAN_OP_IN] (mask_buffer, src_buffer, data->width);
|
||||
else
|
||||
pixman_composeFunctions.combineU[PIXMAN_OP_IN] (mask_buffer, src_buffer, data->width);
|
||||
|
||||
src_mask_buffer = mask_buffer;
|
||||
}
|
||||
|
||||
if (store)
|
||||
{
|
||||
/* fill dest into second half of scanline */
|
||||
if (fetchDest)
|
||||
fetchDest (data->dest, data->xDest, data->yDest + i,
|
||||
data->width, dest_buffer, 0, 0);
|
||||
|
||||
/* blend */
|
||||
compose (dest_buffer, src_mask_buffer, data->width);
|
||||
|
||||
/* write back */
|
||||
store (data->dest, data->xDest, data->yDest + i, data->width,
|
||||
dest_buffer);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* blend */
|
||||
compose (bits + (data->yDest + i+ yoff) * stride +
|
||||
data->xDest + xoff,
|
||||
src_mask_buffer, data->width);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef PIXMAN_FB_ACCESSORS
|
||||
|
||||
#define SCANLINE_BUFFER_LENGTH 8192
|
||||
|
||||
void
|
||||
pixman_composite_rect_general (const FbComposeData *data)
|
||||
{
|
||||
uint8_t stack_scanline_buffer[SCANLINE_BUFFER_LENGTH * 3];
|
||||
const pixman_format_code_t srcFormat = data->src->type == BITS ? data->src->bits.format : 0;
|
||||
const pixman_format_code_t maskFormat = data->mask && data->mask->type == BITS ? data->mask->bits.format : 0;
|
||||
const pixman_format_code_t destFormat = data->dest->type == BITS ? data->dest->bits.format : 0;
|
||||
const int srcWide = PIXMAN_FORMAT_16BPC(srcFormat);
|
||||
const int maskWide = data->mask && PIXMAN_FORMAT_16BPC(maskFormat);
|
||||
const int destWide = PIXMAN_FORMAT_16BPC(destFormat);
|
||||
const int wide = srcWide || maskWide || destWide;
|
||||
const int Bpp = wide ? 8 : 4;
|
||||
uint8_t *scanline_buffer = stack_scanline_buffer;
|
||||
uint8_t *src_buffer, *mask_buffer, *dest_buffer;
|
||||
|
||||
if (data->width * Bpp > SCANLINE_BUFFER_LENGTH)
|
||||
{
|
||||
scanline_buffer = pixman_malloc_abc (data->width, 3, Bpp);
|
||||
|
||||
if (!scanline_buffer)
|
||||
return;
|
||||
}
|
||||
|
||||
src_buffer = scanline_buffer;
|
||||
mask_buffer = src_buffer + data->width * Bpp;
|
||||
dest_buffer = mask_buffer + data->width * Bpp;
|
||||
|
||||
if (data->src->common.read_func ||
|
||||
data->src->common.write_func ||
|
||||
(data->mask && data->mask->common.read_func) ||
|
||||
(data->mask && data->mask->common.write_func) ||
|
||||
data->dest->common.read_func ||
|
||||
data->dest->common.write_func)
|
||||
{
|
||||
pixman_composite_rect_general_accessors (data, src_buffer, mask_buffer,
|
||||
dest_buffer, wide);
|
||||
}
|
||||
else
|
||||
{
|
||||
pixman_composite_rect_general_no_accessors (data, src_buffer,
|
||||
mask_buffer, dest_buffer,
|
||||
wide);
|
||||
}
|
||||
|
||||
if (scanline_buffer != stack_scanline_buffer)
|
||||
free (scanline_buffer);
|
||||
}
|
||||
|
||||
#endif
|
||||
242
uppdev/plugin/pixman/lib/pixman-compute-region.c
Normal file
242
uppdev/plugin/pixman/lib/pixman-compute-region.c
Normal file
|
|
@ -0,0 +1,242 @@
|
|||
/*
|
||||
*
|
||||
* Copyright © 1999 Keith Packard
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and its
|
||||
* documentation for any purpose is hereby granted without fee, provided that
|
||||
* the above copyright notice appear in all copies and that both that
|
||||
* copyright notice and this permission notice appear in supporting
|
||||
* documentation, and that the name of Keith Packard not be used in
|
||||
* advertising or publicity pertaining to distribution of the software without
|
||||
* specific, written prior permission. Keith Packard makes no
|
||||
* representations about the suitability of this software for any purpose. It
|
||||
* is provided "as is" without express or implied warranty.
|
||||
*
|
||||
* KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
||||
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
|
||||
* EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
|
||||
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
||||
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
||||
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include "pixman-private.h"
|
||||
|
||||
#define BOUND(v) (int16_t) ((v) < INT16_MIN ? INT16_MIN : (v) > INT16_MAX ? INT16_MAX : (v))
|
||||
|
||||
static inline pixman_bool_t
|
||||
miClipPictureReg (pixman_region32_t * pRegion,
|
||||
pixman_region32_t * pClip,
|
||||
int dx,
|
||||
int dy)
|
||||
{
|
||||
if (pixman_region32_n_rects(pRegion) == 1 &&
|
||||
pixman_region32_n_rects(pClip) == 1)
|
||||
{
|
||||
pixman_box32_t * pRbox = pixman_region32_rectangles(pRegion, NULL);
|
||||
pixman_box32_t * pCbox = pixman_region32_rectangles(pClip, NULL);
|
||||
int v;
|
||||
|
||||
if (pRbox->x1 < (v = pCbox->x1 + dx))
|
||||
pRbox->x1 = BOUND(v);
|
||||
if (pRbox->x2 > (v = pCbox->x2 + dx))
|
||||
pRbox->x2 = BOUND(v);
|
||||
if (pRbox->y1 < (v = pCbox->y1 + dy))
|
||||
pRbox->y1 = BOUND(v);
|
||||
if (pRbox->y2 > (v = pCbox->y2 + dy))
|
||||
pRbox->y2 = BOUND(v);
|
||||
if (pRbox->x1 >= pRbox->x2 ||
|
||||
pRbox->y1 >= pRbox->y2)
|
||||
{
|
||||
pixman_region32_init (pRegion);
|
||||
}
|
||||
}
|
||||
else if (!pixman_region32_not_empty (pClip))
|
||||
return FALSE;
|
||||
else
|
||||
{
|
||||
if (dx || dy)
|
||||
pixman_region32_translate (pRegion, -dx, -dy);
|
||||
if (!pixman_region32_intersect (pRegion, pRegion, pClip))
|
||||
return FALSE;
|
||||
if (dx || dy)
|
||||
pixman_region32_translate(pRegion, dx, dy);
|
||||
}
|
||||
return pixman_region32_not_empty(pRegion);
|
||||
}
|
||||
|
||||
|
||||
static inline pixman_bool_t
|
||||
miClipPictureSrc (pixman_region32_t * pRegion,
|
||||
pixman_image_t * pPicture,
|
||||
int dx,
|
||||
int dy)
|
||||
{
|
||||
/* XXX what to do with clipping from transformed pictures? */
|
||||
if (pPicture->common.transform || pPicture->type != BITS)
|
||||
return TRUE;
|
||||
|
||||
if (pPicture->common.repeat)
|
||||
{
|
||||
/* If the clip region was set by a client, then it should be intersected
|
||||
* with the composite region since it's interpreted as happening
|
||||
* after the repeat algorithm.
|
||||
*
|
||||
* If the clip region was not set by a client, then it was imposed by
|
||||
* boundaries of the pixmap, or by sibling or child windows, which means
|
||||
* it should in theory be repeated along. FIXME: we ignore that case.
|
||||
* It is only relevant for windows that are (a) clipped by siblings/children
|
||||
* and (b) used as source. However this case is not useful anyway due
|
||||
* to lack of GraphicsExpose events.
|
||||
*/
|
||||
if (pPicture->common.has_client_clip)
|
||||
{
|
||||
pixman_region32_translate ( pRegion, dx, dy);
|
||||
|
||||
if (!pixman_region32_intersect (pRegion, pRegion,
|
||||
pPicture->common.src_clip))
|
||||
return FALSE;
|
||||
|
||||
pixman_region32_translate ( pRegion, -dx, -dy);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
return miClipPictureReg (pRegion,
|
||||
pPicture->common.src_clip,
|
||||
dx,
|
||||
dy);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* returns FALSE if the final region is empty. Indistinguishable from
|
||||
* an allocation failure, but rendering ignores those anyways.
|
||||
*/
|
||||
|
||||
pixman_bool_t
|
||||
pixman_compute_composite_region32 (pixman_region32_t * pRegion,
|
||||
pixman_image_t * pSrc,
|
||||
pixman_image_t * pMask,
|
||||
pixman_image_t * pDst,
|
||||
int16_t xSrc,
|
||||
int16_t ySrc,
|
||||
int16_t xMask,
|
||||
int16_t yMask,
|
||||
int16_t xDst,
|
||||
int16_t yDst,
|
||||
uint16_t width,
|
||||
uint16_t height)
|
||||
{
|
||||
int v;
|
||||
|
||||
pRegion->extents.x1 = xDst;
|
||||
v = xDst + width;
|
||||
pRegion->extents.x2 = BOUND(v);
|
||||
pRegion->extents.y1 = yDst;
|
||||
v = yDst + height;
|
||||
pRegion->extents.y2 = BOUND(v);
|
||||
pRegion->data = 0;
|
||||
/* Check for empty operation */
|
||||
if (pRegion->extents.x1 >= pRegion->extents.x2 ||
|
||||
pRegion->extents.y1 >= pRegion->extents.y2)
|
||||
{
|
||||
pixman_region32_init (pRegion);
|
||||
return FALSE;
|
||||
}
|
||||
/* clip against dst */
|
||||
if (!miClipPictureReg (pRegion, &pDst->common.clip_region, 0, 0))
|
||||
{
|
||||
pixman_region32_fini (pRegion);
|
||||
return FALSE;
|
||||
}
|
||||
if (pDst->common.alpha_map)
|
||||
{
|
||||
if (!miClipPictureReg (pRegion, &pDst->common.alpha_map->common.clip_region,
|
||||
-pDst->common.alpha_origin.x,
|
||||
-pDst->common.alpha_origin.y))
|
||||
{
|
||||
pixman_region32_fini (pRegion);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
/* clip against src */
|
||||
if (!miClipPictureSrc (pRegion, pSrc, xDst - xSrc, yDst - ySrc))
|
||||
{
|
||||
pixman_region32_fini (pRegion);
|
||||
return FALSE;
|
||||
}
|
||||
if (pSrc->common.alpha_map)
|
||||
{
|
||||
if (!miClipPictureSrc (pRegion, (pixman_image_t *)pSrc->common.alpha_map,
|
||||
xDst - (xSrc + pSrc->common.alpha_origin.x),
|
||||
yDst - (ySrc + pSrc->common.alpha_origin.y)))
|
||||
{
|
||||
pixman_region32_fini (pRegion);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
/* clip against mask */
|
||||
if (pMask)
|
||||
{
|
||||
if (!miClipPictureSrc (pRegion, pMask, xDst - xMask, yDst - yMask))
|
||||
{
|
||||
pixman_region32_fini (pRegion);
|
||||
return FALSE;
|
||||
}
|
||||
if (pMask->common.alpha_map)
|
||||
{
|
||||
if (!miClipPictureSrc (pRegion, (pixman_image_t *)pMask->common.alpha_map,
|
||||
xDst - (xMask + pMask->common.alpha_origin.x),
|
||||
yDst - (yMask + pMask->common.alpha_origin.y)))
|
||||
{
|
||||
pixman_region32_fini (pRegion);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
PIXMAN_EXPORT pixman_bool_t
|
||||
pixman_compute_composite_region (pixman_region16_t * pRegion,
|
||||
pixman_image_t * pSrc,
|
||||
pixman_image_t * pMask,
|
||||
pixman_image_t * pDst,
|
||||
int16_t xSrc,
|
||||
int16_t ySrc,
|
||||
int16_t xMask,
|
||||
int16_t yMask,
|
||||
int16_t xDst,
|
||||
int16_t yDst,
|
||||
uint16_t width,
|
||||
uint16_t height)
|
||||
{
|
||||
pixman_region32_t r32;
|
||||
pixman_bool_t retval;
|
||||
|
||||
pixman_region32_init (&r32);
|
||||
|
||||
retval = pixman_compute_composite_region32 (&r32, pSrc, pMask, pDst,
|
||||
xSrc, ySrc, xMask, yMask, xDst, yDst,
|
||||
width, height);
|
||||
|
||||
if (retval)
|
||||
{
|
||||
if (!pixman_region16_copy_from_region32 (pRegion, &r32))
|
||||
retval = FALSE;
|
||||
}
|
||||
|
||||
pixman_region32_fini (&r32);
|
||||
return retval;
|
||||
}
|
||||
4
uppdev/plugin/pixman/lib/pixman-edge-accessors.c
Normal file
4
uppdev/plugin/pixman/lib/pixman-edge-accessors.c
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
|
||||
#define PIXMAN_FB_ACCESSORS
|
||||
|
||||
#include "pixman-edge.c"
|
||||
154
uppdev/plugin/pixman/lib/pixman-edge-imp.h
Normal file
154
uppdev/plugin/pixman/lib/pixman-edge-imp.h
Normal file
|
|
@ -0,0 +1,154 @@
|
|||
/*
|
||||
* Copyright © 2004 Keith Packard
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and its
|
||||
* documentation for any purpose is hereby granted without fee, provided that
|
||||
* the above copyright notice appear in all copies and that both that
|
||||
* copyright notice and this permission notice appear in supporting
|
||||
* documentation, and that the name of Keith Packard not be used in
|
||||
* advertising or publicity pertaining to distribution of the software without
|
||||
* specific, written prior permission. Keith Packard makes no
|
||||
* representations about the suitability of this software for any purpose. It
|
||||
* is provided "as is" without express or implied warranty.
|
||||
*
|
||||
* KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
||||
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
|
||||
* EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
|
||||
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
||||
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
||||
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef rasterizeSpan
|
||||
#endif
|
||||
|
||||
static void
|
||||
rasterizeEdges (pixman_image_t *image,
|
||||
pixman_edge_t *l,
|
||||
pixman_edge_t *r,
|
||||
pixman_fixed_t t,
|
||||
pixman_fixed_t b)
|
||||
{
|
||||
pixman_fixed_t y = t;
|
||||
uint32_t *line;
|
||||
uint32_t *buf = (image)->bits.bits;
|
||||
int stride = (image)->bits.rowstride;
|
||||
int width = (image)->bits.width;
|
||||
|
||||
line = buf + pixman_fixed_to_int (y) * stride;
|
||||
|
||||
for (;;)
|
||||
{
|
||||
pixman_fixed_t lx;
|
||||
pixman_fixed_t rx;
|
||||
int lxi;
|
||||
int rxi;
|
||||
|
||||
lx = l->x;
|
||||
rx = r->x;
|
||||
#if N_BITS == 1
|
||||
/* For the non-antialiased case, round the coordinates up, in effect
|
||||
* sampling the center of the pixel. (The AA case does a similar
|
||||
* adjustment in RenderSamplesX) */
|
||||
lx += X_FRAC_FIRST(1);
|
||||
rx += X_FRAC_FIRST(1);
|
||||
#endif
|
||||
/* clip X */
|
||||
if (lx < 0)
|
||||
lx = 0;
|
||||
if (pixman_fixed_to_int (rx) >= width)
|
||||
#if N_BITS == 1
|
||||
rx = pixman_int_to_fixed (width);
|
||||
#else
|
||||
/* Use the last pixel of the scanline, covered 100%.
|
||||
* We can't use the first pixel following the scanline,
|
||||
* because accessing it could result in a buffer overrun.
|
||||
*/
|
||||
rx = pixman_int_to_fixed (width) - 1;
|
||||
#endif
|
||||
|
||||
/* Skip empty (or backwards) sections */
|
||||
if (rx > lx)
|
||||
{
|
||||
|
||||
/* Find pixel bounds for span */
|
||||
lxi = pixman_fixed_to_int (lx);
|
||||
rxi = pixman_fixed_to_int (rx);
|
||||
|
||||
#if N_BITS == 1
|
||||
{
|
||||
uint32_t *a = line;
|
||||
uint32_t startmask;
|
||||
uint32_t endmask;
|
||||
int nmiddle;
|
||||
int width = rxi - lxi;
|
||||
int x = lxi;
|
||||
|
||||
a += x >> FB_SHIFT;
|
||||
x &= FB_MASK;
|
||||
|
||||
FbMaskBits (x, width, startmask, nmiddle, endmask);
|
||||
if (startmask) {
|
||||
WRITE(image, a, READ(image, a) | startmask);
|
||||
a++;
|
||||
}
|
||||
while (nmiddle--)
|
||||
WRITE(image, a++, FB_ALLONES);
|
||||
if (endmask)
|
||||
WRITE(image, a, READ(image, a) | endmask);
|
||||
}
|
||||
#else
|
||||
{
|
||||
DefineAlpha(line,lxi);
|
||||
int lxs;
|
||||
int rxs;
|
||||
|
||||
/* Sample coverage for edge pixels */
|
||||
lxs = RenderSamplesX (lx, N_BITS);
|
||||
rxs = RenderSamplesX (rx, N_BITS);
|
||||
|
||||
/* Add coverage across row */
|
||||
if (lxi == rxi)
|
||||
{
|
||||
AddAlpha (rxs - lxs);
|
||||
}
|
||||
else
|
||||
{
|
||||
int xi;
|
||||
|
||||
AddAlpha (N_X_FRAC(N_BITS) - lxs);
|
||||
StepAlpha;
|
||||
for (xi = lxi + 1; xi < rxi; xi++)
|
||||
{
|
||||
AddAlpha (N_X_FRAC(N_BITS));
|
||||
StepAlpha;
|
||||
}
|
||||
AddAlpha (rxs);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
if (y == b)
|
||||
break;
|
||||
|
||||
#if N_BITS > 1
|
||||
if (pixman_fixed_frac (y) != Y_FRAC_LAST(N_BITS))
|
||||
{
|
||||
RenderEdgeStepSmall (l);
|
||||
RenderEdgeStepSmall (r);
|
||||
y += STEP_Y_SMALL(N_BITS);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
RenderEdgeStepBig (l);
|
||||
RenderEdgeStepBig (r);
|
||||
y += STEP_Y_BIG(N_BITS);
|
||||
line += stride;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#undef rasterizeSpan
|
||||
331
uppdev/plugin/pixman/lib/pixman-edge.c
Normal file
331
uppdev/plugin/pixman/lib/pixman-edge.c
Normal file
|
|
@ -0,0 +1,331 @@
|
|||
/*
|
||||
* Copyright © 2004 Keith Packard
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and its
|
||||
* documentation for any purpose is hereby granted without fee, provided that
|
||||
* the above copyright notice appear in all copies and that both that
|
||||
* copyright notice and this permission notice appear in supporting
|
||||
* documentation, and that the name of Keith Packard not be used in
|
||||
* advertising or publicity pertaining to distribution of the software without
|
||||
* specific, written prior permission. Keith Packard makes no
|
||||
* representations about the suitability of this software for any purpose. It
|
||||
* is provided "as is" without express or implied warranty.
|
||||
*
|
||||
* KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
||||
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
|
||||
* EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
|
||||
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
||||
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
||||
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "pixman-private.h"
|
||||
|
||||
#ifdef PIXMAN_FB_ACCESSORS
|
||||
#define PIXMAN_RASTERIZE_EDGES pixman_rasterize_edges_accessors
|
||||
#else
|
||||
#define PIXMAN_RASTERIZE_EDGES pixman_rasterize_edges_no_accessors
|
||||
#endif
|
||||
|
||||
/*
|
||||
* 4 bit alpha
|
||||
*/
|
||||
|
||||
#define N_BITS 4
|
||||
#define rasterizeEdges fbRasterizeEdges4
|
||||
|
||||
#if BITMAP_BIT_ORDER == LSBFirst
|
||||
#define Shift4(o) ((o) << 2)
|
||||
#else
|
||||
#define Shift4(o) ((1-(o)) << 2)
|
||||
#endif
|
||||
|
||||
#define Get4(x,o) (((x) >> Shift4(o)) & 0xf)
|
||||
#define Put4(x,o,v) (((x) & ~(0xf << Shift4(o))) | (((v) & 0xf) << Shift4(o)))
|
||||
|
||||
#define DefineAlpha(line,x) \
|
||||
uint8_t *__ap = (uint8_t *) line + ((x) >> 1); \
|
||||
int __ao = (x) & 1
|
||||
|
||||
#define StepAlpha ((__ap += __ao), (__ao ^= 1))
|
||||
|
||||
#define AddAlpha(a) { \
|
||||
uint8_t __o = READ(image, __ap); \
|
||||
uint8_t __a = (a) + Get4(__o, __ao); \
|
||||
WRITE(image, __ap, Put4 (__o, __ao, __a | (0 - ((__a) >> 4)))); \
|
||||
}
|
||||
|
||||
#include "pixman-edge-imp.h"
|
||||
|
||||
#undef AddAlpha
|
||||
#undef StepAlpha
|
||||
#undef DefineAlpha
|
||||
#undef rasterizeEdges
|
||||
#undef N_BITS
|
||||
|
||||
|
||||
/*
|
||||
* 1 bit alpha
|
||||
*/
|
||||
|
||||
#define N_BITS 1
|
||||
#define rasterizeEdges fbRasterizeEdges1
|
||||
|
||||
#include "pixman-edge-imp.h"
|
||||
|
||||
#undef rasterizeEdges
|
||||
#undef N_BITS
|
||||
|
||||
/*
|
||||
* 8 bit alpha
|
||||
*/
|
||||
|
||||
static inline uint8_t
|
||||
clip255 (int x)
|
||||
{
|
||||
if (x > 255) return 255;
|
||||
return x;
|
||||
}
|
||||
|
||||
#define add_saturate_8(buf,val,length) \
|
||||
do { \
|
||||
int i__ = (length); \
|
||||
uint8_t *buf__ = (buf); \
|
||||
int val__ = (val); \
|
||||
\
|
||||
while (i__--) \
|
||||
{ \
|
||||
WRITE(image, (buf__), clip255 (READ(image, (buf__)) + (val__))); \
|
||||
(buf__)++; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
/*
|
||||
* We want to detect the case where we add the same value to a long
|
||||
* span of pixels. The triangles on the end are filled in while we
|
||||
* count how many sub-pixel scanlines contribute to the middle section.
|
||||
*
|
||||
* +--------------------------+
|
||||
* fill_height =| \ /
|
||||
* +------------------+
|
||||
* |================|
|
||||
* fill_start fill_end
|
||||
*/
|
||||
static void
|
||||
fbRasterizeEdges8 (pixman_image_t *image,
|
||||
pixman_edge_t *l,
|
||||
pixman_edge_t *r,
|
||||
pixman_fixed_t t,
|
||||
pixman_fixed_t b)
|
||||
{
|
||||
pixman_fixed_t y = t;
|
||||
uint32_t *line;
|
||||
int fill_start = -1, fill_end = -1;
|
||||
int fill_size = 0;
|
||||
uint32_t *buf = (image)->bits.bits;
|
||||
int stride = (image)->bits.rowstride;
|
||||
int width = (image)->bits.width;
|
||||
|
||||
line = buf + pixman_fixed_to_int (y) * stride;
|
||||
|
||||
for (;;)
|
||||
{
|
||||
uint8_t *ap = (uint8_t *) line;
|
||||
pixman_fixed_t lx, rx;
|
||||
int lxi, rxi;
|
||||
|
||||
/* clip X */
|
||||
lx = l->x;
|
||||
if (lx < 0)
|
||||
lx = 0;
|
||||
rx = r->x;
|
||||
if (pixman_fixed_to_int (rx) >= width)
|
||||
/* Use the last pixel of the scanline, covered 100%.
|
||||
* We can't use the first pixel following the scanline,
|
||||
* because accessing it could result in a buffer overrun.
|
||||
*/
|
||||
rx = pixman_int_to_fixed (width) - 1;
|
||||
|
||||
/* Skip empty (or backwards) sections */
|
||||
if (rx > lx)
|
||||
{
|
||||
int lxs, rxs;
|
||||
|
||||
/* Find pixel bounds for span. */
|
||||
lxi = pixman_fixed_to_int (lx);
|
||||
rxi = pixman_fixed_to_int (rx);
|
||||
|
||||
/* Sample coverage for edge pixels */
|
||||
lxs = RenderSamplesX (lx, 8);
|
||||
rxs = RenderSamplesX (rx, 8);
|
||||
|
||||
/* Add coverage across row */
|
||||
if (lxi == rxi)
|
||||
{
|
||||
WRITE(image, ap +lxi, clip255 (READ(image, ap + lxi) + rxs - lxs));
|
||||
}
|
||||
else
|
||||
{
|
||||
WRITE(image, ap + lxi, clip255 (READ(image, ap + lxi) + N_X_FRAC(8) - lxs));
|
||||
|
||||
/* Move forward so that lxi/rxi is the pixel span */
|
||||
lxi++;
|
||||
|
||||
/* Don't bother trying to optimize the fill unless
|
||||
* the span is longer than 4 pixels. */
|
||||
if (rxi - lxi > 4)
|
||||
{
|
||||
if (fill_start < 0)
|
||||
{
|
||||
fill_start = lxi;
|
||||
fill_end = rxi;
|
||||
fill_size++;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (lxi >= fill_end || rxi < fill_start)
|
||||
{
|
||||
/* We're beyond what we saved, just fill it */
|
||||
add_saturate_8 (ap + fill_start,
|
||||
fill_size * N_X_FRAC(8),
|
||||
fill_end - fill_start);
|
||||
fill_start = lxi;
|
||||
fill_end = rxi;
|
||||
fill_size = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Update fill_start */
|
||||
if (lxi > fill_start)
|
||||
{
|
||||
add_saturate_8 (ap + fill_start,
|
||||
fill_size * N_X_FRAC(8),
|
||||
lxi - fill_start);
|
||||
fill_start = lxi;
|
||||
}
|
||||
else if (lxi < fill_start)
|
||||
{
|
||||
add_saturate_8 (ap + lxi, N_X_FRAC(8),
|
||||
fill_start - lxi);
|
||||
}
|
||||
|
||||
/* Update fill_end */
|
||||
if (rxi < fill_end)
|
||||
{
|
||||
add_saturate_8 (ap + rxi,
|
||||
fill_size * N_X_FRAC(8),
|
||||
fill_end - rxi);
|
||||
fill_end = rxi;
|
||||
}
|
||||
else if (fill_end < rxi)
|
||||
{
|
||||
add_saturate_8 (ap + fill_end,
|
||||
N_X_FRAC(8),
|
||||
rxi - fill_end);
|
||||
}
|
||||
fill_size++;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
add_saturate_8 (ap + lxi, N_X_FRAC(8), rxi - lxi);
|
||||
}
|
||||
|
||||
WRITE(image, ap + rxi, clip255 (READ(image, ap + rxi) + rxs));
|
||||
}
|
||||
}
|
||||
|
||||
if (y == b) {
|
||||
/* We're done, make sure we clean up any remaining fill. */
|
||||
if (fill_start != fill_end) {
|
||||
if (fill_size == N_Y_FRAC(8))
|
||||
{
|
||||
MEMSET_WRAPPED (image, ap + fill_start, 0xff, fill_end - fill_start);
|
||||
}
|
||||
else
|
||||
{
|
||||
add_saturate_8 (ap + fill_start, fill_size * N_X_FRAC(8),
|
||||
fill_end - fill_start);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (pixman_fixed_frac (y) != Y_FRAC_LAST(8))
|
||||
{
|
||||
RenderEdgeStepSmall (l);
|
||||
RenderEdgeStepSmall (r);
|
||||
y += STEP_Y_SMALL(8);
|
||||
}
|
||||
else
|
||||
{
|
||||
RenderEdgeStepBig (l);
|
||||
RenderEdgeStepBig (r);
|
||||
y += STEP_Y_BIG(8);
|
||||
if (fill_start != fill_end)
|
||||
{
|
||||
if (fill_size == N_Y_FRAC(8))
|
||||
{
|
||||
MEMSET_WRAPPED (image, ap + fill_start, 0xff, fill_end - fill_start);
|
||||
}
|
||||
else
|
||||
{
|
||||
add_saturate_8 (ap + fill_start, fill_size * N_X_FRAC(8),
|
||||
fill_end - fill_start);
|
||||
}
|
||||
fill_start = fill_end = -1;
|
||||
fill_size = 0;
|
||||
}
|
||||
line += stride;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef PIXMAN_FB_ACCESSORS
|
||||
static
|
||||
#endif
|
||||
void
|
||||
PIXMAN_RASTERIZE_EDGES (pixman_image_t *image,
|
||||
pixman_edge_t *l,
|
||||
pixman_edge_t *r,
|
||||
pixman_fixed_t t,
|
||||
pixman_fixed_t b)
|
||||
{
|
||||
switch (PIXMAN_FORMAT_BPP (image->bits.format))
|
||||
{
|
||||
case 1:
|
||||
fbRasterizeEdges1 (image, l, r, t, b);
|
||||
break;
|
||||
case 4:
|
||||
fbRasterizeEdges4 (image, l, r, t, b);
|
||||
break;
|
||||
case 8:
|
||||
fbRasterizeEdges8 (image, l, r, t, b);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef PIXMAN_FB_ACCESSORS
|
||||
|
||||
PIXMAN_EXPORT void
|
||||
pixman_rasterize_edges (pixman_image_t *image,
|
||||
pixman_edge_t *l,
|
||||
pixman_edge_t *r,
|
||||
pixman_fixed_t t,
|
||||
pixman_fixed_t b)
|
||||
{
|
||||
if (image->common.read_func || image->common.write_func)
|
||||
pixman_rasterize_edges_accessors (image, l, r, t, b);
|
||||
else
|
||||
pixman_rasterize_edges_no_accessors (image, l, r, t, b);
|
||||
}
|
||||
|
||||
#endif
|
||||
828
uppdev/plugin/pixman/lib/pixman-image.c
Normal file
828
uppdev/plugin/pixman/lib/pixman-image.c
Normal file
|
|
@ -0,0 +1,828 @@
|
|||
/*
|
||||
* Copyright © 2000 SuSE, Inc.
|
||||
* Copyright © 2007 Red Hat, Inc.
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and its
|
||||
* documentation for any purpose is hereby granted without fee, provided that
|
||||
* the above copyright notice appear in all copies and that both that
|
||||
* copyright notice and this permission notice appear in supporting
|
||||
* documentation, and that the name of SuSE not be used in advertising or
|
||||
* publicity pertaining to distribution of the software without specific,
|
||||
* written prior permission. SuSE makes no representations about the
|
||||
* suitability of this software for any purpose. It is provided "as is"
|
||||
* without express or implied warranty.
|
||||
*
|
||||
* SuSE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL SuSE
|
||||
* BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
|
||||
* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
|
||||
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "pixman-private.h"
|
||||
|
||||
#define Alpha(x) ((x) >> 24)
|
||||
|
||||
static void
|
||||
init_source_image (source_image_t *image)
|
||||
{
|
||||
image->class = SOURCE_IMAGE_CLASS_UNKNOWN;
|
||||
}
|
||||
|
||||
static pixman_bool_t
|
||||
init_gradient (gradient_t *gradient,
|
||||
const pixman_gradient_stop_t *stops,
|
||||
int n_stops)
|
||||
{
|
||||
return_val_if_fail (n_stops > 0, FALSE);
|
||||
|
||||
init_source_image (&gradient->common);
|
||||
|
||||
gradient->stops = pixman_malloc_ab (n_stops, sizeof (pixman_gradient_stop_t));
|
||||
if (!gradient->stops)
|
||||
return FALSE;
|
||||
|
||||
memcpy (gradient->stops, stops, n_stops * sizeof (pixman_gradient_stop_t));
|
||||
|
||||
gradient->n_stops = n_stops;
|
||||
|
||||
gradient->stop_range = 0xffff;
|
||||
gradient->color_table = NULL;
|
||||
gradient->color_table_size = 0;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static uint32_t
|
||||
color_to_uint32 (const pixman_color_t *color)
|
||||
{
|
||||
return
|
||||
(color->alpha >> 8 << 24) |
|
||||
(color->red >> 8 << 16) |
|
||||
(color->green & 0xff00) |
|
||||
(color->blue >> 8);
|
||||
}
|
||||
|
||||
static pixman_image_t *
|
||||
allocate_image (void)
|
||||
{
|
||||
pixman_image_t *image = malloc (sizeof (pixman_image_t));
|
||||
|
||||
if (image)
|
||||
{
|
||||
image_common_t *common = &image->common;
|
||||
|
||||
pixman_region32_init (&common->full_region);
|
||||
pixman_region32_init (&common->clip_region);
|
||||
common->src_clip = &common->full_region;
|
||||
common->has_client_clip = FALSE;
|
||||
common->transform = NULL;
|
||||
common->repeat = PIXMAN_REPEAT_NONE;
|
||||
common->filter = PIXMAN_FILTER_NEAREST;
|
||||
common->filter_params = NULL;
|
||||
common->n_filter_params = 0;
|
||||
common->alpha_map = NULL;
|
||||
common->component_alpha = FALSE;
|
||||
common->ref_count = 1;
|
||||
common->read_func = NULL;
|
||||
common->write_func = NULL;
|
||||
}
|
||||
|
||||
return image;
|
||||
}
|
||||
|
||||
/* Ref Counting */
|
||||
PIXMAN_EXPORT pixman_image_t *
|
||||
pixman_image_ref (pixman_image_t *image)
|
||||
{
|
||||
image->common.ref_count++;
|
||||
|
||||
return image;
|
||||
}
|
||||
|
||||
/* returns TRUE when the image is freed */
|
||||
PIXMAN_EXPORT pixman_bool_t
|
||||
pixman_image_unref (pixman_image_t *image)
|
||||
{
|
||||
image_common_t *common = (image_common_t *)image;
|
||||
|
||||
common->ref_count--;
|
||||
|
||||
if (common->ref_count == 0)
|
||||
{
|
||||
pixman_region32_fini (&common->clip_region);
|
||||
pixman_region32_fini (&common->full_region);
|
||||
|
||||
if (common->transform)
|
||||
free (common->transform);
|
||||
|
||||
if (common->filter_params)
|
||||
free (common->filter_params);
|
||||
|
||||
if (common->alpha_map)
|
||||
pixman_image_unref ((pixman_image_t *)common->alpha_map);
|
||||
|
||||
#if 0
|
||||
if (image->type == BITS && image->bits.indexed)
|
||||
free (image->bits.indexed);
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
memset (image, 0xaa, sizeof (pixman_image_t));
|
||||
#endif
|
||||
if (image->type == LINEAR || image->type == RADIAL || image->type == CONICAL)
|
||||
{
|
||||
if (image->gradient.stops)
|
||||
free (image->gradient.stops);
|
||||
}
|
||||
|
||||
|
||||
if (image->type == BITS && image->bits.free_me)
|
||||
free (image->bits.free_me);
|
||||
|
||||
free (image);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* Constructors */
|
||||
PIXMAN_EXPORT pixman_image_t *
|
||||
pixman_image_create_solid_fill (pixman_color_t *color)
|
||||
{
|
||||
pixman_image_t *img = allocate_image();
|
||||
if (!img)
|
||||
return NULL;
|
||||
|
||||
init_source_image (&img->solid.common);
|
||||
|
||||
img->type = SOLID;
|
||||
img->solid.color = color_to_uint32 (color);
|
||||
|
||||
return img;
|
||||
}
|
||||
|
||||
PIXMAN_EXPORT pixman_image_t *
|
||||
pixman_image_create_linear_gradient (pixman_point_fixed_t *p1,
|
||||
pixman_point_fixed_t *p2,
|
||||
const pixman_gradient_stop_t *stops,
|
||||
int n_stops)
|
||||
{
|
||||
pixman_image_t *image;
|
||||
linear_gradient_t *linear;
|
||||
|
||||
return_val_if_fail (n_stops >= 2, NULL);
|
||||
|
||||
image = allocate_image();
|
||||
|
||||
if (!image)
|
||||
return NULL;
|
||||
|
||||
linear = &image->linear;
|
||||
|
||||
if (!init_gradient (&linear->common, stops, n_stops))
|
||||
{
|
||||
free (image);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
linear->p1 = *p1;
|
||||
linear->p2 = *p2;
|
||||
|
||||
image->type = LINEAR;
|
||||
|
||||
return image;
|
||||
}
|
||||
|
||||
|
||||
PIXMAN_EXPORT pixman_image_t *
|
||||
pixman_image_create_radial_gradient (pixman_point_fixed_t *inner,
|
||||
pixman_point_fixed_t *outer,
|
||||
pixman_fixed_t inner_radius,
|
||||
pixman_fixed_t outer_radius,
|
||||
const pixman_gradient_stop_t *stops,
|
||||
int n_stops)
|
||||
{
|
||||
pixman_image_t *image;
|
||||
radial_gradient_t *radial;
|
||||
|
||||
return_val_if_fail (n_stops >= 2, NULL);
|
||||
|
||||
image = allocate_image();
|
||||
|
||||
if (!image)
|
||||
return NULL;
|
||||
|
||||
radial = &image->radial;
|
||||
|
||||
if (!init_gradient (&radial->common, stops, n_stops))
|
||||
{
|
||||
free (image);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
image->type = RADIAL;
|
||||
|
||||
radial->c1.x = inner->x;
|
||||
radial->c1.y = inner->y;
|
||||
radial->c1.radius = inner_radius;
|
||||
radial->c2.x = outer->x;
|
||||
radial->c2.y = outer->y;
|
||||
radial->c2.radius = outer_radius;
|
||||
radial->cdx = pixman_fixed_to_double (radial->c2.x - radial->c1.x);
|
||||
radial->cdy = pixman_fixed_to_double (radial->c2.y - radial->c1.y);
|
||||
radial->dr = pixman_fixed_to_double (radial->c2.radius - radial->c1.radius);
|
||||
radial->A = (radial->cdx * radial->cdx
|
||||
+ radial->cdy * radial->cdy
|
||||
- radial->dr * radial->dr);
|
||||
|
||||
return image;
|
||||
}
|
||||
|
||||
PIXMAN_EXPORT pixman_image_t *
|
||||
pixman_image_create_conical_gradient (pixman_point_fixed_t *center,
|
||||
pixman_fixed_t angle,
|
||||
const pixman_gradient_stop_t *stops,
|
||||
int n_stops)
|
||||
{
|
||||
pixman_image_t *image = allocate_image();
|
||||
conical_gradient_t *conical;
|
||||
|
||||
if (!image)
|
||||
return NULL;
|
||||
|
||||
conical = &image->conical;
|
||||
|
||||
if (!init_gradient (&conical->common, stops, n_stops))
|
||||
{
|
||||
free (image);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
image->type = CONICAL;
|
||||
conical->center = *center;
|
||||
conical->angle = angle;
|
||||
|
||||
return image;
|
||||
}
|
||||
|
||||
static uint32_t *
|
||||
create_bits (pixman_format_code_t format,
|
||||
int width,
|
||||
int height,
|
||||
int *rowstride_bytes)
|
||||
{
|
||||
int stride;
|
||||
int buf_size;
|
||||
int bpp;
|
||||
|
||||
/* what follows is a long-winded way, avoiding any possibility of integer
|
||||
* overflows, of saying:
|
||||
* stride = ((width * bpp + FB_MASK) >> FB_SHIFT) * sizeof (uint32_t);
|
||||
*/
|
||||
|
||||
bpp = PIXMAN_FORMAT_BPP (format);
|
||||
if (pixman_multiply_overflows_int (width, bpp))
|
||||
return NULL;
|
||||
|
||||
stride = width * bpp;
|
||||
if (pixman_addition_overflows_int (stride, FB_MASK))
|
||||
return NULL;
|
||||
|
||||
stride += FB_MASK;
|
||||
stride >>= FB_SHIFT;
|
||||
|
||||
#if FB_SHIFT < 2
|
||||
if (pixman_multiply_overflows_int (stride, sizeof (uint32_t)))
|
||||
return NULL;
|
||||
#endif
|
||||
stride *= sizeof (uint32_t);
|
||||
|
||||
if (pixman_multiply_overflows_int (height, stride))
|
||||
return NULL;
|
||||
|
||||
buf_size = height * stride;
|
||||
|
||||
if (rowstride_bytes)
|
||||
*rowstride_bytes = stride;
|
||||
|
||||
return calloc (buf_size, 1);
|
||||
}
|
||||
|
||||
static void
|
||||
reset_clip_region (pixman_image_t *image)
|
||||
{
|
||||
pixman_region32_fini (&image->common.clip_region);
|
||||
|
||||
if (image->type == BITS)
|
||||
{
|
||||
pixman_region32_init_rect (&image->common.clip_region, 0, 0,
|
||||
image->bits.width, image->bits.height);
|
||||
}
|
||||
else
|
||||
{
|
||||
pixman_region32_init (&image->common.clip_region);
|
||||
}
|
||||
}
|
||||
|
||||
PIXMAN_EXPORT pixman_image_t *
|
||||
pixman_image_create_bits (pixman_format_code_t format,
|
||||
int width,
|
||||
int height,
|
||||
uint32_t *bits,
|
||||
int rowstride_bytes)
|
||||
{
|
||||
pixman_image_t *image;
|
||||
uint32_t *free_me = NULL;
|
||||
|
||||
/* must be a whole number of uint32_t's
|
||||
*/
|
||||
return_val_if_fail (bits == NULL ||
|
||||
(rowstride_bytes % sizeof (uint32_t)) == 0, NULL);
|
||||
|
||||
if (!bits && width && height)
|
||||
{
|
||||
free_me = bits = create_bits (format, width, height, &rowstride_bytes);
|
||||
if (!bits)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
image = allocate_image();
|
||||
|
||||
if (!image) {
|
||||
if (free_me)
|
||||
free (free_me);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
image->type = BITS;
|
||||
image->bits.format = format;
|
||||
image->bits.width = width;
|
||||
image->bits.height = height;
|
||||
image->bits.bits = bits;
|
||||
image->bits.free_me = free_me;
|
||||
|
||||
image->bits.rowstride = rowstride_bytes / (int) sizeof (uint32_t); /* we store it in number
|
||||
* of uint32_t's
|
||||
*/
|
||||
image->bits.indexed = NULL;
|
||||
|
||||
pixman_region32_fini (&image->common.full_region);
|
||||
pixman_region32_init_rect (&image->common.full_region, 0, 0,
|
||||
image->bits.width, image->bits.height);
|
||||
|
||||
reset_clip_region (image);
|
||||
return image;
|
||||
}
|
||||
|
||||
PIXMAN_EXPORT pixman_bool_t
|
||||
pixman_image_set_clip_region32 (pixman_image_t *image,
|
||||
pixman_region32_t *region)
|
||||
{
|
||||
image_common_t *common = (image_common_t *)image;
|
||||
|
||||
if (region)
|
||||
{
|
||||
return pixman_region32_copy (&common->clip_region, region);
|
||||
}
|
||||
else
|
||||
{
|
||||
reset_clip_region (image);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
PIXMAN_EXPORT pixman_bool_t
|
||||
pixman_image_set_clip_region (pixman_image_t *image,
|
||||
pixman_region16_t *region)
|
||||
{
|
||||
image_common_t *common = (image_common_t *)image;
|
||||
|
||||
if (region)
|
||||
{
|
||||
return pixman_region32_copy_from_region16 (&common->clip_region, region);
|
||||
}
|
||||
else
|
||||
{
|
||||
reset_clip_region (image);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
/* Sets whether the clip region includes a clip region set by the client
|
||||
*/
|
||||
PIXMAN_EXPORT void
|
||||
pixman_image_set_has_client_clip (pixman_image_t *image,
|
||||
pixman_bool_t client_clip)
|
||||
{
|
||||
image->common.has_client_clip = client_clip;
|
||||
}
|
||||
|
||||
PIXMAN_EXPORT pixman_bool_t
|
||||
pixman_image_set_transform (pixman_image_t *image,
|
||||
const pixman_transform_t *transform)
|
||||
{
|
||||
static const pixman_transform_t id =
|
||||
{
|
||||
{ { pixman_fixed_1, 0, 0 },
|
||||
{ 0, pixman_fixed_1, 0 },
|
||||
{ 0, 0, pixman_fixed_1 }
|
||||
}
|
||||
};
|
||||
|
||||
image_common_t *common = (image_common_t *)image;
|
||||
|
||||
if (common->transform == transform)
|
||||
return TRUE;
|
||||
|
||||
if (memcmp (&id, transform, sizeof (pixman_transform_t)) == 0)
|
||||
{
|
||||
free(common->transform);
|
||||
common->transform = NULL;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if (common->transform == NULL)
|
||||
common->transform = malloc (sizeof (pixman_transform_t));
|
||||
if (common->transform == NULL)
|
||||
return FALSE;
|
||||
|
||||
memcpy(common->transform, transform, sizeof(pixman_transform_t));
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
PIXMAN_EXPORT void
|
||||
pixman_image_set_repeat (pixman_image_t *image,
|
||||
pixman_repeat_t repeat)
|
||||
{
|
||||
image->common.repeat = repeat;
|
||||
}
|
||||
|
||||
PIXMAN_EXPORT pixman_bool_t
|
||||
pixman_image_set_filter (pixman_image_t *image,
|
||||
pixman_filter_t filter,
|
||||
const pixman_fixed_t *params,
|
||||
int n_params)
|
||||
{
|
||||
image_common_t *common = (image_common_t *)image;
|
||||
pixman_fixed_t *new_params;
|
||||
|
||||
if (params == common->filter_params && filter == common->filter)
|
||||
return TRUE;
|
||||
|
||||
new_params = NULL;
|
||||
if (params)
|
||||
{
|
||||
new_params = pixman_malloc_ab (n_params, sizeof (pixman_fixed_t));
|
||||
if (!new_params)
|
||||
return FALSE;
|
||||
|
||||
memcpy (new_params,
|
||||
params, n_params * sizeof (pixman_fixed_t));
|
||||
}
|
||||
|
||||
common->filter = filter;
|
||||
|
||||
if (common->filter_params)
|
||||
free (common->filter_params);
|
||||
|
||||
common->filter_params = new_params;
|
||||
common->n_filter_params = n_params;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
PIXMAN_EXPORT void
|
||||
pixman_image_set_source_clipping (pixman_image_t *image,
|
||||
pixman_bool_t source_clipping)
|
||||
{
|
||||
image_common_t *common = &image->common;
|
||||
|
||||
if (source_clipping)
|
||||
common->src_clip = &common->clip_region;
|
||||
else
|
||||
common->src_clip = &common->full_region;
|
||||
}
|
||||
|
||||
/* Unlike all the other property setters, this function does not
|
||||
* copy the content of indexed. Doing this copying is simply
|
||||
* way, way too expensive.
|
||||
*/
|
||||
PIXMAN_EXPORT void
|
||||
pixman_image_set_indexed (pixman_image_t *image,
|
||||
const pixman_indexed_t *indexed)
|
||||
{
|
||||
bits_image_t *bits = (bits_image_t *)image;
|
||||
|
||||
bits->indexed = indexed;
|
||||
}
|
||||
|
||||
PIXMAN_EXPORT void
|
||||
pixman_image_set_alpha_map (pixman_image_t *image,
|
||||
pixman_image_t *alpha_map,
|
||||
int16_t x,
|
||||
int16_t y)
|
||||
{
|
||||
image_common_t *common = (image_common_t *)image;
|
||||
|
||||
return_if_fail (!alpha_map || alpha_map->type == BITS);
|
||||
|
||||
if (common->alpha_map != (bits_image_t *)alpha_map)
|
||||
{
|
||||
if (common->alpha_map)
|
||||
pixman_image_unref ((pixman_image_t *)common->alpha_map);
|
||||
|
||||
if (alpha_map)
|
||||
common->alpha_map = (bits_image_t *)pixman_image_ref (alpha_map);
|
||||
else
|
||||
common->alpha_map = NULL;
|
||||
}
|
||||
|
||||
common->alpha_origin.x = x;
|
||||
common->alpha_origin.y = y;
|
||||
}
|
||||
|
||||
PIXMAN_EXPORT void
|
||||
pixman_image_set_component_alpha (pixman_image_t *image,
|
||||
pixman_bool_t component_alpha)
|
||||
{
|
||||
image->common.component_alpha = component_alpha;
|
||||
}
|
||||
|
||||
|
||||
PIXMAN_EXPORT void
|
||||
pixman_image_set_accessors (pixman_image_t *image,
|
||||
pixman_read_memory_func_t read_func,
|
||||
pixman_write_memory_func_t write_func)
|
||||
{
|
||||
return_if_fail (image != NULL);
|
||||
|
||||
image->common.read_func = read_func;
|
||||
image->common.write_func = write_func;
|
||||
}
|
||||
|
||||
PIXMAN_EXPORT uint32_t *
|
||||
pixman_image_get_data (pixman_image_t *image)
|
||||
{
|
||||
if (image->type == BITS)
|
||||
return image->bits.bits;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
PIXMAN_EXPORT int
|
||||
pixman_image_get_width (pixman_image_t *image)
|
||||
{
|
||||
if (image->type == BITS)
|
||||
return image->bits.width;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
PIXMAN_EXPORT int
|
||||
pixman_image_get_height (pixman_image_t *image)
|
||||
{
|
||||
if (image->type == BITS)
|
||||
return image->bits.height;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
PIXMAN_EXPORT int
|
||||
pixman_image_get_stride (pixman_image_t *image)
|
||||
{
|
||||
if (image->type == BITS)
|
||||
return image->bits.rowstride * (int) sizeof (uint32_t);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
PIXMAN_EXPORT int
|
||||
pixman_image_get_depth (pixman_image_t *image)
|
||||
{
|
||||
if (image->type == BITS)
|
||||
return PIXMAN_FORMAT_DEPTH (image->bits.format);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static pixman_bool_t
|
||||
color_to_pixel (pixman_color_t *color,
|
||||
uint32_t *pixel,
|
||||
pixman_format_code_t format)
|
||||
{
|
||||
uint32_t c = color_to_uint32 (color);
|
||||
|
||||
if (!(format == PIXMAN_a8r8g8b8 ||
|
||||
format == PIXMAN_x8r8g8b8 ||
|
||||
format == PIXMAN_a8b8g8r8 ||
|
||||
format == PIXMAN_x8b8g8r8 ||
|
||||
format == PIXMAN_r5g6b5 ||
|
||||
format == PIXMAN_b5g6r5 ||
|
||||
format == PIXMAN_a8))
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (PIXMAN_FORMAT_TYPE (format) == PIXMAN_TYPE_ABGR)
|
||||
{
|
||||
c = ((c & 0xff000000) >> 0) |
|
||||
((c & 0x00ff0000) >> 16) |
|
||||
((c & 0x0000ff00) >> 0) |
|
||||
((c & 0x000000ff) << 16);
|
||||
}
|
||||
|
||||
if (format == PIXMAN_a8)
|
||||
c = c >> 24;
|
||||
else if (format == PIXMAN_r5g6b5 ||
|
||||
format == PIXMAN_b5g6r5)
|
||||
c = cvt8888to0565 (c);
|
||||
|
||||
#if 0
|
||||
printf ("color: %x %x %x %x\n", color->alpha, color->red, color->green, color->blue);
|
||||
printf ("pixel: %x\n", c);
|
||||
#endif
|
||||
|
||||
*pixel = c;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
PIXMAN_EXPORT pixman_bool_t
|
||||
pixman_image_fill_rectangles (pixman_op_t op,
|
||||
pixman_image_t *dest,
|
||||
pixman_color_t *color,
|
||||
int n_rects,
|
||||
const pixman_rectangle16_t *rects)
|
||||
{
|
||||
pixman_image_t *solid;
|
||||
pixman_color_t c;
|
||||
int i;
|
||||
|
||||
if (color->alpha == 0xffff)
|
||||
{
|
||||
if (op == PIXMAN_OP_OVER)
|
||||
op = PIXMAN_OP_SRC;
|
||||
}
|
||||
|
||||
if (op == PIXMAN_OP_CLEAR)
|
||||
{
|
||||
c.red = 0;
|
||||
c.green = 0;
|
||||
c.blue = 0;
|
||||
c.alpha = 0;
|
||||
|
||||
color = &c;
|
||||
|
||||
op = PIXMAN_OP_SRC;
|
||||
}
|
||||
|
||||
if (op == PIXMAN_OP_SRC)
|
||||
{
|
||||
uint32_t pixel;
|
||||
|
||||
if (color_to_pixel (color, &pixel, dest->bits.format))
|
||||
{
|
||||
for (i = 0; i < n_rects; ++i)
|
||||
{
|
||||
pixman_region32_t fill_region;
|
||||
int n_boxes, j;
|
||||
pixman_box32_t *boxes;
|
||||
|
||||
pixman_region32_init_rect (&fill_region, rects[i].x, rects[i].y, rects[i].width, rects[i].height);
|
||||
pixman_region32_intersect (&fill_region, &fill_region, &dest->common.clip_region);
|
||||
|
||||
boxes = pixman_region32_rectangles (&fill_region, &n_boxes);
|
||||
for (j = 0; j < n_boxes; ++j)
|
||||
{
|
||||
const pixman_box32_t *box = &(boxes[j]);
|
||||
pixman_fill (dest->bits.bits, dest->bits.rowstride, PIXMAN_FORMAT_BPP (dest->bits.format),
|
||||
box->x1, box->y1, box->x2 - box->x1, box->y2 - box->y1,
|
||||
pixel);
|
||||
}
|
||||
|
||||
pixman_region32_fini (&fill_region);
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
solid = pixman_image_create_solid_fill (color);
|
||||
if (!solid)
|
||||
return FALSE;
|
||||
|
||||
for (i = 0; i < n_rects; ++i)
|
||||
{
|
||||
const pixman_rectangle16_t *rect = &(rects[i]);
|
||||
|
||||
pixman_image_composite (op, solid, NULL, dest,
|
||||
0, 0, 0, 0,
|
||||
rect->x, rect->y,
|
||||
rect->width, rect->height);
|
||||
}
|
||||
|
||||
pixman_image_unref (solid);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
pixman_bool_t
|
||||
pixman_image_can_get_solid (pixman_image_t *image)
|
||||
{
|
||||
if (image->type == SOLID)
|
||||
return TRUE;
|
||||
|
||||
if (image->type != BITS ||
|
||||
image->bits.width != 1 ||
|
||||
image->bits.height != 1)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (image->common.repeat != PIXMAN_REPEAT_NORMAL)
|
||||
return FALSE;
|
||||
|
||||
switch (image->bits.format)
|
||||
{
|
||||
case PIXMAN_a8r8g8b8:
|
||||
case PIXMAN_x8r8g8b8:
|
||||
case PIXMAN_a8b8g8r8:
|
||||
case PIXMAN_x8b8g8r8:
|
||||
case PIXMAN_r8g8b8:
|
||||
case PIXMAN_b8g8r8:
|
||||
case PIXMAN_r5g6b5:
|
||||
case PIXMAN_b5g6r5:
|
||||
return TRUE;
|
||||
default:
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
pixman_bool_t
|
||||
pixman_image_is_opaque(pixman_image_t *image)
|
||||
{
|
||||
int i = 0;
|
||||
int gradientNumberOfColors = 0;
|
||||
|
||||
if(image->common.alpha_map)
|
||||
return FALSE;
|
||||
|
||||
switch(image->type)
|
||||
{
|
||||
case BITS:
|
||||
if(PIXMAN_FORMAT_A(image->bits.format))
|
||||
return FALSE;
|
||||
break;
|
||||
|
||||
case LINEAR:
|
||||
case CONICAL:
|
||||
case RADIAL:
|
||||
gradientNumberOfColors = image->gradient.n_stops;
|
||||
i=0;
|
||||
while(i<gradientNumberOfColors)
|
||||
{
|
||||
if(image->gradient.stops[i].color.alpha != 0xffff)
|
||||
return FALSE;
|
||||
i++;
|
||||
}
|
||||
break;
|
||||
|
||||
case SOLID:
|
||||
if(Alpha(image->solid.color) != 0xff)
|
||||
return FALSE;
|
||||
break;
|
||||
}
|
||||
|
||||
/* Convolution filters can introduce translucency if the sum of the weights
|
||||
is lower than 1. */
|
||||
if (image->common.filter == PIXMAN_FILTER_CONVOLUTION)
|
||||
return FALSE;
|
||||
|
||||
if (image->common.repeat == PIXMAN_REPEAT_NONE)
|
||||
{
|
||||
if (image->common.filter != PIXMAN_FILTER_NEAREST)
|
||||
return FALSE;
|
||||
|
||||
if (image->common.transform)
|
||||
return FALSE;
|
||||
|
||||
/* Gradients do not necessarily cover the entire compositing area */
|
||||
if (image->type == LINEAR || image->type == CONICAL || image->type == RADIAL)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
625
uppdev/plugin/pixman/lib/pixman-matrix.c
Normal file
625
uppdev/plugin/pixman/lib/pixman-matrix.c
Normal file
|
|
@ -0,0 +1,625 @@
|
|||
/*
|
||||
* Copyright © 2008 Keith Packard
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and its
|
||||
* documentation for any purpose is hereby granted without fee, provided that
|
||||
* the above copyright notice appear in all copies and that both that copyright
|
||||
* notice and this permission notice appear in supporting documentation, and
|
||||
* that the name of the copyright holders not be used in advertising or
|
||||
* publicity pertaining to distribution of the software without specific,
|
||||
* written prior permission. The copyright holders make no representations
|
||||
* about the suitability of this software for any purpose. It is provided "as
|
||||
* is" without express or implied warranty.
|
||||
*
|
||||
* THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
||||
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
|
||||
* EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
|
||||
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
||||
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
||||
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
|
||||
* OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Matrix interfaces
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
#include <math.h>
|
||||
#include <string.h>
|
||||
#include "pixman-private.h"
|
||||
|
||||
#define F(x) pixman_int_to_fixed(x)
|
||||
|
||||
PIXMAN_EXPORT void
|
||||
pixman_transform_init_identity(struct pixman_transform *matrix)
|
||||
{
|
||||
int i;
|
||||
|
||||
memset(matrix, '\0', sizeof (struct pixman_transform));
|
||||
for (i = 0; i < 3; i++)
|
||||
matrix->matrix[i][i] = F(1);
|
||||
}
|
||||
|
||||
typedef pixman_fixed_32_32_t pixman_fixed_34_30_t;
|
||||
|
||||
PIXMAN_EXPORT pixman_bool_t
|
||||
pixman_transform_point_3d(const struct pixman_transform *transform,
|
||||
struct pixman_vector *vector)
|
||||
{
|
||||
struct pixman_vector result;
|
||||
pixman_fixed_32_32_t partial;
|
||||
pixman_fixed_48_16_t v;
|
||||
int i, j;
|
||||
|
||||
for (j = 0; j < 3; j++)
|
||||
{
|
||||
v = 0;
|
||||
for (i = 0; i < 3; i++)
|
||||
{
|
||||
partial = ((pixman_fixed_48_16_t) transform->matrix[j][i] *
|
||||
(pixman_fixed_48_16_t) vector->vector[i]);
|
||||
v += partial >> 16;
|
||||
}
|
||||
if (v > pixman_max_fixed_48_16 || v < pixman_min_fixed_48_16)
|
||||
return FALSE;
|
||||
result.vector[j] = (pixman_fixed_t) v;
|
||||
}
|
||||
*vector = result;
|
||||
if (!result.vector[2])
|
||||
return FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
PIXMAN_EXPORT pixman_bool_t
|
||||
pixman_transform_point(const struct pixman_transform *transform,
|
||||
struct pixman_vector *vector)
|
||||
{
|
||||
pixman_fixed_32_32_t partial;
|
||||
pixman_fixed_34_30_t v[3];
|
||||
pixman_fixed_48_16_t quo;
|
||||
int i, j;
|
||||
|
||||
for (j = 0; j < 3; j++)
|
||||
{
|
||||
v[j] = 0;
|
||||
for (i = 0; i < 3; i++)
|
||||
{
|
||||
partial = ((pixman_fixed_32_32_t) transform->matrix[j][i] *
|
||||
(pixman_fixed_32_32_t) vector->vector[i]);
|
||||
v[j] += partial >> 2;
|
||||
}
|
||||
}
|
||||
if (!v[2])
|
||||
return FALSE;
|
||||
for (j = 0; j < 2; j++)
|
||||
{
|
||||
quo = v[j] / (v[2] >> 16);
|
||||
if (quo > pixman_max_fixed_48_16 || quo < pixman_min_fixed_48_16)
|
||||
return FALSE;
|
||||
vector->vector[j] = (pixman_fixed_t) quo;
|
||||
}
|
||||
vector->vector[2] = pixman_fixed_1;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
PIXMAN_EXPORT pixman_bool_t
|
||||
pixman_transform_multiply (struct pixman_transform *dst,
|
||||
const struct pixman_transform *l,
|
||||
const struct pixman_transform *r)
|
||||
{
|
||||
struct pixman_transform d;
|
||||
int dx, dy;
|
||||
int o;
|
||||
|
||||
for (dy = 0; dy < 3; dy++)
|
||||
for (dx = 0; dx < 3; dx++) {
|
||||
pixman_fixed_48_16_t v;
|
||||
pixman_fixed_32_32_t partial;
|
||||
v = 0;
|
||||
for (o = 0; o < 3; o++) {
|
||||
partial = (pixman_fixed_32_32_t) l->matrix[dy][o] * (pixman_fixed_32_32_t) r->matrix[o][dx];
|
||||
v += partial >> 16;
|
||||
}
|
||||
if (v > pixman_max_fixed_48_16 || v < pixman_min_fixed_48_16)
|
||||
return FALSE;
|
||||
d.matrix[dy][dx] = (pixman_fixed_t) v;
|
||||
}
|
||||
*dst = d;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
PIXMAN_EXPORT void
|
||||
pixman_transform_init_scale (struct pixman_transform *t,
|
||||
pixman_fixed_t sx,
|
||||
pixman_fixed_t sy)
|
||||
{
|
||||
memset (t, '\0', sizeof (struct pixman_transform));
|
||||
t->matrix[0][0] = sx;
|
||||
t->matrix[1][1] = sy;
|
||||
t->matrix[2][2] = F (1);
|
||||
}
|
||||
|
||||
static pixman_fixed_t
|
||||
fixed_inverse(pixman_fixed_t x)
|
||||
{
|
||||
return (pixman_fixed_t) ((((pixman_fixed_48_16_t) F(1)) * F(1)) / x);
|
||||
}
|
||||
|
||||
PIXMAN_EXPORT pixman_bool_t
|
||||
pixman_transform_scale(struct pixman_transform *forward,
|
||||
struct pixman_transform *reverse,
|
||||
pixman_fixed_t sx, pixman_fixed_t sy)
|
||||
{
|
||||
struct pixman_transform t;
|
||||
|
||||
if (sx == 0 || sy == 0)
|
||||
return FALSE;
|
||||
|
||||
if (forward) {
|
||||
pixman_transform_init_scale (&t, sx, sy);
|
||||
if (!pixman_transform_multiply (forward, &t, forward))
|
||||
return FALSE;
|
||||
}
|
||||
if (reverse) {
|
||||
pixman_transform_init_scale (&t, fixed_inverse (sx),
|
||||
fixed_inverse (sy));
|
||||
if (!pixman_transform_multiply (reverse, reverse, &t))
|
||||
return FALSE;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
PIXMAN_EXPORT void
|
||||
pixman_transform_init_rotate(struct pixman_transform *t,
|
||||
pixman_fixed_t c,
|
||||
pixman_fixed_t s)
|
||||
{
|
||||
memset(t, '\0', sizeof (struct pixman_transform));
|
||||
t->matrix[0][0] = c;
|
||||
t->matrix[0][1] = -s;
|
||||
t->matrix[1][0] = s;
|
||||
t->matrix[1][1] = c;
|
||||
t->matrix[2][2] = F (1);
|
||||
}
|
||||
|
||||
PIXMAN_EXPORT pixman_bool_t
|
||||
pixman_transform_rotate(struct pixman_transform *forward,
|
||||
struct pixman_transform *reverse,
|
||||
pixman_fixed_t c, pixman_fixed_t s)
|
||||
{
|
||||
struct pixman_transform t;
|
||||
|
||||
if (forward) {
|
||||
pixman_transform_init_rotate(&t, c, s);
|
||||
if (!pixman_transform_multiply(forward, &t, forward))
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (reverse) {
|
||||
pixman_transform_init_rotate(&t, c, -s);
|
||||
if (!pixman_transform_multiply (reverse, reverse, &t))
|
||||
return FALSE;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
PIXMAN_EXPORT void
|
||||
pixman_transform_init_translate(struct pixman_transform *t,
|
||||
pixman_fixed_t tx, pixman_fixed_t ty)
|
||||
{
|
||||
memset(t, '\0', sizeof (struct pixman_transform));
|
||||
t->matrix[0][0] = F (1);
|
||||
t->matrix[0][2] = tx;
|
||||
t->matrix[1][1] = F (1);
|
||||
t->matrix[1][2] = ty;
|
||||
t->matrix[2][2] = F (1);
|
||||
}
|
||||
|
||||
PIXMAN_EXPORT pixman_bool_t
|
||||
pixman_transform_translate(struct pixman_transform *forward,
|
||||
struct pixman_transform *reverse,
|
||||
pixman_fixed_t tx, pixman_fixed_t ty)
|
||||
{
|
||||
struct pixman_transform t;
|
||||
|
||||
if (forward) {
|
||||
pixman_transform_init_translate(&t, tx, ty);
|
||||
if (!pixman_transform_multiply(forward, &t, forward))
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (reverse) {
|
||||
pixman_transform_init_translate(&t, -tx, -ty);
|
||||
if (!pixman_transform_multiply(reverse, reverse, &t))
|
||||
return FALSE;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
PIXMAN_EXPORT pixman_bool_t
|
||||
pixman_transform_bounds(const struct pixman_transform *matrix,
|
||||
struct pixman_box16 *b)
|
||||
|
||||
{
|
||||
struct pixman_vector v[4];
|
||||
int i;
|
||||
int x1, y1, x2, y2;
|
||||
|
||||
v[0].vector[0] = F (b->x1); v[0].vector[1] = F (b->y1); v[0].vector[2] = F(1);
|
||||
v[1].vector[0] = F (b->x2); v[1].vector[1] = F (b->y1); v[1].vector[2] = F(1);
|
||||
v[2].vector[0] = F (b->x2); v[2].vector[1] = F (b->y2); v[2].vector[2] = F(1);
|
||||
v[3].vector[0] = F (b->x1); v[3].vector[1] = F (b->y2); v[3].vector[2] = F(1);
|
||||
for (i = 0; i < 4; i++)
|
||||
{
|
||||
if (!pixman_transform_point(matrix, &v[i]))
|
||||
return FALSE;
|
||||
x1 = pixman_fixed_to_int(v[i].vector[0]);
|
||||
y1 = pixman_fixed_to_int(v[i].vector[1]);
|
||||
x2 = pixman_fixed_to_int(pixman_fixed_ceil (v[i].vector[0]));
|
||||
y2 = pixman_fixed_to_int(pixman_fixed_ceil (v[i].vector[1]));
|
||||
if (i == 0)
|
||||
{
|
||||
b->x1 = x1; b->y1 = y1;
|
||||
b->x2 = x2; b->y2 = y2;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (x1 < b->x1) b->x1 = x1;
|
||||
if (y1 < b->y1) b->y1 = y1;
|
||||
if (x2 > b->x2) b->x2 = x2;
|
||||
if (y2 > b->y2) b->y2 = y2;
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
PIXMAN_EXPORT pixman_bool_t
|
||||
pixman_transform_invert (struct pixman_transform *dst,
|
||||
const struct pixman_transform *src)
|
||||
{
|
||||
struct pixman_f_transform m, r;
|
||||
|
||||
pixman_f_transform_from_pixman_transform (&m, src);
|
||||
if (!pixman_f_transform_invert (&r, &m))
|
||||
return FALSE;
|
||||
if (!pixman_transform_from_pixman_f_transform (dst, &r))
|
||||
return FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static pixman_bool_t
|
||||
within_epsilon(pixman_fixed_t a, pixman_fixed_t b, pixman_fixed_t epsilon)
|
||||
{
|
||||
pixman_fixed_t t = a - b;
|
||||
if (t < 0) t = -t;
|
||||
return t <= epsilon;
|
||||
}
|
||||
|
||||
#define epsilon (pixman_fixed_t) (2)
|
||||
|
||||
#define is_same(a,b) (within_epsilon(a, b, epsilon))
|
||||
#define is_zero(a) (within_epsilon(a, 0, epsilon))
|
||||
#define is_one(a) (within_epsilon(a, F(1), epsilon))
|
||||
#define is_unit(a) (within_epsilon(a, F( 1), epsilon) || \
|
||||
within_epsilon(a, F(-1), epsilon) || \
|
||||
is_zero(a))
|
||||
#define is_int(a) (is_zero(pixman_fixed_frac(a)))
|
||||
|
||||
PIXMAN_EXPORT pixman_bool_t
|
||||
pixman_transform_is_identity(const struct pixman_transform *t)
|
||||
{
|
||||
return ( is_same(t->matrix[0][0], t->matrix[1][1]) &&
|
||||
is_same(t->matrix[0][0], t->matrix[2][2]) &&
|
||||
!is_zero(t->matrix[0][0]) &&
|
||||
is_zero(t->matrix[0][1]) &&
|
||||
is_zero(t->matrix[0][2]) &&
|
||||
is_zero(t->matrix[1][0]) &&
|
||||
is_zero(t->matrix[1][2]) &&
|
||||
is_zero(t->matrix[2][0]) &&
|
||||
is_zero(t->matrix[2][1]));
|
||||
}
|
||||
|
||||
PIXMAN_EXPORT pixman_bool_t
|
||||
pixman_transform_is_scale(const struct pixman_transform *t)
|
||||
{
|
||||
return (!is_zero(t->matrix[0][0]) &&
|
||||
is_zero(t->matrix[0][1]) &&
|
||||
is_zero(t->matrix[0][2]) &&
|
||||
|
||||
is_zero(t->matrix[1][0]) &&
|
||||
!is_zero(t->matrix[1][1]) &&
|
||||
is_zero(t->matrix[1][2]) &&
|
||||
|
||||
is_zero(t->matrix[2][0]) &&
|
||||
is_zero(t->matrix[2][1]) &&
|
||||
!is_zero(t->matrix[2][2]));
|
||||
}
|
||||
|
||||
PIXMAN_EXPORT pixman_bool_t
|
||||
pixman_transform_is_int_translate(const struct pixman_transform *t)
|
||||
{
|
||||
return (is_one (t->matrix[0][0]) &&
|
||||
is_zero(t->matrix[0][1]) &&
|
||||
is_int (t->matrix[0][2]) &&
|
||||
|
||||
is_zero(t->matrix[1][0]) &&
|
||||
is_one (t->matrix[1][1]) &&
|
||||
is_int (t->matrix[1][2]) &&
|
||||
|
||||
is_zero(t->matrix[2][0]) &&
|
||||
is_zero(t->matrix[2][1]) &&
|
||||
is_one (t->matrix[2][2]));
|
||||
}
|
||||
|
||||
PIXMAN_EXPORT pixman_bool_t
|
||||
pixman_transform_is_inverse(const struct pixman_transform *a,
|
||||
const struct pixman_transform *b)
|
||||
{
|
||||
struct pixman_transform t;
|
||||
|
||||
pixman_transform_multiply(&t, a, b);
|
||||
return pixman_transform_is_identity(&t);
|
||||
}
|
||||
|
||||
PIXMAN_EXPORT void
|
||||
pixman_f_transform_from_pixman_transform (struct pixman_f_transform *ft,
|
||||
const struct pixman_transform *t)
|
||||
{
|
||||
int i, j;
|
||||
|
||||
for (j = 0; j < 3; j++)
|
||||
for (i = 0; i < 3; i++)
|
||||
ft->m[j][i] = pixman_fixed_to_double (t->matrix[j][i]);
|
||||
}
|
||||
|
||||
PIXMAN_EXPORT pixman_bool_t
|
||||
pixman_transform_from_pixman_f_transform (struct pixman_transform *t,
|
||||
const struct pixman_f_transform *ft)
|
||||
{
|
||||
int i, j;
|
||||
|
||||
for (j = 0; j < 3; j++)
|
||||
for (i = 0; i < 3; i++)
|
||||
{
|
||||
double d = ft->m[j][i];
|
||||
if (d < -32767.0 || d > 32767.0)
|
||||
return FALSE;
|
||||
d = d * 65536.0 + 0.5;
|
||||
t->matrix[j][i] = (pixman_fixed_t) floor (d);
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static const int a[3] = { 3, 3, 2 };
|
||||
static const int b[3] = { 2, 1, 1 };
|
||||
|
||||
PIXMAN_EXPORT pixman_bool_t
|
||||
pixman_f_transform_invert(struct pixman_f_transform *dst,
|
||||
const struct pixman_f_transform *src)
|
||||
{
|
||||
double det;
|
||||
int i, j;
|
||||
static int a[3] = { 2, 2, 1 };
|
||||
static int b[3] = { 1, 0, 0 };
|
||||
|
||||
det = 0;
|
||||
for (i = 0; i < 3; i++) {
|
||||
double p;
|
||||
int ai = a[i];
|
||||
int bi = b[i];
|
||||
p = src->m[i][0] * (src->m[ai][2] * src->m[bi][1] -
|
||||
src->m[ai][1] * src->m[bi][2]);
|
||||
if (i == 1)
|
||||
p = -p;
|
||||
det += p;
|
||||
}
|
||||
if (det == 0)
|
||||
return FALSE;
|
||||
det = 1/det;
|
||||
for (j = 0; j < 3; j++) {
|
||||
for (i = 0; i < 3; i++) {
|
||||
double p;
|
||||
int ai = a[i];
|
||||
int aj = a[j];
|
||||
int bi = b[i];
|
||||
int bj = b[j];
|
||||
|
||||
p = (src->m[ai][aj] * src->m[bi][bj] -
|
||||
src->m[ai][bj] * src->m[bi][aj]);
|
||||
if (((i + j) & 1) != 0)
|
||||
p = -p;
|
||||
dst->m[j][i] = det * p;
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
PIXMAN_EXPORT pixman_bool_t
|
||||
pixman_f_transform_point(const struct pixman_f_transform *t,
|
||||
struct pixman_f_vector *v)
|
||||
{
|
||||
struct pixman_f_vector result;
|
||||
int i, j;
|
||||
double a;
|
||||
|
||||
for (j = 0; j < 3; j++)
|
||||
{
|
||||
a = 0;
|
||||
for (i = 0; i < 3; i++)
|
||||
a += t->m[j][i] * v->v[i];
|
||||
result.v[j] = a;
|
||||
}
|
||||
if (!result.v[2])
|
||||
return FALSE;
|
||||
for (j = 0; j < 2; j++)
|
||||
v->v[j] = result.v[j] / result.v[2];
|
||||
v->v[2] = 1;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
PIXMAN_EXPORT void
|
||||
pixman_f_transform_point_3d(const struct pixman_f_transform *t,
|
||||
struct pixman_f_vector *v)
|
||||
{
|
||||
struct pixman_f_vector result;
|
||||
int i, j;
|
||||
double a;
|
||||
|
||||
for (j = 0; j < 3; j++)
|
||||
{
|
||||
a = 0;
|
||||
for (i = 0; i < 3; i++)
|
||||
a += t->m[j][i] * v->v[i];
|
||||
result.v[j] = a;
|
||||
}
|
||||
*v = result;
|
||||
}
|
||||
|
||||
PIXMAN_EXPORT void
|
||||
pixman_f_transform_multiply(struct pixman_f_transform *dst,
|
||||
const struct pixman_f_transform *l,
|
||||
const struct pixman_f_transform *r)
|
||||
{
|
||||
struct pixman_f_transform d;
|
||||
int dx, dy;
|
||||
int o;
|
||||
|
||||
for (dy = 0; dy < 3; dy++)
|
||||
for (dx = 0; dx < 3; dx++)
|
||||
{
|
||||
double v = 0;
|
||||
for (o = 0; o < 3; o++)
|
||||
v += l->m[dy][o] * r->m[o][dx];
|
||||
d.m[dy][dx] = v;
|
||||
}
|
||||
*dst = d;
|
||||
}
|
||||
|
||||
PIXMAN_EXPORT void
|
||||
pixman_f_transform_init_scale (struct pixman_f_transform *t, double sx, double sy)
|
||||
{
|
||||
t->m[0][0] = sx; t->m[0][1] = 0; t->m[0][2] = 0;
|
||||
t->m[1][0] = 0; t->m[1][1] = sy; t->m[1][2] = 0;
|
||||
t->m[2][0] = 0; t->m[2][1] = 0; t->m[2][2] = 1;
|
||||
}
|
||||
|
||||
PIXMAN_EXPORT pixman_bool_t
|
||||
pixman_f_transform_scale (struct pixman_f_transform *forward,
|
||||
struct pixman_f_transform *reverse,
|
||||
double sx, double sy)
|
||||
{
|
||||
struct pixman_f_transform t;
|
||||
|
||||
if (sx == 0 || sy == 0)
|
||||
return FALSE;
|
||||
|
||||
if (forward) {
|
||||
pixman_f_transform_init_scale (&t, sx, sy);
|
||||
pixman_f_transform_multiply (forward, &t, forward);
|
||||
}
|
||||
if (reverse) {
|
||||
pixman_f_transform_init_scale (&t, 1/sx, 1/sy);
|
||||
pixman_f_transform_multiply (reverse, reverse, &t);
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
PIXMAN_EXPORT void
|
||||
pixman_f_transform_init_rotate (struct pixman_f_transform *t, double c, double s)
|
||||
{
|
||||
t->m[0][0] = c; t->m[0][1] = -s; t->m[0][2] = 0;
|
||||
t->m[1][0] = s; t->m[1][1] = c; t->m[1][2] = 0;
|
||||
t->m[2][0] = 0; t->m[2][1] = 0; t->m[2][2] = 1;
|
||||
}
|
||||
|
||||
PIXMAN_EXPORT pixman_bool_t
|
||||
pixman_f_transform_rotate (struct pixman_f_transform *forward,
|
||||
struct pixman_f_transform *reverse,
|
||||
double c, double s)
|
||||
{
|
||||
struct pixman_f_transform t;
|
||||
|
||||
if (forward) {
|
||||
pixman_f_transform_init_rotate (&t, c, s);
|
||||
pixman_f_transform_multiply (forward, &t, forward);
|
||||
}
|
||||
if (reverse) {
|
||||
pixman_f_transform_init_rotate (&t, c, -s);
|
||||
pixman_f_transform_multiply (reverse, reverse, &t);
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
PIXMAN_EXPORT void
|
||||
pixman_f_transform_init_translate (struct pixman_f_transform *t, double tx, double ty)
|
||||
{
|
||||
t->m[0][0] = 1; t->m[0][1] = 0; t->m[0][2] = tx;
|
||||
t->m[1][0] = 0; t->m[1][1] = 1; t->m[1][2] = ty;
|
||||
t->m[2][0] = 0; t->m[2][1] = 0; t->m[2][2] = 1;
|
||||
}
|
||||
|
||||
PIXMAN_EXPORT pixman_bool_t
|
||||
pixman_f_transform_translate (struct pixman_f_transform *forward,
|
||||
struct pixman_f_transform *reverse,
|
||||
double tx, double ty)
|
||||
{
|
||||
struct pixman_f_transform t;
|
||||
|
||||
if (forward) {
|
||||
pixman_f_transform_init_translate (&t, tx, ty);
|
||||
pixman_f_transform_multiply (forward, &t, forward);
|
||||
}
|
||||
if (reverse) {
|
||||
pixman_f_transform_init_translate (&t, -tx, -ty);
|
||||
pixman_f_transform_multiply (reverse, reverse, &t);
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
PIXMAN_EXPORT pixman_bool_t
|
||||
pixman_f_transform_bounds(const struct pixman_f_transform *t, struct pixman_box16 *b)
|
||||
{
|
||||
struct pixman_f_vector v[4];
|
||||
int i;
|
||||
int x1, y1, x2, y2;
|
||||
|
||||
v[0].v[0] = b->x1; v[0].v[1] = b->y1; v[0].v[2] = 1;
|
||||
v[1].v[0] = b->x2; v[1].v[1] = b->y1; v[1].v[2] = 1;
|
||||
v[2].v[0] = b->x2; v[2].v[1] = b->y2; v[2].v[2] = 1;
|
||||
v[3].v[0] = b->x1; v[3].v[1] = b->y2; v[3].v[2] = 1;
|
||||
for (i = 0; i < 4; i++)
|
||||
{
|
||||
if (!pixman_f_transform_point (t, &v[i]))
|
||||
return FALSE;
|
||||
x1 = floor (v[i].v[0]);
|
||||
y1 = floor (v[i].v[1]);
|
||||
x2 = ceil (v[i].v[0]);
|
||||
y2 = ceil (v[i].v[1]);
|
||||
if (i == 0)
|
||||
{
|
||||
b->x1 = x1; b->y1 = y1;
|
||||
b->x2 = x2; b->y2 = y2;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (x1 < b->x1) b->x1 = x1;
|
||||
if (y1 < b->y1) b->y1 = y1;
|
||||
if (x2 > b->x2) b->x2 = x2;
|
||||
if (y2 > b->y2) b->y2 = y2;
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
PIXMAN_EXPORT void
|
||||
pixman_f_transform_init_identity (struct pixman_f_transform *t)
|
||||
{
|
||||
int i, j;
|
||||
|
||||
for (j = 0; j < 3; j++)
|
||||
for (i = 0; i < 3; i++)
|
||||
t->m[j][i] = i == j ? 1 : 0;
|
||||
}
|
||||
3025
uppdev/plugin/pixman/lib/pixman-mmx.c
Normal file
3025
uppdev/plugin/pixman/lib/pixman-mmx.c
Normal file
File diff suppressed because it is too large
Load diff
320
uppdev/plugin/pixman/lib/pixman-mmx.h
Normal file
320
uppdev/plugin/pixman/lib/pixman-mmx.h
Normal file
|
|
@ -0,0 +1,320 @@
|
|||
/*
|
||||
* Copyright © 2004 Red Hat, Inc.
|
||||
* Copyright © 2005 Trolltech AS
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and its
|
||||
* documentation for any purpose is hereby granted without fee, provided that
|
||||
* the above copyright notice appear in all copies and that both that
|
||||
* copyright notice and this permission notice appear in supporting
|
||||
* documentation, and that the name of Red Hat not be used in advertising or
|
||||
* publicity pertaining to distribution of the software without specific,
|
||||
* written prior permission. Red Hat makes no representations about the
|
||||
* suitability of this software for any purpose. It is provided "as is"
|
||||
* without express or implied warranty.
|
||||
*
|
||||
* THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
|
||||
* SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
* FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
* SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
|
||||
* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
|
||||
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
|
||||
* SOFTWARE.
|
||||
*
|
||||
* Author: Søren Sandmann (sandmann@redhat.com)
|
||||
* Lars Knoll (lars@trolltech.com)
|
||||
*
|
||||
* Based on work by Owen Taylor
|
||||
*/
|
||||
#ifndef _PIXMAN_MMX_H_
|
||||
#define _PIXMAN_MMX_H_
|
||||
|
||||
#ifdef HAVE_DIX_CONFIG_H
|
||||
#include <dix-config.h>
|
||||
#endif
|
||||
|
||||
#include "pixman-private.h"
|
||||
|
||||
#ifdef USE_MMX
|
||||
|
||||
#if !defined(__amd64__) && !defined(__x86_64__)
|
||||
pixman_bool_t pixman_have_mmx(void);
|
||||
#else
|
||||
#define pixman_have_mmx() TRUE
|
||||
#endif
|
||||
|
||||
#else
|
||||
#define pixman_have_mmx() FALSE
|
||||
#endif
|
||||
|
||||
#ifdef USE_MMX
|
||||
|
||||
pixman_bool_t
|
||||
pixman_blt_mmx (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);
|
||||
pixman_bool_t
|
||||
pixman_fill_mmx (uint32_t *bits,
|
||||
int stride,
|
||||
int bpp,
|
||||
int x,
|
||||
int y,
|
||||
int width,
|
||||
int height,
|
||||
uint32_t xor);
|
||||
|
||||
void fbComposeSetupMMX(void);
|
||||
|
||||
void fbCompositeSolidMask_nx8888x0565Cmmx (pixman_op_t op,
|
||||
pixman_image_t * pSrc,
|
||||
pixman_image_t * pMask,
|
||||
pixman_image_t * pDst,
|
||||
int16_t xSrc,
|
||||
int16_t ySrc,
|
||||
int16_t xMask,
|
||||
int16_t yMask,
|
||||
int16_t xDst,
|
||||
int16_t yDst,
|
||||
uint16_t width,
|
||||
uint16_t height);
|
||||
void fbCompositeSrcAdd_8888x8888mmx (pixman_op_t op,
|
||||
pixman_image_t * pSrc,
|
||||
pixman_image_t * pMask,
|
||||
pixman_image_t * pDst,
|
||||
int16_t xSrc,
|
||||
int16_t ySrc,
|
||||
int16_t xMask,
|
||||
int16_t yMask,
|
||||
int16_t xDst,
|
||||
int16_t yDst,
|
||||
uint16_t width,
|
||||
uint16_t height);
|
||||
void fbCompositeSrc_8888x8888mmx (pixman_op_t op,
|
||||
pixman_image_t * pSrc,
|
||||
pixman_image_t * pMask,
|
||||
pixman_image_t * pDst,
|
||||
int16_t xSrc,
|
||||
int16_t ySrc,
|
||||
int16_t xMask,
|
||||
int16_t yMask,
|
||||
int16_t xDst,
|
||||
int16_t yDst,
|
||||
uint16_t width,
|
||||
uint16_t height);
|
||||
void
|
||||
fbCompositeSolidMaskSrc_nx8x8888mmx (pixman_op_t op,
|
||||
pixman_image_t * pSrc,
|
||||
pixman_image_t * pMask,
|
||||
pixman_image_t * pDst,
|
||||
int16_t xSrc,
|
||||
int16_t ySrc,
|
||||
int16_t xMask,
|
||||
int16_t yMask,
|
||||
int16_t xDst,
|
||||
int16_t yDst,
|
||||
uint16_t width,
|
||||
uint16_t height);
|
||||
void
|
||||
fbCompositeSrc_x888xnx8888mmx (pixman_op_t op,
|
||||
pixman_image_t * pSrc,
|
||||
pixman_image_t * pMask,
|
||||
pixman_image_t * pDst,
|
||||
int16_t xSrc,
|
||||
int16_t ySrc,
|
||||
int16_t xMask,
|
||||
int16_t yMask,
|
||||
int16_t xDst,
|
||||
int16_t yDst,
|
||||
uint16_t width,
|
||||
uint16_t height);
|
||||
void fbCompositeSolidMask_nx8888x8888Cmmx (pixman_op_t op,
|
||||
pixman_image_t * pSrc,
|
||||
pixman_image_t * pMask,
|
||||
pixman_image_t * pDst,
|
||||
int16_t xSrc,
|
||||
int16_t ySrc,
|
||||
int16_t xMask,
|
||||
int16_t yMask,
|
||||
int16_t xDst,
|
||||
int16_t yDst,
|
||||
uint16_t width,
|
||||
uint16_t height);
|
||||
void fbCompositeSolidMask_nx8x8888mmx (pixman_op_t op,
|
||||
pixman_image_t * pSrc,
|
||||
pixman_image_t * pMask,
|
||||
pixman_image_t * pDst,
|
||||
int16_t xSrc,
|
||||
int16_t ySrc,
|
||||
int16_t xMask,
|
||||
int16_t yMask,
|
||||
int16_t xDst,
|
||||
int16_t yDst,
|
||||
uint16_t width,
|
||||
uint16_t height);
|
||||
void fbCompositeIn_nx8x8mmx (pixman_op_t op,
|
||||
pixman_image_t * pSrc,
|
||||
pixman_image_t * pMask,
|
||||
pixman_image_t * pDst,
|
||||
int16_t xSrc,
|
||||
int16_t ySrc,
|
||||
int16_t xMask,
|
||||
int16_t yMask,
|
||||
int16_t xDst,
|
||||
int16_t yDst,
|
||||
uint16_t width,
|
||||
uint16_t height);
|
||||
void fbCompositeIn_8x8mmx (pixman_op_t op,
|
||||
pixman_image_t * pSrc,
|
||||
pixman_image_t * pMask,
|
||||
pixman_image_t * pDst,
|
||||
int16_t xSrc,
|
||||
int16_t ySrc,
|
||||
int16_t xMask,
|
||||
int16_t yMask,
|
||||
int16_t xDst,
|
||||
int16_t yDst,
|
||||
uint16_t width,
|
||||
uint16_t height);
|
||||
void fbCompositeSrcAdd_8888x8x8mmx (pixman_op_t op,
|
||||
pixman_image_t * pSrc,
|
||||
pixman_image_t * pMask,
|
||||
pixman_image_t * pDst,
|
||||
int16_t xSrc,
|
||||
int16_t ySrc,
|
||||
int16_t xMask,
|
||||
int16_t yMask,
|
||||
int16_t xDst,
|
||||
int16_t yDst,
|
||||
uint16_t width,
|
||||
uint16_t height);
|
||||
void fbCompositeSrcAdd_8000x8000mmx (pixman_op_t op,
|
||||
pixman_image_t * pSrc,
|
||||
pixman_image_t * pMask,
|
||||
pixman_image_t * pDst,
|
||||
int16_t xSrc,
|
||||
int16_t ySrc,
|
||||
int16_t xMask,
|
||||
int16_t yMask,
|
||||
int16_t xDst,
|
||||
int16_t yDst,
|
||||
uint16_t width,
|
||||
uint16_t height);
|
||||
void fbCompositeSrc_8888RevNPx8888mmx (pixman_op_t op,
|
||||
pixman_image_t * pSrc,
|
||||
pixman_image_t * pMask,
|
||||
pixman_image_t * pDst,
|
||||
int16_t xSrc,
|
||||
int16_t ySrc,
|
||||
int16_t xMask,
|
||||
int16_t yMask,
|
||||
int16_t xDst,
|
||||
int16_t yDst,
|
||||
uint16_t width,
|
||||
uint16_t height);
|
||||
void fbCompositeSrc_8888x0565mmx (pixman_op_t op,
|
||||
pixman_image_t * pSrc,
|
||||
pixman_image_t * pMask,
|
||||
pixman_image_t * pDst,
|
||||
int16_t xSrc,
|
||||
int16_t ySrc,
|
||||
int16_t xMask,
|
||||
int16_t yMask,
|
||||
int16_t xDst,
|
||||
int16_t yDst,
|
||||
uint16_t width,
|
||||
uint16_t height);
|
||||
void fbCompositeSrc_8888RevNPx0565mmx (pixman_op_t op,
|
||||
pixman_image_t * pSrc,
|
||||
pixman_image_t * pMask,
|
||||
pixman_image_t * pDst,
|
||||
int16_t xSrc,
|
||||
int16_t ySrc,
|
||||
int16_t xMask,
|
||||
int16_t yMask,
|
||||
int16_t xDst,
|
||||
int16_t yDst,
|
||||
uint16_t width,
|
||||
uint16_t height);
|
||||
void fbCompositeSolid_nx8888mmx (pixman_op_t op,
|
||||
pixman_image_t * pSrc,
|
||||
pixman_image_t * pMask,
|
||||
pixman_image_t * pDst,
|
||||
int16_t xSrc,
|
||||
int16_t ySrc,
|
||||
int16_t xMask,
|
||||
int16_t yMask,
|
||||
int16_t xDst,
|
||||
int16_t yDst,
|
||||
uint16_t width,
|
||||
uint16_t height);
|
||||
void fbCompositeSolid_nx0565mmx (pixman_op_t op,
|
||||
pixman_image_t * pSrc,
|
||||
pixman_image_t * pMask,
|
||||
pixman_image_t * pDst,
|
||||
int16_t xSrc,
|
||||
int16_t ySrc,
|
||||
int16_t xMask,
|
||||
int16_t yMask,
|
||||
int16_t xDst,
|
||||
int16_t yDst,
|
||||
uint16_t width,
|
||||
uint16_t height);
|
||||
void fbCompositeSolidMask_nx8x0565mmx (pixman_op_t op,
|
||||
pixman_image_t * pSrc,
|
||||
pixman_image_t * pMask,
|
||||
pixman_image_t * pDst,
|
||||
int16_t xSrc,
|
||||
int16_t ySrc,
|
||||
int16_t xMask,
|
||||
int16_t yMask,
|
||||
int16_t xDst,
|
||||
int16_t yDst,
|
||||
uint16_t width,
|
||||
uint16_t height);
|
||||
void fbCompositeSrc_8888x8x8888mmx (pixman_op_t op,
|
||||
pixman_image_t * pSrc,
|
||||
pixman_image_t * pMask,
|
||||
pixman_image_t * pDst,
|
||||
int16_t xSrc,
|
||||
int16_t ySrc,
|
||||
int16_t xMask,
|
||||
int16_t yMask,
|
||||
int16_t xDst,
|
||||
int16_t yDst,
|
||||
uint16_t width,
|
||||
uint16_t height);
|
||||
void fbCompositeCopyAreammx (pixman_op_t op,
|
||||
pixman_image_t * pSrc,
|
||||
pixman_image_t * pMask,
|
||||
pixman_image_t * pDst,
|
||||
int16_t xSrc,
|
||||
int16_t ySrc,
|
||||
int16_t xMask,
|
||||
int16_t yMask,
|
||||
int16_t xDst,
|
||||
int16_t yDst,
|
||||
uint16_t width,
|
||||
uint16_t height);
|
||||
void
|
||||
fbCompositeOver_x888x8x8888mmx (pixman_op_t op,
|
||||
pixman_image_t * pSrc,
|
||||
pixman_image_t * pMask,
|
||||
pixman_image_t * pDst,
|
||||
int16_t xSrc,
|
||||
int16_t ySrc,
|
||||
int16_t xMask,
|
||||
int16_t yMask,
|
||||
int16_t xDst,
|
||||
int16_t yDst,
|
||||
uint16_t width,
|
||||
uint16_t height);
|
||||
|
||||
#endif /* USE_MMX */
|
||||
|
||||
#endif /* _PIXMAN_MMX_H_ */
|
||||
2290
uppdev/plugin/pixman/lib/pixman-pict.c
Normal file
2290
uppdev/plugin/pixman/lib/pixman-pict.c
Normal file
File diff suppressed because it is too large
Load diff
804
uppdev/plugin/pixman/lib/pixman-private.h
Normal file
804
uppdev/plugin/pixman/lib/pixman-private.h
Normal file
|
|
@ -0,0 +1,804 @@
|
|||
#ifndef PACKAGE
|
||||
# error config.h must be included before pixman-private.h
|
||||
#endif
|
||||
|
||||
#ifndef PIXMAN_PRIVATE_H
|
||||
#define PIXMAN_PRIVATE_H
|
||||
|
||||
#include "pixman.h"
|
||||
#include <time.h>
|
||||
|
||||
#ifndef FALSE
|
||||
#define FALSE 0
|
||||
#endif
|
||||
|
||||
#ifndef TRUE
|
||||
#define TRUE 1
|
||||
#endif
|
||||
|
||||
#define MSBFirst 0
|
||||
#define LSBFirst 1
|
||||
|
||||
#ifdef WORDS_BIGENDIAN
|
||||
# define IMAGE_BYTE_ORDER MSBFirst
|
||||
# define BITMAP_BIT_ORDER MSBFirst
|
||||
#else
|
||||
# define IMAGE_BYTE_ORDER LSBFirst
|
||||
# define BITMAP_BIT_ORDER LSBFirst
|
||||
#endif
|
||||
|
||||
#undef DEBUG
|
||||
#define DEBUG 0
|
||||
|
||||
#if defined (__GNUC__)
|
||||
# define FUNC ((const char*) (__PRETTY_FUNCTION__))
|
||||
#elif defined (__sun) || (defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L)
|
||||
# define FUNC ((const char*) (__func__))
|
||||
#else
|
||||
# define FUNC ((const char*) ("???"))
|
||||
#endif
|
||||
|
||||
#ifndef INT16_MIN
|
||||
# define INT16_MIN (-32767-1)
|
||||
#endif
|
||||
|
||||
#ifndef INT16_MAX
|
||||
# define INT16_MAX (32767)
|
||||
#endif
|
||||
|
||||
#ifndef INT32_MIN
|
||||
# define INT32_MIN (-2147483647-1)
|
||||
#endif
|
||||
|
||||
#ifndef INT32_MAX
|
||||
# define INT32_MAX (2147483647)
|
||||
#endif
|
||||
|
||||
#ifndef UINT32_MIN
|
||||
# define UINT32_MIN (0)
|
||||
#endif
|
||||
|
||||
#ifndef UINT32_MAX
|
||||
# define UINT32_MAX (4294967295U)
|
||||
#endif
|
||||
|
||||
#ifndef M_PI
|
||||
# define M_PI 3.14159265358979323846
|
||||
#endif
|
||||
|
||||
#ifdef _MSC_VER
|
||||
/* 'inline' is available only in C++ in MSVC */
|
||||
# define inline __inline
|
||||
# define force_inline __forceinline
|
||||
#elif defined __GNUC__
|
||||
# define inline __inline__
|
||||
# define force_inline __inline__ __attribute__ ((__always_inline__))
|
||||
#else
|
||||
# ifndef force_inline
|
||||
# define force_inline inline
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#define FB_SHIFT 5
|
||||
#define FB_UNIT (1 << FB_SHIFT)
|
||||
#define FB_HALFUNIT (1 << (FB_SHIFT-1))
|
||||
#define FB_MASK (FB_UNIT - 1)
|
||||
#define FB_ALLONES ((uint32_t) -1)
|
||||
|
||||
/* Memory allocation helpers */
|
||||
void *pixman_malloc_ab (unsigned int n, unsigned int b);
|
||||
void *pixman_malloc_abc (unsigned int a, unsigned int b, unsigned int c);
|
||||
pixman_bool_t pixman_multiply_overflows_int (unsigned int a, unsigned int b);
|
||||
pixman_bool_t pixman_addition_overflows_int (unsigned int a, unsigned int b);
|
||||
|
||||
#if DEBUG
|
||||
|
||||
#define return_if_fail(expr) \
|
||||
do \
|
||||
{ \
|
||||
if (!(expr)) \
|
||||
{ \
|
||||
fprintf(stderr, "In %s: %s failed\n", FUNC, #expr); \
|
||||
return; \
|
||||
} \
|
||||
} \
|
||||
while (0)
|
||||
|
||||
#define return_val_if_fail(expr, retval) \
|
||||
do \
|
||||
{ \
|
||||
if (!(expr)) \
|
||||
{ \
|
||||
fprintf(stderr, "In %s: %s failed\n", FUNC, #expr); \
|
||||
return (retval); \
|
||||
} \
|
||||
} \
|
||||
while (0)
|
||||
|
||||
#else
|
||||
|
||||
#define return_if_fail(expr) \
|
||||
do \
|
||||
{ \
|
||||
if (!(expr)) \
|
||||
return; \
|
||||
} \
|
||||
while (0)
|
||||
|
||||
#define return_val_if_fail(expr, retval) \
|
||||
do \
|
||||
{ \
|
||||
if (!(expr)) \
|
||||
return (retval); \
|
||||
} \
|
||||
while (0)
|
||||
|
||||
#endif
|
||||
|
||||
typedef struct image_common image_common_t;
|
||||
typedef struct source_image source_image_t;
|
||||
typedef struct solid_fill solid_fill_t;
|
||||
typedef struct gradient gradient_t;
|
||||
typedef struct linear_gradient linear_gradient_t;
|
||||
typedef struct horizontal_gradient horizontal_gradient_t;
|
||||
typedef struct vertical_gradient vertical_gradient_t;
|
||||
typedef struct conical_gradient conical_gradient_t;
|
||||
typedef struct radial_gradient radial_gradient_t;
|
||||
typedef struct bits_image bits_image_t;
|
||||
typedef struct circle circle_t;
|
||||
typedef struct point point_t;
|
||||
|
||||
/* FIXME - the types and structures below should be give proper names
|
||||
*/
|
||||
|
||||
#define FASTCALL
|
||||
typedef FASTCALL void (*CombineMaskU32) (uint32_t *src, const uint32_t *mask, int width);
|
||||
typedef FASTCALL void (*CombineFuncU32) (uint32_t *dest, const uint32_t *src, int width);
|
||||
typedef FASTCALL void (*CombineFuncC32) (uint32_t *dest, uint32_t *src, uint32_t *mask, int width);
|
||||
typedef FASTCALL void (*fetchProc32)(bits_image_t *pict, int x, int y, int width,
|
||||
uint32_t *buffer);
|
||||
typedef FASTCALL uint32_t (*fetchPixelProc32)(bits_image_t *pict, int offset, int line);
|
||||
typedef FASTCALL void (*storeProc32)(pixman_image_t *, uint32_t *bits,
|
||||
const uint32_t *values, int x, int width,
|
||||
const pixman_indexed_t *);
|
||||
|
||||
typedef FASTCALL void (*CombineMaskU64) (uint64_t *src, const uint64_t *mask, int width);
|
||||
typedef FASTCALL void (*CombineFuncU64) (uint64_t *dest, const uint64_t *src, int width);
|
||||
typedef FASTCALL void (*CombineFuncC64) (uint64_t *dest, uint64_t *src, uint64_t *mask, int width);
|
||||
typedef FASTCALL void (*fetchProc64)(bits_image_t *pict, int x, int y, int width,
|
||||
uint64_t *buffer);
|
||||
typedef FASTCALL uint64_t (*fetchPixelProc64)(bits_image_t *pict, int offset, int line);
|
||||
typedef FASTCALL void (*storeProc64)(pixman_image_t *, uint32_t *bits,
|
||||
const uint64_t *values, int x, int width,
|
||||
const pixman_indexed_t *);
|
||||
|
||||
typedef struct _FbComposeData {
|
||||
uint8_t op;
|
||||
pixman_image_t *src;
|
||||
pixman_image_t *mask;
|
||||
pixman_image_t *dest;
|
||||
int16_t xSrc;
|
||||
int16_t ySrc;
|
||||
int16_t xMask;
|
||||
int16_t yMask;
|
||||
int16_t xDest;
|
||||
int16_t yDest;
|
||||
uint16_t width;
|
||||
uint16_t height;
|
||||
} FbComposeData;
|
||||
|
||||
typedef struct _FbComposeFunctions32 {
|
||||
CombineFuncU32 *combineU;
|
||||
CombineFuncC32 *combineC;
|
||||
CombineMaskU32 combineMaskU;
|
||||
} FbComposeFunctions32;
|
||||
|
||||
typedef struct _FbComposeFunctions64 {
|
||||
CombineFuncU64 *combineU;
|
||||
CombineFuncC64 *combineC;
|
||||
CombineMaskU64 combineMaskU;
|
||||
} FbComposeFunctions64;
|
||||
|
||||
extern FbComposeFunctions32 pixman_composeFunctions;
|
||||
extern FbComposeFunctions64 pixman_composeFunctions64;
|
||||
|
||||
void pixman_composite_rect_general_accessors (const FbComposeData *data,
|
||||
void *src_buffer,
|
||||
void *mask_buffer,
|
||||
void *dest_buffer,
|
||||
const int wide);
|
||||
void pixman_composite_rect_general (const FbComposeData *data);
|
||||
|
||||
fetchProc32 pixman_fetchProcForPicture32 (bits_image_t *);
|
||||
fetchPixelProc32 pixman_fetchPixelProcForPicture32 (bits_image_t *);
|
||||
storeProc32 pixman_storeProcForPicture32 (bits_image_t *);
|
||||
fetchProc32 pixman_fetchProcForPicture32_accessors (bits_image_t *);
|
||||
fetchPixelProc32 pixman_fetchPixelProcForPicture32_accessors (bits_image_t *);
|
||||
storeProc32 pixman_storeProcForPicture32_accessors (bits_image_t *);
|
||||
|
||||
fetchProc64 pixman_fetchProcForPicture64 (bits_image_t *);
|
||||
fetchPixelProc64 pixman_fetchPixelProcForPicture64 (bits_image_t *);
|
||||
storeProc64 pixman_storeProcForPicture64 (bits_image_t *);
|
||||
fetchProc64 pixman_fetchProcForPicture64_accessors (bits_image_t *);
|
||||
fetchPixelProc64 pixman_fetchPixelProcForPicture64_accessors (bits_image_t *);
|
||||
storeProc64 pixman_storeProcForPicture64_accessors (bits_image_t *);
|
||||
|
||||
void pixman_expand(uint64_t *dst, const uint32_t *src, pixman_format_code_t, int width);
|
||||
void pixman_contract(uint32_t *dst, const uint64_t *src, int width);
|
||||
|
||||
void pixmanFetchSourcePict(source_image_t *, int x, int y, int width,
|
||||
uint32_t *buffer, uint32_t *mask, uint32_t maskBits);
|
||||
void pixmanFetchSourcePict64(source_image_t *, int x, int y, int width,
|
||||
uint64_t *buffer, uint64_t *mask, uint32_t maskBits);
|
||||
|
||||
void fbFetchTransformed(bits_image_t *, int x, int y, int width,
|
||||
uint32_t *buffer, uint32_t *mask, uint32_t maskBits);
|
||||
void fbStoreExternalAlpha(bits_image_t *, int x, int y, int width,
|
||||
uint32_t *buffer);
|
||||
void fbFetchExternalAlpha(bits_image_t *, int x, int y, int width,
|
||||
uint32_t *buffer, uint32_t *mask, uint32_t maskBits);
|
||||
|
||||
void fbFetchTransformed_accessors(bits_image_t *, int x, int y, int width,
|
||||
uint32_t *buffer, uint32_t *mask,
|
||||
uint32_t maskBits);
|
||||
void fbStoreExternalAlpha_accessors(bits_image_t *, int x, int y, int width,
|
||||
uint32_t *buffer);
|
||||
void fbFetchExternalAlpha_accessors(bits_image_t *, int x, int y, int width,
|
||||
uint32_t *buffer, uint32_t *mask,
|
||||
uint32_t maskBits);
|
||||
|
||||
void fbFetchTransformed64(bits_image_t *, int x, int y, int width,
|
||||
uint64_t *buffer, uint64_t *mask, uint32_t maskBits);
|
||||
void fbStoreExternalAlpha64(bits_image_t *, int x, int y, int width,
|
||||
uint64_t *buffer);
|
||||
void fbFetchExternalAlpha64(bits_image_t *, int x, int y, int width,
|
||||
uint64_t *buffer, uint64_t *mask, uint32_t maskBits);
|
||||
|
||||
void fbFetchTransformed64_accessors(bits_image_t *, int x, int y, int width,
|
||||
uint64_t *buffer, uint64_t *mask,
|
||||
uint32_t maskBits);
|
||||
void fbStoreExternalAlpha64_accessors(bits_image_t *, int x, int y, int width,
|
||||
uint64_t *buffer);
|
||||
void fbFetchExternalAlpha64_accessors(bits_image_t *, int x, int y, int width,
|
||||
uint64_t *buffer, uint64_t *mask,
|
||||
uint32_t maskBits);
|
||||
|
||||
/* end */
|
||||
|
||||
typedef enum
|
||||
{
|
||||
BITS,
|
||||
LINEAR,
|
||||
CONICAL,
|
||||
RADIAL,
|
||||
SOLID
|
||||
} image_type_t;
|
||||
|
||||
#define IS_SOURCE_IMAGE(img) (((image_common_t *)img)->type > BITS)
|
||||
|
||||
typedef enum
|
||||
{
|
||||
SOURCE_IMAGE_CLASS_UNKNOWN,
|
||||
SOURCE_IMAGE_CLASS_HORIZONTAL,
|
||||
SOURCE_IMAGE_CLASS_VERTICAL
|
||||
} source_pict_class_t;
|
||||
|
||||
struct point
|
||||
{
|
||||
int16_t x, y;
|
||||
};
|
||||
|
||||
struct image_common
|
||||
{
|
||||
image_type_t type;
|
||||
int32_t ref_count;
|
||||
pixman_region32_t full_region;
|
||||
pixman_region32_t clip_region;
|
||||
pixman_region32_t *src_clip;
|
||||
pixman_bool_t has_client_clip;
|
||||
pixman_transform_t *transform;
|
||||
pixman_repeat_t repeat;
|
||||
pixman_filter_t filter;
|
||||
pixman_fixed_t *filter_params;
|
||||
int n_filter_params;
|
||||
bits_image_t *alpha_map;
|
||||
point_t alpha_origin;
|
||||
pixman_bool_t component_alpha;
|
||||
pixman_read_memory_func_t read_func;
|
||||
pixman_write_memory_func_t write_func;
|
||||
};
|
||||
|
||||
struct source_image
|
||||
{
|
||||
image_common_t common;
|
||||
source_pict_class_t class;
|
||||
};
|
||||
|
||||
struct solid_fill
|
||||
{
|
||||
source_image_t common;
|
||||
uint32_t color; /* FIXME: shouldn't this be a pixman_color_t? */
|
||||
};
|
||||
|
||||
struct gradient
|
||||
{
|
||||
source_image_t common;
|
||||
int n_stops;
|
||||
pixman_gradient_stop_t * stops;
|
||||
int stop_range;
|
||||
uint32_t * color_table;
|
||||
int color_table_size;
|
||||
};
|
||||
|
||||
struct linear_gradient
|
||||
{
|
||||
gradient_t common;
|
||||
pixman_point_fixed_t p1;
|
||||
pixman_point_fixed_t p2;
|
||||
};
|
||||
|
||||
struct circle
|
||||
{
|
||||
pixman_fixed_t x;
|
||||
pixman_fixed_t y;
|
||||
pixman_fixed_t radius;
|
||||
};
|
||||
|
||||
struct radial_gradient
|
||||
{
|
||||
gradient_t common;
|
||||
|
||||
circle_t c1;
|
||||
circle_t c2;
|
||||
double cdx;
|
||||
double cdy;
|
||||
double dr;
|
||||
double A;
|
||||
};
|
||||
|
||||
struct conical_gradient
|
||||
{
|
||||
gradient_t common;
|
||||
pixman_point_fixed_t center;
|
||||
pixman_fixed_t angle;
|
||||
};
|
||||
|
||||
struct bits_image
|
||||
{
|
||||
image_common_t common;
|
||||
pixman_format_code_t format;
|
||||
const pixman_indexed_t *indexed;
|
||||
int width;
|
||||
int height;
|
||||
uint32_t * bits;
|
||||
uint32_t * free_me;
|
||||
int rowstride; /* in number of uint32_t's */
|
||||
};
|
||||
|
||||
union pixman_image
|
||||
{
|
||||
image_type_t type;
|
||||
image_common_t common;
|
||||
bits_image_t bits;
|
||||
gradient_t gradient;
|
||||
linear_gradient_t linear;
|
||||
conical_gradient_t conical;
|
||||
radial_gradient_t radial;
|
||||
solid_fill_t solid;
|
||||
};
|
||||
|
||||
|
||||
#define LOG2_BITMAP_PAD 5
|
||||
#define FB_STIP_SHIFT LOG2_BITMAP_PAD
|
||||
#define FB_STIP_UNIT (1 << FB_STIP_SHIFT)
|
||||
#define FB_STIP_MASK (FB_STIP_UNIT - 1)
|
||||
#define FB_STIP_ALLONES ((uint32_t) -1)
|
||||
|
||||
#if BITMAP_BIT_ORDER == LSBFirst
|
||||
#define FbScrLeft(x,n) ((x) >> (n))
|
||||
#define FbScrRight(x,n) ((x) << (n))
|
||||
#define FbLeftStipBits(x,n) ((x) & ((((uint32_t) 1) << (n)) - 1))
|
||||
#else
|
||||
#define FbScrLeft(x,n) ((x) << (n))
|
||||
#define FbScrRight(x,n) ((x) >> (n))
|
||||
#define FbLeftStipBits(x,n) ((x) >> (FB_STIP_UNIT - (n)))
|
||||
#endif
|
||||
|
||||
#define FbStipLeft(x,n) FbScrLeft(x,n)
|
||||
#define FbStipRight(x,n) FbScrRight(x,n)
|
||||
#define FbStipMask(x,w) (FbStipRight(FB_STIP_ALLONES,(x) & FB_STIP_MASK) & \
|
||||
FbStipLeft(FB_STIP_ALLONES,(FB_STIP_UNIT - ((x)+(w))) & FB_STIP_MASK))
|
||||
|
||||
#define FbLeftMask(x) ( ((x) & FB_MASK) ? \
|
||||
FbScrRight(FB_ALLONES,(x) & FB_MASK) : 0)
|
||||
#define FbRightMask(x) ( ((FB_UNIT - (x)) & FB_MASK) ? \
|
||||
FbScrLeft(FB_ALLONES,(FB_UNIT - (x)) & FB_MASK) : 0)
|
||||
|
||||
#define FbMaskBits(x,w,l,n,r) { \
|
||||
n = (w); \
|
||||
r = FbRightMask((x)+n); \
|
||||
l = FbLeftMask(x); \
|
||||
if (l) { \
|
||||
n -= FB_UNIT - ((x) & FB_MASK); \
|
||||
if (n < 0) { \
|
||||
n = 0; \
|
||||
l &= r; \
|
||||
r = 0; \
|
||||
} \
|
||||
} \
|
||||
n >>= FB_SHIFT; \
|
||||
}
|
||||
|
||||
#if IMAGE_BYTE_ORDER == MSBFirst
|
||||
#define Fetch24(img, a) ((unsigned long) (a) & 1 ? \
|
||||
((READ(img, a) << 16) | READ(img, (uint16_t *) ((a)+1))) : \
|
||||
((READ(img, (uint16_t *) (a)) << 8) | READ(img, (a)+2)))
|
||||
#define Store24(img,a,v) ((unsigned long) (a) & 1 ? \
|
||||
(WRITE(img, a, (uint8_t) ((v) >> 16)), \
|
||||
WRITE(img, (uint16_t *) ((a)+1), (uint16_t) (v))) : \
|
||||
(WRITE(img, (uint16_t *) (a), (uint16_t) ((v) >> 8)), \
|
||||
WRITE(img, (a)+2, (uint8_t) (v))))
|
||||
#else
|
||||
#define Fetch24(img,a) ((unsigned long) (a) & 1 ? \
|
||||
(READ(img, a) | (READ(img, (uint16_t *) ((a)+1)) << 8)) : \
|
||||
(READ(img, (uint16_t *) (a)) | (READ(img, (a)+2) << 16)))
|
||||
#define Store24(img,a,v) ((unsigned long) (a) & 1 ? \
|
||||
(WRITE(img, a, (uint8_t) (v)), \
|
||||
WRITE(img, (uint16_t *) ((a)+1), (uint16_t) ((v) >> 8))) : \
|
||||
(WRITE(img, (uint16_t *) (a), (uint16_t) (v)), \
|
||||
WRITE(img, (a)+2, (uint8_t) ((v) >> 16))))
|
||||
#endif
|
||||
|
||||
#define CvtR8G8B8toY15(s) (((((s) >> 16) & 0xff) * 153 + \
|
||||
(((s) >> 8) & 0xff) * 301 + \
|
||||
(((s) ) & 0xff) * 58) >> 2)
|
||||
#define miCvtR8G8B8to15(s) ((((s) >> 3) & 0x001f) | \
|
||||
(((s) >> 6) & 0x03e0) | \
|
||||
(((s) >> 9) & 0x7c00))
|
||||
#define miIndexToEnt15(mif,rgb15) ((mif)->ent[rgb15])
|
||||
#define miIndexToEnt24(mif,rgb24) miIndexToEnt15(mif,miCvtR8G8B8to15(rgb24))
|
||||
|
||||
#define miIndexToEntY24(mif,rgb24) ((mif)->ent[CvtR8G8B8toY15(rgb24)])
|
||||
|
||||
|
||||
#define FbIntMult(a,b,t) ( (t) = (a) * (b) + 0x80, ( ( ( (t)>>8 ) + (t) )>>8 ) )
|
||||
#define FbIntDiv(a,b) (((uint16_t) (a) * 255) / (b))
|
||||
|
||||
#define FbGet8(v,i) ((uint16_t) (uint8_t) ((v) >> i))
|
||||
|
||||
|
||||
#define cvt8888to0565(s) ((((s) >> 3) & 0x001f) | \
|
||||
(((s) >> 5) & 0x07e0) | \
|
||||
(((s) >> 8) & 0xf800))
|
||||
#define cvt0565to0888(s) (((((s) << 3) & 0xf8) | (((s) >> 2) & 0x7)) | \
|
||||
((((s) << 5) & 0xfc00) | (((s) >> 1) & 0x300)) | \
|
||||
((((s) << 8) & 0xf80000) | (((s) << 3) & 0x70000)))
|
||||
|
||||
/*
|
||||
* There are two ways of handling alpha -- either as a single unified value or
|
||||
* a separate value for each component, hence each macro must have two
|
||||
* versions. The unified alpha version has a 'U' at the end of the name,
|
||||
* the component version has a 'C'. Similarly, functions which deal with
|
||||
* this difference will have two versions using the same convention.
|
||||
*/
|
||||
|
||||
#define FbOverU(x,y,i,a,t) ((t) = FbIntMult(FbGet8(y,i),(a),(t)) + FbGet8(x,i), \
|
||||
(uint32_t) ((uint8_t) ((t) | (0 - ((t) >> 8)))) << (i))
|
||||
|
||||
#define FbOverC(x,y,i,a,t) ((t) = FbIntMult(FbGet8(y,i),FbGet8(a,i),(t)) + FbGet8(x,i), \
|
||||
(uint32_t) ((uint8_t) ((t) | (0 - ((t) >> 8)))) << (i))
|
||||
|
||||
#define FbInU(x,i,a,t) ((uint32_t) FbIntMult(FbGet8(x,i),(a),(t)) << (i))
|
||||
|
||||
#define FbInC(x,i,a,t) ((uint32_t) FbIntMult(FbGet8(x,i),FbGet8(a,i),(t)) << (i))
|
||||
|
||||
#define FbAdd(x,y,i,t) ((t) = FbGet8(x,i) + FbGet8(y,i), \
|
||||
(uint32_t) ((uint8_t) ((t) | (0 - ((t) >> 8)))) << (i))
|
||||
|
||||
#define div_255(x) (((x) + 0x80 + (((x) + 0x80) >> 8)) >> 8)
|
||||
#define div_65535(x) (((x) + 0x8000 + (((x) + 0x8000) >> 16)) >> 16)
|
||||
|
||||
#define MOD(a,b) ((a) < 0 ? ((b) - ((-(a) - 1) % (b))) - 1 : (a) % (b))
|
||||
|
||||
#define DIV(a,b) ((((a) < 0) == ((b) < 0)) ? (a) / (b) : \
|
||||
((a) - (b) + 1 - (((b) < 0) << 1)) / (b))
|
||||
|
||||
#define CLIP(a,b,c) ((a) < (b) ? (b) : ((a) > (c) ? (c) : (a)))
|
||||
|
||||
#if 0
|
||||
/* FIXME: the MOD macro above is equivalent, but faster I think */
|
||||
#define mod(a,b) ((b) == 1 ? 0 : (a) >= 0 ? (a) % (b) : (b) - (-a) % (b))
|
||||
#endif
|
||||
|
||||
/* FIXME: the (void)__read_func hides lots of warnings (which is what they
|
||||
* are supposed to do), but some of them are real. For example the one
|
||||
* where Fetch4 doesn't have a READ
|
||||
*/
|
||||
|
||||
#if 0
|
||||
/* Framebuffer access support macros */
|
||||
#define ACCESS_MEM(code) \
|
||||
do { \
|
||||
const image_common_t *const com__ = \
|
||||
(image_common_t *)image; \
|
||||
\
|
||||
if (!com__->read_func && !com__->write_func) \
|
||||
{ \
|
||||
const int do_access__ = 0; \
|
||||
const pixman_read_memory_func_t read_func__ = NULL; \
|
||||
const pixman_write_memory_func_t write_func__ = NULL; \
|
||||
(void)read_func__; \
|
||||
(void)write_func__; \
|
||||
(void)do_access__; \
|
||||
\
|
||||
{code} \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
const int do_access__ = 1; \
|
||||
const pixman_read_memory_func_t read_func__ = \
|
||||
com__->read_func; \
|
||||
const pixman_write_memory_func_t write_func__ = \
|
||||
com__->write_func; \
|
||||
(void)read_func__; \
|
||||
(void)write_func__; \
|
||||
(void)do_access__; \
|
||||
\
|
||||
{code} \
|
||||
} \
|
||||
} while (0)
|
||||
#endif
|
||||
|
||||
#ifdef PIXMAN_FB_ACCESSORS
|
||||
|
||||
#define ACCESS(sym) sym##_accessors
|
||||
|
||||
#define READ(img, ptr) \
|
||||
((img)->common.read_func ((ptr), sizeof(*(ptr))))
|
||||
#define WRITE(img, ptr,val) \
|
||||
((img)->common.write_func ((ptr), (val), sizeof (*(ptr))))
|
||||
|
||||
#define MEMCPY_WRAPPED(img, dst, src, size) \
|
||||
do { \
|
||||
size_t _i; \
|
||||
uint8_t *_dst = (uint8_t*)(dst), *_src = (uint8_t*)(src); \
|
||||
for(_i = 0; _i < size; _i++) { \
|
||||
WRITE((img), _dst +_i, READ((img), _src + _i)); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#define MEMSET_WRAPPED(img, dst, val, size) \
|
||||
do { \
|
||||
size_t _i; \
|
||||
uint8_t *_dst = (uint8_t*)(dst); \
|
||||
for(_i = 0; _i < (size_t) size; _i++) { \
|
||||
WRITE((img), _dst +_i, (val)); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#else
|
||||
|
||||
#define ACCESS(sym) sym
|
||||
|
||||
#define READ(img, ptr) (*(ptr))
|
||||
#define WRITE(img, ptr, val) (*(ptr) = (val))
|
||||
#define MEMCPY_WRAPPED(img, dst, src, size) \
|
||||
memcpy(dst, src, size)
|
||||
#define MEMSET_WRAPPED(img, dst, val, size) \
|
||||
memset(dst, val, size)
|
||||
|
||||
#endif
|
||||
|
||||
#define fbComposeGetSolid(img, res, fmt) \
|
||||
do \
|
||||
{ \
|
||||
pixman_format_code_t format__; \
|
||||
if (img->type == SOLID) \
|
||||
{ \
|
||||
format__ = PIXMAN_a8r8g8b8; \
|
||||
(res) = img->solid.color; \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
uint32_t *bits__ = (img)->bits.bits; \
|
||||
format__ = (img)->bits.format; \
|
||||
\
|
||||
switch (PIXMAN_FORMAT_BPP((img)->bits.format)) \
|
||||
{ \
|
||||
case 32: \
|
||||
(res) = READ(img, (uint32_t *)bits__); \
|
||||
break; \
|
||||
case 24: \
|
||||
(res) = Fetch24(img, (uint8_t *) bits__); \
|
||||
break; \
|
||||
case 16: \
|
||||
(res) = READ(img, (uint16_t *) bits__); \
|
||||
(res) = cvt0565to0888(res); \
|
||||
break; \
|
||||
case 8: \
|
||||
(res) = READ(img, (uint8_t *) bits__); \
|
||||
(res) = (res) << 24; \
|
||||
break; \
|
||||
case 1: \
|
||||
(res) = READ(img, (uint32_t *) bits__); \
|
||||
(res) = FbLeftStipBits((res),1) ? 0xff000000 : 0x00000000; \
|
||||
break; \
|
||||
default: \
|
||||
return; \
|
||||
} \
|
||||
/* manage missing src alpha */ \
|
||||
if (!PIXMAN_FORMAT_A((img)->bits.format)) \
|
||||
(res) |= 0xff000000; \
|
||||
} \
|
||||
\
|
||||
/* If necessary, convert RGB <--> BGR. */ \
|
||||
if (PIXMAN_FORMAT_TYPE (format__) != PIXMAN_FORMAT_TYPE(fmt)) \
|
||||
{ \
|
||||
(res) = ((((res) & 0xff000000) >> 0) | \
|
||||
(((res) & 0x00ff0000) >> 16) | \
|
||||
(((res) & 0x0000ff00) >> 0) | \
|
||||
(((res) & 0x000000ff) << 16)); \
|
||||
} \
|
||||
} \
|
||||
while (0)
|
||||
|
||||
#define fbComposeGetStart(pict,x,y,type,out_stride,line,mul) do { \
|
||||
uint32_t *__bits__; \
|
||||
int __stride__; \
|
||||
int __bpp__; \
|
||||
\
|
||||
__bits__ = pict->bits.bits; \
|
||||
__stride__ = pict->bits.rowstride; \
|
||||
__bpp__ = PIXMAN_FORMAT_BPP(pict->bits.format); \
|
||||
(out_stride) = __stride__ * (int) sizeof (uint32_t) / (int) sizeof (type); \
|
||||
(line) = ((type *) __bits__) + \
|
||||
(out_stride) * (y) + (mul) * (x); \
|
||||
} while (0)
|
||||
|
||||
|
||||
#define PIXMAN_FORMAT_16BPC(f) (PIXMAN_FORMAT_A(f) > 8 || \
|
||||
PIXMAN_FORMAT_R(f) > 8 || \
|
||||
PIXMAN_FORMAT_G(f) > 8 || \
|
||||
PIXMAN_FORMAT_B(f) > 8)
|
||||
/*
|
||||
* Edges
|
||||
*/
|
||||
|
||||
#define MAX_ALPHA(n) ((1 << (n)) - 1)
|
||||
#define N_Y_FRAC(n) ((n) == 1 ? 1 : (1 << ((n)/2)) - 1)
|
||||
#define N_X_FRAC(n) ((n) == 1 ? 1 : (1 << ((n)/2)) + 1)
|
||||
|
||||
#define STEP_Y_SMALL(n) (pixman_fixed_1 / N_Y_FRAC(n))
|
||||
#define STEP_Y_BIG(n) (pixman_fixed_1 - (N_Y_FRAC(n) - 1) * STEP_Y_SMALL(n))
|
||||
|
||||
#define Y_FRAC_FIRST(n) (STEP_Y_SMALL(n) / 2)
|
||||
#define Y_FRAC_LAST(n) (Y_FRAC_FIRST(n) + (N_Y_FRAC(n) - 1) * STEP_Y_SMALL(n))
|
||||
|
||||
#define STEP_X_SMALL(n) (pixman_fixed_1 / N_X_FRAC(n))
|
||||
#define STEP_X_BIG(n) (pixman_fixed_1 - (N_X_FRAC(n) - 1) * STEP_X_SMALL(n))
|
||||
|
||||
#define X_FRAC_FIRST(n) (STEP_X_SMALL(n) / 2)
|
||||
#define X_FRAC_LAST(n) (X_FRAC_FIRST(n) + (N_X_FRAC(n) - 1) * STEP_X_SMALL(n))
|
||||
|
||||
#define RenderSamplesX(x,n) ((n) == 1 ? 0 : (pixman_fixed_frac (x) + X_FRAC_FIRST(n)) / STEP_X_SMALL(n))
|
||||
|
||||
/*
|
||||
* Step across a small sample grid gap
|
||||
*/
|
||||
#define RenderEdgeStepSmall(edge) { \
|
||||
edge->x += edge->stepx_small; \
|
||||
edge->e += edge->dx_small; \
|
||||
if (edge->e > 0) \
|
||||
{ \
|
||||
edge->e -= edge->dy; \
|
||||
edge->x += edge->signdx; \
|
||||
} \
|
||||
}
|
||||
|
||||
/*
|
||||
* Step across a large sample grid gap
|
||||
*/
|
||||
#define RenderEdgeStepBig(edge) { \
|
||||
edge->x += edge->stepx_big; \
|
||||
edge->e += edge->dx_big; \
|
||||
if (edge->e > 0) \
|
||||
{ \
|
||||
edge->e -= edge->dy; \
|
||||
edge->x += edge->signdx; \
|
||||
} \
|
||||
}
|
||||
|
||||
void
|
||||
pixman_rasterize_edges_accessors (pixman_image_t *image,
|
||||
pixman_edge_t *l,
|
||||
pixman_edge_t *r,
|
||||
pixman_fixed_t t,
|
||||
pixman_fixed_t b);
|
||||
|
||||
pixman_bool_t
|
||||
pixman_image_is_opaque(pixman_image_t *image);
|
||||
|
||||
pixman_bool_t
|
||||
pixman_image_can_get_solid (pixman_image_t *image);
|
||||
|
||||
pixman_bool_t
|
||||
pixman_compute_composite_region32 (pixman_region32_t * pRegion,
|
||||
pixman_image_t * pSrc,
|
||||
pixman_image_t * pMask,
|
||||
pixman_image_t * pDst,
|
||||
int16_t xSrc,
|
||||
int16_t ySrc,
|
||||
int16_t xMask,
|
||||
int16_t yMask,
|
||||
int16_t xDst,
|
||||
int16_t yDst,
|
||||
uint16_t width,
|
||||
uint16_t height);
|
||||
|
||||
/* GCC visibility */
|
||||
#if defined(__GNUC__) && __GNUC__ >= 4
|
||||
#define PIXMAN_EXPORT __attribute__ ((visibility("default")))
|
||||
/* Sun Studio 8 visibility */
|
||||
#elif defined(__SUNPRO_C) && (__SUNPRO_C >= 0x550)
|
||||
#define PIXMAN_EXPORT __global
|
||||
#else
|
||||
#define PIXMAN_EXPORT
|
||||
#endif
|
||||
|
||||
/* Region Helpers */
|
||||
pixman_bool_t pixman_region32_copy_from_region16 (pixman_region32_t *dst,
|
||||
pixman_region16_t *src);
|
||||
pixman_bool_t pixman_region16_copy_from_region32 (pixman_region16_t *dst,
|
||||
pixman_region32_t *src);
|
||||
void pixman_region_internal_set_static_pointers (pixman_box16_t *empty_box,
|
||||
pixman_region16_data_t *empty_data,
|
||||
pixman_region16_data_t *broken_data);
|
||||
|
||||
#ifdef PIXMAN_TIMING
|
||||
|
||||
/* Timing */
|
||||
static inline uint64_t
|
||||
oil_profile_stamp_rdtsc (void)
|
||||
{
|
||||
uint64_t ts;
|
||||
__asm__ __volatile__("rdtsc\n" : "=A" (ts));
|
||||
return ts;
|
||||
}
|
||||
#define OIL_STAMP oil_profile_stamp_rdtsc
|
||||
|
||||
typedef struct PixmanTimer PixmanTimer;
|
||||
|
||||
struct PixmanTimer
|
||||
{
|
||||
int initialized;
|
||||
const char *name;
|
||||
uint64_t n_times;
|
||||
uint64_t total;
|
||||
PixmanTimer *next;
|
||||
};
|
||||
|
||||
extern int timer_defined;
|
||||
void pixman_timer_register (PixmanTimer *timer);
|
||||
|
||||
#define TIMER_BEGIN(tname) \
|
||||
{ \
|
||||
static PixmanTimer timer##tname; \
|
||||
uint64_t begin##tname; \
|
||||
\
|
||||
if (!timer##tname.initialized) \
|
||||
{ \
|
||||
timer##tname.initialized = 1; \
|
||||
timer##tname.name = #tname; \
|
||||
pixman_timer_register (&timer##tname); \
|
||||
} \
|
||||
\
|
||||
timer##tname.n_times++; \
|
||||
begin##tname = OIL_STAMP();
|
||||
|
||||
#define TIMER_END(tname) \
|
||||
timer##tname.total += OIL_STAMP() - begin##tname; \
|
||||
}
|
||||
|
||||
#endif /* PIXMAN_TIMING */
|
||||
|
||||
#endif /* PIXMAN_PRIVATE_H */
|
||||
2129
uppdev/plugin/pixman/lib/pixman-region.c
Normal file
2129
uppdev/plugin/pixman/lib/pixman-region.c
Normal file
File diff suppressed because it is too large
Load diff
83
uppdev/plugin/pixman/lib/pixman-region16.c
Normal file
83
uppdev/plugin/pixman/lib/pixman-region16.c
Normal file
|
|
@ -0,0 +1,83 @@
|
|||
/*
|
||||
* Copyright © 2008 Red Hat, Inc.
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software
|
||||
* and its documentation for any purpose is hereby granted without
|
||||
* fee, provided that the above copyright notice appear in all copies
|
||||
* and that both that copyright notice and this permission notice
|
||||
* appear in supporting documentation, and that the name of
|
||||
* Red Hat, Inc. not be used in advertising or publicity pertaining to
|
||||
* distribution of the software without specific, written prior
|
||||
* permission. Red Hat, Inc. makes no representations about the
|
||||
* suitability of this software for any purpose. It is provided "as
|
||||
* is" without express or implied warranty.
|
||||
*
|
||||
* RED HAT, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
|
||||
* SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
* FITNESS, IN NO EVENT SHALL RED HAT, INC. BE LIABLE FOR ANY SPECIAL,
|
||||
* INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
|
||||
* RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
|
||||
* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
|
||||
* IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*
|
||||
* Author: Soren Sandmann <sandmann@redhat.com>
|
||||
*/
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#undef PIXMAN_DISABLE_DEPRECATED
|
||||
|
||||
#include "pixman-private.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
typedef pixman_box16_t box_type_t;
|
||||
typedef pixman_region16_data_t region_data_type_t;
|
||||
typedef pixman_region16_t region_type_t;
|
||||
|
||||
typedef struct {
|
||||
int x, y;
|
||||
} point_type_t;
|
||||
|
||||
#define PREFIX(x) pixman_region##x
|
||||
|
||||
PIXMAN_EXPORT void
|
||||
pixman_region_set_static_pointers (pixman_box16_t *empty_box,
|
||||
pixman_region16_data_t *empty_data,
|
||||
pixman_region16_data_t *broken_data)
|
||||
{
|
||||
pixman_region_internal_set_static_pointers (empty_box, empty_data, broken_data);
|
||||
}
|
||||
|
||||
pixman_bool_t
|
||||
pixman_region16_copy_from_region32 (pixman_region16_t *dst,
|
||||
pixman_region32_t *src)
|
||||
{
|
||||
int n_boxes, i;
|
||||
pixman_box32_t *boxes32;
|
||||
pixman_box16_t *boxes16;
|
||||
pixman_bool_t retval;
|
||||
|
||||
boxes32 = pixman_region32_rectangles (src, &n_boxes);
|
||||
|
||||
boxes16 = pixman_malloc_ab (n_boxes, sizeof (pixman_box16_t));
|
||||
|
||||
if (!boxes16)
|
||||
return FALSE;
|
||||
|
||||
for (i = 0; i < n_boxes; ++i)
|
||||
{
|
||||
boxes16[i].x1 = boxes32[i].x1;
|
||||
boxes16[i].y1 = boxes32[i].y1;
|
||||
boxes16[i].x2 = boxes32[i].x2;
|
||||
boxes16[i].y2 = boxes32[i].y2;
|
||||
}
|
||||
|
||||
pixman_region_fini (dst);
|
||||
retval = pixman_region_init_rects (dst, boxes16, n_boxes);
|
||||
free (boxes16);
|
||||
return retval;
|
||||
}
|
||||
|
||||
#include "pixman-region.c"
|
||||
73
uppdev/plugin/pixman/lib/pixman-region32.c
Normal file
73
uppdev/plugin/pixman/lib/pixman-region32.c
Normal file
|
|
@ -0,0 +1,73 @@
|
|||
/*
|
||||
* Copyright © 2008 Red Hat, Inc.
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software
|
||||
* and its documentation for any purpose is hereby granted without
|
||||
* fee, provided that the above copyright notice appear in all copies
|
||||
* and that both that copyright notice and this permission notice
|
||||
* appear in supporting documentation, and that the name of
|
||||
* Red Hat, Inc. not be used in advertising or publicity pertaining to
|
||||
* distribution of the software without specific, written prior
|
||||
* permission. Red Hat, Inc. makes no representations about the
|
||||
* suitability of this software for any purpose. It is provided "as
|
||||
* is" without express or implied warranty.
|
||||
*
|
||||
* RED HAT, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
|
||||
* SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
* FITNESS, IN NO EVENT SHALL RED HAT, INC. BE LIABLE FOR ANY SPECIAL,
|
||||
* INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
|
||||
* RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
|
||||
* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
|
||||
* IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*
|
||||
* Author: Soren Sandmann <sandmann@redhat.com>
|
||||
*/
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include "pixman-private.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
typedef pixman_box32_t box_type_t;
|
||||
typedef pixman_region32_data_t region_data_type_t;
|
||||
typedef pixman_region32_t region_type_t;
|
||||
|
||||
typedef struct {
|
||||
int x, y;
|
||||
} point_type_t;
|
||||
|
||||
#define PREFIX(x) pixman_region32##x
|
||||
|
||||
pixman_bool_t
|
||||
pixman_region32_copy_from_region16 (pixman_region32_t *dst,
|
||||
pixman_region16_t *src)
|
||||
{
|
||||
int n_boxes, i;
|
||||
pixman_box16_t *boxes16;
|
||||
pixman_box32_t *boxes32;
|
||||
pixman_bool_t retval;
|
||||
|
||||
boxes16 = pixman_region_rectangles (src, &n_boxes);
|
||||
|
||||
boxes32 = pixman_malloc_ab (n_boxes, sizeof (pixman_box32_t));
|
||||
|
||||
if (!boxes32)
|
||||
return FALSE;
|
||||
|
||||
for (i = 0; i < n_boxes; ++i)
|
||||
{
|
||||
boxes32[i].x1 = boxes16[i].x1;
|
||||
boxes32[i].y1 = boxes16[i].y1;
|
||||
boxes32[i].x2 = boxes16[i].x2;
|
||||
boxes32[i].y2 = boxes16[i].y2;
|
||||
}
|
||||
|
||||
pixman_region32_fini (dst);
|
||||
retval = pixman_region32_init_rects (dst, boxes32, n_boxes);
|
||||
free (boxes32);
|
||||
return retval;
|
||||
}
|
||||
|
||||
#include "pixman-region.c"
|
||||
709
uppdev/plugin/pixman/lib/pixman-source.c
Normal file
709
uppdev/plugin/pixman/lib/pixman-source.c
Normal file
|
|
@ -0,0 +1,709 @@
|
|||
/*
|
||||
*
|
||||
* Copyright © 2000 Keith Packard, member of The XFree86 Project, Inc.
|
||||
* 2005 Lars Knoll & Zack Rusin, Trolltech
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and its
|
||||
* documentation for any purpose is hereby granted without fee, provided that
|
||||
* the above copyright notice appear in all copies and that both that
|
||||
* copyright notice and this permission notice appear in supporting
|
||||
* documentation, and that the name of Keith Packard not be used in
|
||||
* advertising or publicity pertaining to distribution of the software without
|
||||
* specific, written prior permission. Keith Packard makes no
|
||||
* representations about the suitability of this software for any purpose. It
|
||||
* is provided "as is" without express or implied warranty.
|
||||
*
|
||||
* THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
|
||||
* SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
* FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
* SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
|
||||
* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
|
||||
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
|
||||
#include "pixman-private.h"
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint32_t left_ag;
|
||||
uint32_t left_rb;
|
||||
uint32_t right_ag;
|
||||
uint32_t right_rb;
|
||||
int32_t left_x;
|
||||
int32_t right_x;
|
||||
int32_t stepper;
|
||||
|
||||
pixman_gradient_stop_t *stops;
|
||||
int num_stops;
|
||||
unsigned int spread;
|
||||
|
||||
int need_reset;
|
||||
} GradientWalker;
|
||||
|
||||
static void
|
||||
_gradient_walker_init (GradientWalker *walker,
|
||||
gradient_t *gradient,
|
||||
unsigned int spread)
|
||||
{
|
||||
walker->num_stops = gradient->n_stops;
|
||||
walker->stops = gradient->stops;
|
||||
walker->left_x = 0;
|
||||
walker->right_x = 0x10000;
|
||||
walker->stepper = 0;
|
||||
walker->left_ag = 0;
|
||||
walker->left_rb = 0;
|
||||
walker->right_ag = 0;
|
||||
walker->right_rb = 0;
|
||||
walker->spread = spread;
|
||||
|
||||
walker->need_reset = TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
_gradient_walker_reset (GradientWalker *walker,
|
||||
pixman_fixed_32_32_t pos)
|
||||
{
|
||||
int32_t x, left_x, right_x;
|
||||
pixman_color_t *left_c, *right_c;
|
||||
int n, count = walker->num_stops;
|
||||
pixman_gradient_stop_t * stops = walker->stops;
|
||||
|
||||
static const pixman_color_t transparent_black = { 0, 0, 0, 0 };
|
||||
|
||||
switch (walker->spread)
|
||||
{
|
||||
case PIXMAN_REPEAT_NORMAL:
|
||||
x = (int32_t)pos & 0xFFFF;
|
||||
for (n = 0; n < count; n++)
|
||||
if (x < stops[n].x)
|
||||
break;
|
||||
if (n == 0) {
|
||||
left_x = stops[count-1].x - 0x10000;
|
||||
left_c = &stops[count-1].color;
|
||||
} else {
|
||||
left_x = stops[n-1].x;
|
||||
left_c = &stops[n-1].color;
|
||||
}
|
||||
|
||||
if (n == count) {
|
||||
right_x = stops[0].x + 0x10000;
|
||||
right_c = &stops[0].color;
|
||||
} else {
|
||||
right_x = stops[n].x;
|
||||
right_c = &stops[n].color;
|
||||
}
|
||||
left_x += (pos - x);
|
||||
right_x += (pos - x);
|
||||
break;
|
||||
|
||||
case PIXMAN_REPEAT_PAD:
|
||||
for (n = 0; n < count; n++)
|
||||
if (pos < stops[n].x)
|
||||
break;
|
||||
|
||||
if (n == 0) {
|
||||
left_x = INT32_MIN;
|
||||
left_c = &stops[0].color;
|
||||
} else {
|
||||
left_x = stops[n-1].x;
|
||||
left_c = &stops[n-1].color;
|
||||
}
|
||||
|
||||
if (n == count) {
|
||||
right_x = INT32_MAX;
|
||||
right_c = &stops[n-1].color;
|
||||
} else {
|
||||
right_x = stops[n].x;
|
||||
right_c = &stops[n].color;
|
||||
}
|
||||
break;
|
||||
|
||||
case PIXMAN_REPEAT_REFLECT:
|
||||
x = (int32_t)pos & 0xFFFF;
|
||||
if ((int32_t)pos & 0x10000)
|
||||
x = 0x10000 - x;
|
||||
for (n = 0; n < count; n++)
|
||||
if (x < stops[n].x)
|
||||
break;
|
||||
|
||||
if (n == 0) {
|
||||
left_x = -stops[0].x;
|
||||
left_c = &stops[0].color;
|
||||
} else {
|
||||
left_x = stops[n-1].x;
|
||||
left_c = &stops[n-1].color;
|
||||
}
|
||||
|
||||
if (n == count) {
|
||||
right_x = 0x20000 - stops[n-1].x;
|
||||
right_c = &stops[n-1].color;
|
||||
} else {
|
||||
right_x = stops[n].x;
|
||||
right_c = &stops[n].color;
|
||||
}
|
||||
|
||||
if ((int32_t)pos & 0x10000) {
|
||||
pixman_color_t *tmp_c;
|
||||
int32_t tmp_x;
|
||||
|
||||
tmp_x = 0x10000 - right_x;
|
||||
right_x = 0x10000 - left_x;
|
||||
left_x = tmp_x;
|
||||
|
||||
tmp_c = right_c;
|
||||
right_c = left_c;
|
||||
left_c = tmp_c;
|
||||
|
||||
x = 0x10000 - x;
|
||||
}
|
||||
left_x += (pos - x);
|
||||
right_x += (pos - x);
|
||||
break;
|
||||
|
||||
default: /* RepeatNone */
|
||||
for (n = 0; n < count; n++)
|
||||
if (pos < stops[n].x)
|
||||
break;
|
||||
|
||||
if (n == 0)
|
||||
{
|
||||
left_x = INT32_MIN;
|
||||
right_x = stops[0].x;
|
||||
left_c = right_c = (pixman_color_t*) &transparent_black;
|
||||
}
|
||||
else if (n == count)
|
||||
{
|
||||
left_x = stops[n-1].x;
|
||||
right_x = INT32_MAX;
|
||||
left_c = right_c = (pixman_color_t*) &transparent_black;
|
||||
}
|
||||
else
|
||||
{
|
||||
left_x = stops[n-1].x;
|
||||
right_x = stops[n].x;
|
||||
left_c = &stops[n-1].color;
|
||||
right_c = &stops[n].color;
|
||||
}
|
||||
}
|
||||
|
||||
walker->left_x = left_x;
|
||||
walker->right_x = right_x;
|
||||
walker->left_ag = ((left_c->alpha >> 8) << 16) | (left_c->green >> 8);
|
||||
walker->left_rb = ((left_c->red & 0xff00) << 8) | (left_c->blue >> 8);
|
||||
walker->right_ag = ((right_c->alpha >> 8) << 16) | (right_c->green >> 8);
|
||||
walker->right_rb = ((right_c->red & 0xff00) << 8) | (right_c->blue >> 8);
|
||||
|
||||
if ( walker->left_x == walker->right_x ||
|
||||
( walker->left_ag == walker->right_ag &&
|
||||
walker->left_rb == walker->right_rb ) )
|
||||
{
|
||||
walker->stepper = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
int32_t width = right_x - left_x;
|
||||
walker->stepper = ((1 << 24) + width/2)/width;
|
||||
}
|
||||
|
||||
walker->need_reset = FALSE;
|
||||
}
|
||||
|
||||
#define GRADIENT_WALKER_NEED_RESET(w,x) \
|
||||
( (w)->need_reset || (x) < (w)->left_x || (x) >= (w)->right_x)
|
||||
|
||||
|
||||
/* the following assumes that GRADIENT_WALKER_NEED_RESET(w,x) is FALSE */
|
||||
static uint32_t
|
||||
_gradient_walker_pixel (GradientWalker *walker,
|
||||
pixman_fixed_32_32_t x)
|
||||
{
|
||||
int dist, idist;
|
||||
uint32_t t1, t2, a, color;
|
||||
|
||||
if (GRADIENT_WALKER_NEED_RESET (walker, x))
|
||||
_gradient_walker_reset (walker, x);
|
||||
|
||||
dist = ((int)(x - walker->left_x)*walker->stepper) >> 16;
|
||||
idist = 256 - dist;
|
||||
|
||||
/* combined INTERPOLATE and premultiply */
|
||||
t1 = walker->left_rb*idist + walker->right_rb*dist;
|
||||
t1 = (t1 >> 8) & 0xff00ff;
|
||||
|
||||
t2 = walker->left_ag*idist + walker->right_ag*dist;
|
||||
t2 &= 0xff00ff00;
|
||||
|
||||
color = t2 & 0xff000000;
|
||||
a = t2 >> 24;
|
||||
|
||||
t1 = t1*a + 0x800080;
|
||||
t1 = (t1 + ((t1 >> 8) & 0xff00ff)) >> 8;
|
||||
|
||||
t2 = (t2 >> 8)*a + 0x800080;
|
||||
t2 = (t2 + ((t2 >> 8) & 0xff00ff));
|
||||
|
||||
return (color | (t1 & 0xff00ff) | (t2 & 0xff00));
|
||||
}
|
||||
|
||||
void pixmanFetchSourcePict(source_image_t * pict, int x, int y, int width,
|
||||
uint32_t *buffer, uint32_t *mask, uint32_t maskBits)
|
||||
{
|
||||
#if 0
|
||||
SourcePictPtr pGradient = pict->pSourcePict;
|
||||
#endif
|
||||
GradientWalker walker;
|
||||
uint32_t *end = buffer + width;
|
||||
gradient_t *gradient;
|
||||
|
||||
if (pict->common.type == SOLID)
|
||||
{
|
||||
register uint32_t color = ((solid_fill_t *)pict)->color;
|
||||
|
||||
while (buffer < end)
|
||||
*(buffer++) = color;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
gradient = (gradient_t *)pict;
|
||||
|
||||
_gradient_walker_init (&walker, gradient, pict->common.repeat);
|
||||
|
||||
if (pict->common.type == LINEAR) {
|
||||
pixman_vector_t v, unit;
|
||||
pixman_fixed_32_32_t l;
|
||||
pixman_fixed_48_16_t dx, dy, a, b, off;
|
||||
linear_gradient_t *linear = (linear_gradient_t *)pict;
|
||||
|
||||
/* reference point is the center of the pixel */
|
||||
v.vector[0] = pixman_int_to_fixed(x) + pixman_fixed_1/2;
|
||||
v.vector[1] = pixman_int_to_fixed(y) + pixman_fixed_1/2;
|
||||
v.vector[2] = pixman_fixed_1;
|
||||
if (pict->common.transform) {
|
||||
if (!pixman_transform_point_3d (pict->common.transform, &v))
|
||||
return;
|
||||
unit.vector[0] = pict->common.transform->matrix[0][0];
|
||||
unit.vector[1] = pict->common.transform->matrix[1][0];
|
||||
unit.vector[2] = pict->common.transform->matrix[2][0];
|
||||
} else {
|
||||
unit.vector[0] = pixman_fixed_1;
|
||||
unit.vector[1] = 0;
|
||||
unit.vector[2] = 0;
|
||||
}
|
||||
|
||||
dx = linear->p2.x - linear->p1.x;
|
||||
dy = linear->p2.y - linear->p1.y;
|
||||
l = dx*dx + dy*dy;
|
||||
if (l != 0) {
|
||||
a = (dx << 32) / l;
|
||||
b = (dy << 32) / l;
|
||||
off = (-a*linear->p1.x - b*linear->p1.y)>>16;
|
||||
}
|
||||
if (l == 0 || (unit.vector[2] == 0 && v.vector[2] == pixman_fixed_1)) {
|
||||
pixman_fixed_48_16_t inc, t;
|
||||
/* affine transformation only */
|
||||
if (l == 0) {
|
||||
t = 0;
|
||||
inc = 0;
|
||||
} else {
|
||||
t = ((a*v.vector[0] + b*v.vector[1]) >> 16) + off;
|
||||
inc = (a * unit.vector[0] + b * unit.vector[1]) >> 16;
|
||||
}
|
||||
|
||||
if (pict->class == SOURCE_IMAGE_CLASS_VERTICAL)
|
||||
{
|
||||
register uint32_t color;
|
||||
|
||||
color = _gradient_walker_pixel( &walker, t );
|
||||
while (buffer < end)
|
||||
*(buffer++) = color;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!mask) {
|
||||
while (buffer < end)
|
||||
{
|
||||
*(buffer) = _gradient_walker_pixel (&walker, t);
|
||||
buffer += 1;
|
||||
t += inc;
|
||||
}
|
||||
} else {
|
||||
while (buffer < end) {
|
||||
if (*mask++ & maskBits)
|
||||
{
|
||||
*(buffer) = _gradient_walker_pixel (&walker, t);
|
||||
}
|
||||
buffer += 1;
|
||||
t += inc;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else /* projective transformation */
|
||||
{
|
||||
pixman_fixed_48_16_t t;
|
||||
|
||||
if (pict->class == SOURCE_IMAGE_CLASS_VERTICAL)
|
||||
{
|
||||
register uint32_t color;
|
||||
|
||||
if (v.vector[2] == 0)
|
||||
{
|
||||
t = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
pixman_fixed_48_16_t x, y;
|
||||
|
||||
x = ((pixman_fixed_48_16_t) v.vector[0] << 16) / v.vector[2];
|
||||
y = ((pixman_fixed_48_16_t) v.vector[1] << 16) / v.vector[2];
|
||||
t = ((a * x + b * y) >> 16) + off;
|
||||
}
|
||||
|
||||
color = _gradient_walker_pixel( &walker, t );
|
||||
while (buffer < end)
|
||||
*(buffer++) = color;
|
||||
}
|
||||
else
|
||||
{
|
||||
while (buffer < end)
|
||||
{
|
||||
if (!mask || *mask++ & maskBits)
|
||||
{
|
||||
if (v.vector[2] == 0) {
|
||||
t = 0;
|
||||
} else {
|
||||
pixman_fixed_48_16_t x, y;
|
||||
x = ((pixman_fixed_48_16_t)v.vector[0] << 16) / v.vector[2];
|
||||
y = ((pixman_fixed_48_16_t)v.vector[1] << 16) / v.vector[2];
|
||||
t = ((a*x + b*y) >> 16) + off;
|
||||
}
|
||||
*(buffer) = _gradient_walker_pixel (&walker, t);
|
||||
}
|
||||
++buffer;
|
||||
v.vector[0] += unit.vector[0];
|
||||
v.vector[1] += unit.vector[1];
|
||||
v.vector[2] += unit.vector[2];
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
||||
/*
|
||||
* In the radial gradient problem we are given two circles (c₁,r₁) and
|
||||
* (c₂,r₂) that define the gradient itself. Then, for any point p, we
|
||||
* must compute the value(s) of t within [0.0, 1.0] representing the
|
||||
* circle(s) that would color the point.
|
||||
*
|
||||
* There are potentially two values of t since the point p can be
|
||||
* colored by both sides of the circle, (which happens whenever one
|
||||
* circle is not entirely contained within the other).
|
||||
*
|
||||
* If we solve for a value of t that is outside of [0.0, 1.0] then we
|
||||
* use the extend mode (NONE, REPEAT, REFLECT, or PAD) to map to a
|
||||
* value within [0.0, 1.0].
|
||||
*
|
||||
* Here is an illustration of the problem:
|
||||
*
|
||||
* p₂
|
||||
* p •
|
||||
* • ╲
|
||||
* · ╲r₂
|
||||
* p₁ · ╲
|
||||
* • θ╲
|
||||
* ╲ ╌╌•
|
||||
* ╲r₁ · c₂
|
||||
* θ╲ ·
|
||||
* ╌╌•
|
||||
* c₁
|
||||
*
|
||||
* Given (c₁,r₁), (c₂,r₂) and p, we must find an angle θ such that two
|
||||
* points p₁ and p₂ on the two circles are collinear with p. Then, the
|
||||
* desired value of t is the ratio of the length of p₁p to the length
|
||||
* of p₁p₂.
|
||||
*
|
||||
* So, we have six unknown values: (p₁x, p₁y), (p₂x, p₂y), θ and t.
|
||||
* We can also write six equations that constrain the problem:
|
||||
*
|
||||
* Point p₁ is a distance r₁ from c₁ at an angle of θ:
|
||||
*
|
||||
* 1. p₁x = c₁x + r₁·cos θ
|
||||
* 2. p₁y = c₁y + r₁·sin θ
|
||||
*
|
||||
* Point p₂ is a distance r₂ from c₂ at an angle of θ:
|
||||
*
|
||||
* 3. p₂x = c₂x + r2·cos θ
|
||||
* 4. p₂y = c₂y + r2·sin θ
|
||||
*
|
||||
* Point p lies at a fraction t along the line segment p₁p₂:
|
||||
*
|
||||
* 5. px = t·p₂x + (1-t)·p₁x
|
||||
* 6. py = t·p₂y + (1-t)·p₁y
|
||||
*
|
||||
* To solve, first subtitute 1-4 into 5 and 6:
|
||||
*
|
||||
* px = t·(c₂x + r₂·cos θ) + (1-t)·(c₁x + r₁·cos θ)
|
||||
* py = t·(c₂y + r₂·sin θ) + (1-t)·(c₁y + r₁·sin θ)
|
||||
*
|
||||
* Then solve each for cos θ and sin θ expressed as a function of t:
|
||||
*
|
||||
* cos θ = (-(c₂x - c₁x)·t + (px - c₁x)) / ((r₂-r₁)·t + r₁)
|
||||
* sin θ = (-(c₂y - c₁y)·t + (py - c₁y)) / ((r₂-r₁)·t + r₁)
|
||||
*
|
||||
* To simplify this a bit, we define new variables for several of the
|
||||
* common terms as shown below:
|
||||
*
|
||||
* p₂
|
||||
* p •
|
||||
* • ╲
|
||||
* · ┆ ╲r₂
|
||||
* p₁ · ┆ ╲
|
||||
* • pdy┆ ╲
|
||||
* ╲ ┆ •c₂
|
||||
* ╲r₁ ┆ · ┆
|
||||
* ╲ ·┆ ┆cdy
|
||||
* •╌╌╌╌┴╌╌╌╌╌╌╌┘
|
||||
* c₁ pdx cdx
|
||||
*
|
||||
* cdx = (c₂x - c₁x)
|
||||
* cdy = (c₂y - c₁y)
|
||||
* dr = r₂-r₁
|
||||
* pdx = px - c₁x
|
||||
* pdy = py - c₁y
|
||||
*
|
||||
* Note that cdx, cdy, and dr do not depend on point p at all, so can
|
||||
* be pre-computed for the entire gradient. The simplifed equations
|
||||
* are now:
|
||||
*
|
||||
* cos θ = (-cdx·t + pdx) / (dr·t + r₁)
|
||||
* sin θ = (-cdy·t + pdy) / (dr·t + r₁)
|
||||
*
|
||||
* Finally, to get a single function of t and eliminate the last
|
||||
* unknown θ, we use the identity sin²θ + cos²θ = 1. First, square
|
||||
* each equation, (we knew a quadratic was coming since it must be
|
||||
* possible to obtain two solutions in some cases):
|
||||
*
|
||||
* cos²θ = (cdx²t² - 2·cdx·pdx·t + pdx²) / (dr²·t² + 2·r₁·dr·t + r₁²)
|
||||
* sin²θ = (cdy²t² - 2·cdy·pdy·t + pdy²) / (dr²·t² + 2·r₁·dr·t + r₁²)
|
||||
*
|
||||
* Then add both together, set the result equal to 1, and express as a
|
||||
* standard quadratic equation in t of the form At² + Bt + C = 0
|
||||
*
|
||||
* (cdx² + cdy² - dr²)·t² - 2·(cdx·pdx + cdy·pdy + r₁·dr)·t + (pdx² + pdy² - r₁²) = 0
|
||||
*
|
||||
* In other words:
|
||||
*
|
||||
* A = cdx² + cdy² - dr²
|
||||
* B = -2·(pdx·cdx + pdy·cdy + r₁·dr)
|
||||
* C = pdx² + pdy² - r₁²
|
||||
*
|
||||
* And again, notice that A does not depend on p, so can be
|
||||
* precomputed. From here we just use the quadratic formula to solve
|
||||
* for t:
|
||||
*
|
||||
* t = (-2·B ± ⎷(B² - 4·A·C)) / 2·A
|
||||
*/
|
||||
/* radial or conical */
|
||||
pixman_bool_t affine = TRUE;
|
||||
double cx = 1.;
|
||||
double cy = 0.;
|
||||
double cz = 0.;
|
||||
double rx = x + 0.5;
|
||||
double ry = y + 0.5;
|
||||
double rz = 1.;
|
||||
|
||||
if (pict->common.transform) {
|
||||
pixman_vector_t v;
|
||||
/* reference point is the center of the pixel */
|
||||
v.vector[0] = pixman_int_to_fixed(x) + pixman_fixed_1/2;
|
||||
v.vector[1] = pixman_int_to_fixed(y) + pixman_fixed_1/2;
|
||||
v.vector[2] = pixman_fixed_1;
|
||||
if (!pixman_transform_point_3d (pict->common.transform, &v))
|
||||
return;
|
||||
|
||||
cx = pict->common.transform->matrix[0][0]/65536.;
|
||||
cy = pict->common.transform->matrix[1][0]/65536.;
|
||||
cz = pict->common.transform->matrix[2][0]/65536.;
|
||||
rx = v.vector[0]/65536.;
|
||||
ry = v.vector[1]/65536.;
|
||||
rz = v.vector[2]/65536.;
|
||||
affine = pict->common.transform->matrix[2][0] == 0 && v.vector[2] == pixman_fixed_1;
|
||||
}
|
||||
|
||||
if (pict->common.type == RADIAL) {
|
||||
radial_gradient_t *radial = (radial_gradient_t *)pict;
|
||||
if (affine) {
|
||||
while (buffer < end) {
|
||||
if (!mask || *mask++ & maskBits)
|
||||
{
|
||||
double pdx, pdy;
|
||||
double B, C;
|
||||
double det;
|
||||
double c1x = radial->c1.x / 65536.0;
|
||||
double c1y = radial->c1.y / 65536.0;
|
||||
double r1 = radial->c1.radius / 65536.0;
|
||||
pixman_fixed_48_16_t t;
|
||||
|
||||
pdx = rx - c1x;
|
||||
pdy = ry - c1y;
|
||||
|
||||
B = -2 * ( pdx * radial->cdx
|
||||
+ pdy * radial->cdy
|
||||
+ r1 * radial->dr);
|
||||
C = (pdx * pdx + pdy * pdy - r1 * r1);
|
||||
|
||||
det = (B * B) - (4 * radial->A * C);
|
||||
if (det < 0.0)
|
||||
det = 0.0;
|
||||
|
||||
if (radial->A < 0)
|
||||
t = (pixman_fixed_48_16_t) ((- B - sqrt(det)) / (2.0 * radial->A) * 65536);
|
||||
else
|
||||
t = (pixman_fixed_48_16_t) ((- B + sqrt(det)) / (2.0 * radial->A) * 65536);
|
||||
|
||||
*(buffer) = _gradient_walker_pixel (&walker, t);
|
||||
}
|
||||
++buffer;
|
||||
|
||||
rx += cx;
|
||||
ry += cy;
|
||||
}
|
||||
} else {
|
||||
/* projective */
|
||||
while (buffer < end) {
|
||||
if (!mask || *mask++ & maskBits)
|
||||
{
|
||||
double pdx, pdy;
|
||||
double B, C;
|
||||
double det;
|
||||
double c1x = radial->c1.x / 65536.0;
|
||||
double c1y = radial->c1.y / 65536.0;
|
||||
double r1 = radial->c1.radius / 65536.0;
|
||||
pixman_fixed_48_16_t t;
|
||||
double x, y;
|
||||
|
||||
if (rz != 0) {
|
||||
x = rx/rz;
|
||||
y = ry/rz;
|
||||
} else {
|
||||
x = y = 0.;
|
||||
}
|
||||
|
||||
pdx = x - c1x;
|
||||
pdy = y - c1y;
|
||||
|
||||
B = -2 * ( pdx * radial->cdx
|
||||
+ pdy * radial->cdy
|
||||
+ r1 * radial->dr);
|
||||
C = (pdx * pdx + pdy * pdy - r1 * r1);
|
||||
|
||||
det = (B * B) - (4 * radial->A * C);
|
||||
if (det < 0.0)
|
||||
det = 0.0;
|
||||
|
||||
if (radial->A < 0)
|
||||
t = (pixman_fixed_48_16_t) ((- B - sqrt(det)) / (2.0 * radial->A) * 65536);
|
||||
else
|
||||
t = (pixman_fixed_48_16_t) ((- B + sqrt(det)) / (2.0 * radial->A) * 65536);
|
||||
|
||||
*(buffer) = _gradient_walker_pixel (&walker, t);
|
||||
}
|
||||
++buffer;
|
||||
|
||||
rx += cx;
|
||||
ry += cy;
|
||||
rz += cz;
|
||||
}
|
||||
}
|
||||
} else /* SourcePictTypeConical */ {
|
||||
conical_gradient_t *conical = (conical_gradient_t *)pict;
|
||||
double a = conical->angle/(180.*65536);
|
||||
if (affine) {
|
||||
rx -= conical->center.x/65536.;
|
||||
ry -= conical->center.y/65536.;
|
||||
|
||||
while (buffer < end) {
|
||||
double angle;
|
||||
|
||||
if (!mask || *mask++ & maskBits)
|
||||
{
|
||||
pixman_fixed_48_16_t t;
|
||||
|
||||
angle = atan2(ry, rx) + a;
|
||||
t = (pixman_fixed_48_16_t) (angle * (65536. / (2*M_PI)));
|
||||
|
||||
*(buffer) = _gradient_walker_pixel (&walker, t);
|
||||
}
|
||||
|
||||
++buffer;
|
||||
rx += cx;
|
||||
ry += cy;
|
||||
}
|
||||
} else {
|
||||
while (buffer < end) {
|
||||
double x, y;
|
||||
double angle;
|
||||
|
||||
if (!mask || *mask++ & maskBits)
|
||||
{
|
||||
pixman_fixed_48_16_t t;
|
||||
|
||||
if (rz != 0) {
|
||||
x = rx/rz;
|
||||
y = ry/rz;
|
||||
} else {
|
||||
x = y = 0.;
|
||||
}
|
||||
x -= conical->center.x/65536.;
|
||||
y -= conical->center.y/65536.;
|
||||
angle = atan2(y, x) + a;
|
||||
t = (pixman_fixed_48_16_t) (angle * (65536. / (2*M_PI)));
|
||||
|
||||
*(buffer) = _gradient_walker_pixel (&walker, t);
|
||||
}
|
||||
|
||||
++buffer;
|
||||
rx += cx;
|
||||
ry += cy;
|
||||
rz += cz;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* For now, just evaluate the source picture at 32bpp and expand. We could
|
||||
* produce smoother gradients by evaluating them at higher color depth, but
|
||||
* that's a project for the future.
|
||||
*/
|
||||
void pixmanFetchSourcePict64(source_image_t * pict, int x, int y, int width,
|
||||
uint64_t *buffer, uint64_t *mask, uint32_t maskBits)
|
||||
{
|
||||
uint32_t *mask8 = NULL;
|
||||
|
||||
// Contract the mask image, if one exists, so that the 32-bit fetch function
|
||||
// can use it.
|
||||
if (mask) {
|
||||
mask8 = pixman_malloc_ab(width, sizeof(uint32_t));
|
||||
pixman_contract(mask8, mask, width);
|
||||
}
|
||||
|
||||
// Fetch the source image into the first half of buffer.
|
||||
pixmanFetchSourcePict(pict, x, y, width, (uint32_t*)buffer, mask8,
|
||||
maskBits);
|
||||
|
||||
// Expand from 32bpp to 64bpp in place.
|
||||
pixman_expand(buffer, (uint32_t*)buffer, PIXMAN_a8r8g8b8, width);
|
||||
|
||||
free(mask8);
|
||||
}
|
||||
4717
uppdev/plugin/pixman/lib/pixman-sse2.c
Normal file
4717
uppdev/plugin/pixman/lib/pixman-sse2.c
Normal file
File diff suppressed because it is too large
Load diff
358
uppdev/plugin/pixman/lib/pixman-sse2.h
Normal file
358
uppdev/plugin/pixman/lib/pixman-sse2.h
Normal file
|
|
@ -0,0 +1,358 @@
|
|||
/*
|
||||
* Copyright © 2008 Rodrigo Kumpera
|
||||
* Copyright © 2008 André Tupinambá
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and its
|
||||
* documentation for any purpose is hereby granted without fee, provided that
|
||||
* the above copyright notice appear in all copies and that both that
|
||||
* copyright notice and this permission notice appear in supporting
|
||||
* documentation, and that the name of Red Hat not be used in advertising or
|
||||
* publicity pertaining to distribution of the software without specific,
|
||||
* written prior permission. Red Hat makes no representations about the
|
||||
* suitability of this software for any purpose. It is provided "as is"
|
||||
* without express or implied warranty.
|
||||
*
|
||||
* THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
|
||||
* SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
* FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
* SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
|
||||
* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
|
||||
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
|
||||
* SOFTWARE.
|
||||
*
|
||||
* Author: Rodrigo Kumpera (kumpera@gmail.com)
|
||||
* André Tupinambá (andrelrt@gmail.com)
|
||||
*
|
||||
* Based on work by Owen Taylor and Søren Sandmann
|
||||
*/
|
||||
#ifndef _PIXMAN_SSE_H_
|
||||
#define _PIXMAN_SSE_H_
|
||||
|
||||
#ifdef HAVE_DIX_CONFIG_H
|
||||
#include <dix-config.h>
|
||||
#endif
|
||||
|
||||
#include "pixman-private.h"
|
||||
|
||||
#ifdef USE_SSE2
|
||||
|
||||
#if !defined(__amd64__) && !defined(__x86_64__)
|
||||
pixman_bool_t pixman_have_sse2(void);
|
||||
#else
|
||||
#define pixman_have_sse2() TRUE
|
||||
#endif
|
||||
|
||||
#else
|
||||
#define pixman_have_sse2() FALSE
|
||||
#endif
|
||||
|
||||
#ifdef USE_SSE2
|
||||
|
||||
void fbComposeSetupSSE2(void);
|
||||
|
||||
pixman_bool_t
|
||||
pixmanFillsse2 (uint32_t *bits,
|
||||
int stride,
|
||||
int bpp,
|
||||
int x,
|
||||
int y,
|
||||
int width,
|
||||
int height,
|
||||
uint32_t data);
|
||||
|
||||
pixman_bool_t
|
||||
pixmanBltsse2 (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);
|
||||
|
||||
void
|
||||
fbCompositeSolid_nx8888sse2 (pixman_op_t op,
|
||||
pixman_image_t * pSrc,
|
||||
pixman_image_t * pMask,
|
||||
pixman_image_t * pDst,
|
||||
int16_t xSrc,
|
||||
int16_t ySrc,
|
||||
int16_t xMask,
|
||||
int16_t yMask,
|
||||
int16_t xDst,
|
||||
int16_t yDst,
|
||||
uint16_t width,
|
||||
uint16_t height);
|
||||
|
||||
void
|
||||
fbCompositeSolid_nx0565sse2 (pixman_op_t op,
|
||||
pixman_image_t * pSrc,
|
||||
pixman_image_t * pMask,
|
||||
pixman_image_t * pDst,
|
||||
int16_t xSrc,
|
||||
int16_t ySrc,
|
||||
int16_t xMask,
|
||||
int16_t yMask,
|
||||
int16_t xDst,
|
||||
int16_t yDst,
|
||||
uint16_t width,
|
||||
uint16_t height);
|
||||
|
||||
void
|
||||
fbCompositeSolidMask_nx8888x8888Csse2 (pixman_op_t op,
|
||||
pixman_image_t * pSrc,
|
||||
pixman_image_t * pMask,
|
||||
pixman_image_t * pDst,
|
||||
int16_t xSrc,
|
||||
int16_t ySrc,
|
||||
int16_t xMask,
|
||||
int16_t yMask,
|
||||
int16_t xDst,
|
||||
int16_t yDst,
|
||||
uint16_t width,
|
||||
uint16_t height);
|
||||
|
||||
void
|
||||
fbCompositeSrc_8888x8x8888sse2 (pixman_op_t op,
|
||||
pixman_image_t * pSrc,
|
||||
pixman_image_t * pMask,
|
||||
pixman_image_t * pDst,
|
||||
int16_t xSrc,
|
||||
int16_t ySrc,
|
||||
int16_t xMask,
|
||||
int16_t yMask,
|
||||
int16_t xDst,
|
||||
int16_t yDst,
|
||||
uint16_t width,
|
||||
uint16_t height);
|
||||
|
||||
void
|
||||
fbCompositeSrc_x888xnx8888sse2 (pixman_op_t op,
|
||||
pixman_image_t * pSrc,
|
||||
pixman_image_t * pMask,
|
||||
pixman_image_t * pDst,
|
||||
int16_t xSrc,
|
||||
int16_t ySrc,
|
||||
int16_t xMask,
|
||||
int16_t yMask,
|
||||
int16_t xDst,
|
||||
int16_t yDst,
|
||||
uint16_t width,
|
||||
uint16_t height);
|
||||
|
||||
void
|
||||
fbCompositeSrc_8888x8888sse2 (pixman_op_t op,
|
||||
pixman_image_t * pSrc,
|
||||
pixman_image_t * pMask,
|
||||
pixman_image_t * pDst,
|
||||
int16_t xSrc,
|
||||
int16_t ySrc,
|
||||
int16_t xMask,
|
||||
int16_t yMask,
|
||||
int16_t xDst,
|
||||
int16_t yDst,
|
||||
uint16_t width,
|
||||
uint16_t height);
|
||||
|
||||
void
|
||||
fbCompositeSrc_8888x0565sse2 (pixman_op_t op,
|
||||
pixman_image_t * pSrc,
|
||||
pixman_image_t * pMask,
|
||||
pixman_image_t * pDst,
|
||||
int16_t xSrc,
|
||||
int16_t ySrc,
|
||||
int16_t xMask,
|
||||
int16_t yMask,
|
||||
int16_t xDst,
|
||||
int16_t yDst,
|
||||
uint16_t width,
|
||||
uint16_t height);
|
||||
|
||||
void
|
||||
fbCompositeSolidMask_nx8x8888sse2 (pixman_op_t op,
|
||||
pixman_image_t * pSrc,
|
||||
pixman_image_t * pMask,
|
||||
pixman_image_t * pDst,
|
||||
int16_t xSrc,
|
||||
int16_t ySrc,
|
||||
int16_t xMask,
|
||||
int16_t yMask,
|
||||
int16_t xDst,
|
||||
int16_t yDst,
|
||||
uint16_t width,
|
||||
uint16_t height);
|
||||
|
||||
void
|
||||
fbCompositeSolidMaskSrc_nx8x8888sse2 (pixman_op_t op,
|
||||
pixman_image_t * pSrc,
|
||||
pixman_image_t * pMask,
|
||||
pixman_image_t * pDst,
|
||||
int16_t xSrc,
|
||||
int16_t ySrc,
|
||||
int16_t xMask,
|
||||
int16_t yMask,
|
||||
int16_t xDst,
|
||||
int16_t yDst,
|
||||
uint16_t width,
|
||||
uint16_t height);
|
||||
|
||||
void
|
||||
fbCompositeSolidMask_nx8x0565sse2 (pixman_op_t op,
|
||||
pixman_image_t * pSrc,
|
||||
pixman_image_t * pMask,
|
||||
pixman_image_t * pDst,
|
||||
int16_t xSrc,
|
||||
int16_t ySrc,
|
||||
int16_t xMask,
|
||||
int16_t yMask,
|
||||
int16_t xDst,
|
||||
int16_t yDst,
|
||||
uint16_t width,
|
||||
uint16_t height);
|
||||
|
||||
void
|
||||
fbCompositeSrc_8888RevNPx0565sse2 (pixman_op_t op,
|
||||
pixman_image_t * pSrc,
|
||||
pixman_image_t * pMask,
|
||||
pixman_image_t * pDst,
|
||||
int16_t xSrc,
|
||||
int16_t ySrc,
|
||||
int16_t xMask,
|
||||
int16_t yMask,
|
||||
int16_t xDst,
|
||||
int16_t yDst,
|
||||
uint16_t width,
|
||||
uint16_t height);
|
||||
|
||||
void
|
||||
fbCompositeSrc_8888RevNPx8888sse2 (pixman_op_t op,
|
||||
pixman_image_t * pSrc,
|
||||
pixman_image_t * pMask,
|
||||
pixman_image_t * pDst,
|
||||
int16_t xSrc,
|
||||
int16_t ySrc,
|
||||
int16_t xMask,
|
||||
int16_t yMask,
|
||||
int16_t xDst,
|
||||
int16_t yDst,
|
||||
uint16_t width,
|
||||
uint16_t height);
|
||||
|
||||
void
|
||||
fbCompositeSolidMask_nx8888x0565Csse2 (pixman_op_t op,
|
||||
pixman_image_t * pSrc,
|
||||
pixman_image_t * pMask,
|
||||
pixman_image_t * pDst,
|
||||
int16_t xSrc,
|
||||
int16_t ySrc,
|
||||
int16_t xMask,
|
||||
int16_t yMask,
|
||||
int16_t xDst,
|
||||
int16_t yDst,
|
||||
uint16_t width,
|
||||
uint16_t height);
|
||||
|
||||
void
|
||||
fbCompositeIn_nx8x8sse2 (pixman_op_t op,
|
||||
pixman_image_t * pSrc,
|
||||
pixman_image_t * pMask,
|
||||
pixman_image_t * pDst,
|
||||
int16_t xSrc,
|
||||
int16_t ySrc,
|
||||
int16_t xMask,
|
||||
int16_t yMask,
|
||||
int16_t xDst,
|
||||
int16_t yDst,
|
||||
uint16_t width,
|
||||
uint16_t height);
|
||||
|
||||
void
|
||||
fbCompositeIn_8x8sse2 (pixman_op_t op,
|
||||
pixman_image_t * pSrc,
|
||||
pixman_image_t * pMask,
|
||||
pixman_image_t * pDst,
|
||||
int16_t xSrc,
|
||||
int16_t ySrc,
|
||||
int16_t xMask,
|
||||
int16_t yMask,
|
||||
int16_t xDst,
|
||||
int16_t yDst,
|
||||
uint16_t width,
|
||||
uint16_t height);
|
||||
|
||||
void
|
||||
fbCompositeSrcAdd_8888x8x8sse2 (pixman_op_t op,
|
||||
pixman_image_t * pSrc,
|
||||
pixman_image_t * pMask,
|
||||
pixman_image_t * pDst,
|
||||
int16_t xSrc,
|
||||
int16_t ySrc,
|
||||
int16_t xMask,
|
||||
int16_t yMask,
|
||||
int16_t xDst,
|
||||
int16_t yDst,
|
||||
uint16_t width,
|
||||
uint16_t height);
|
||||
|
||||
|
||||
void
|
||||
fbCompositeSrcAdd_8000x8000sse2 (pixman_op_t op,
|
||||
pixman_image_t * pSrc,
|
||||
pixman_image_t * pMask,
|
||||
pixman_image_t * pDst,
|
||||
int16_t xSrc,
|
||||
int16_t ySrc,
|
||||
int16_t xMask,
|
||||
int16_t yMask,
|
||||
int16_t xDst,
|
||||
int16_t yDst,
|
||||
uint16_t width,
|
||||
uint16_t height);
|
||||
|
||||
void
|
||||
fbCompositeSrcAdd_8888x8888sse2 (pixman_op_t op,
|
||||
pixman_image_t * pSrc,
|
||||
pixman_image_t * pMask,
|
||||
pixman_image_t * pDst,
|
||||
int16_t xSrc,
|
||||
int16_t ySrc,
|
||||
int16_t xMask,
|
||||
int16_t yMask,
|
||||
int16_t xDst,
|
||||
int16_t yDst,
|
||||
uint16_t width,
|
||||
uint16_t height);
|
||||
|
||||
void
|
||||
fbCompositeCopyAreasse2 (pixman_op_t op,
|
||||
pixman_image_t * pSrc,
|
||||
pixman_image_t * pMask,
|
||||
pixman_image_t * pDst,
|
||||
int16_t xSrc,
|
||||
int16_t ySrc,
|
||||
int16_t xMask,
|
||||
int16_t yMask,
|
||||
int16_t xDst,
|
||||
int16_t yDst,
|
||||
uint16_t width,
|
||||
uint16_t height);
|
||||
|
||||
void
|
||||
fbCompositeOver_x888x8x8888sse2 (pixman_op_t op,
|
||||
pixman_image_t * pSrc,
|
||||
pixman_image_t * pMask,
|
||||
pixman_image_t * pDst,
|
||||
int16_t xSrc,
|
||||
int16_t ySrc,
|
||||
int16_t xMask,
|
||||
int16_t yMask,
|
||||
int16_t xDst,
|
||||
int16_t yDst,
|
||||
uint16_t width,
|
||||
uint16_t height);
|
||||
|
||||
#endif /* USE_SSE2 */
|
||||
|
||||
#endif /* _PIXMAN_SSE_H_ */
|
||||
66
uppdev/plugin/pixman/lib/pixman-timer.c
Normal file
66
uppdev/plugin/pixman/lib/pixman-timer.c
Normal file
|
|
@ -0,0 +1,66 @@
|
|||
/*
|
||||
* Copyright © 2007 Red Hat, Inc.
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and its
|
||||
* documentation for any purpose is hereby granted without fee, provided that
|
||||
* the above copyright notice appear in all copies and that both that
|
||||
* copyright notice and this permission notice appear in supporting
|
||||
* documentation, and that the name of Red Hat not be used in advertising or
|
||||
* publicity pertaining to distribution of the software without specific,
|
||||
* written prior permission. Red Hat makes no representations about the
|
||||
* suitability of this software for any purpose. It is provided "as is"
|
||||
* without express or implied warranty.
|
||||
*
|
||||
* RED HAT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL RED HAT
|
||||
* BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
|
||||
* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
|
||||
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include "pixman-private.h"
|
||||
|
||||
#ifdef PIXMAN_TIMER
|
||||
|
||||
static PixmanTimer *timers;
|
||||
|
||||
static void
|
||||
dump_timers (void)
|
||||
{
|
||||
PixmanTimer *timer;
|
||||
|
||||
for (timer = timers; timer != NULL; timer = timer->next)
|
||||
{
|
||||
printf ("%s: total: %llu n: %llu avg: %f\n",
|
||||
timer->name,
|
||||
timer->total,
|
||||
timer->n_times,
|
||||
timer->total / (double)timer->n_times);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
pixman_timer_register (PixmanTimer *timer)
|
||||
{
|
||||
static int initialized;
|
||||
|
||||
int atexit(void (*function)(void));
|
||||
|
||||
if (!initialized)
|
||||
{
|
||||
atexit (dump_timers);
|
||||
initialized = 1;
|
||||
}
|
||||
|
||||
timer->next = timers;
|
||||
timers = timer;
|
||||
}
|
||||
|
||||
#endif
|
||||
3
uppdev/plugin/pixman/lib/pixman-transformed-accessors.c
Normal file
3
uppdev/plugin/pixman/lib/pixman-transformed-accessors.c
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
#define PIXMAN_FB_ACCESSORS
|
||||
|
||||
#include "pixman-transformed.c"
|
||||
615
uppdev/plugin/pixman/lib/pixman-transformed.c
Normal file
615
uppdev/plugin/pixman/lib/pixman-transformed.c
Normal file
|
|
@ -0,0 +1,615 @@
|
|||
/*
|
||||
*
|
||||
* Copyright © 2000 Keith Packard, member of The XFree86 Project, Inc.
|
||||
* 2005 Lars Knoll & Zack Rusin, Trolltech
|
||||
* 2008 Aaron Plattner, NVIDIA Corporation
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and its
|
||||
* documentation for any purpose is hereby granted without fee, provided that
|
||||
* the above copyright notice appear in all copies and that both that
|
||||
* copyright notice and this permission notice appear in supporting
|
||||
* documentation, and that the name of Keith Packard not be used in
|
||||
* advertising or publicity pertaining to distribution of the software without
|
||||
* specific, written prior permission. Keith Packard makes no
|
||||
* representations about the suitability of this software for any purpose. It
|
||||
* is provided "as is" without express or implied warranty.
|
||||
*
|
||||
* THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
|
||||
* SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
* FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
* SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
|
||||
* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
|
||||
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "pixman-private.h"
|
||||
|
||||
#define Alpha(x) ((x) >> 24)
|
||||
#define Red(x) (((x) >> 16) & 0xff)
|
||||
#define Green(x) (((x) >> 8) & 0xff)
|
||||
#define Blue(x) ((x) & 0xff)
|
||||
|
||||
#define Alpha64(x) ((x) >> 48)
|
||||
#define Red64(x) (((x) >> 32) & 0xffff)
|
||||
#define Green64(x) (((x) >> 16) & 0xffff)
|
||||
#define Blue64(x) ((x) & 0xffff)
|
||||
|
||||
/*
|
||||
* Fetch from region strategies
|
||||
*/
|
||||
typedef FASTCALL uint32_t (*fetchFromRegionProc)(bits_image_t *pict, int x, int y, uint32_t *buffer, fetchPixelProc32 fetch, pixman_box32_t *box);
|
||||
|
||||
/*
|
||||
* There are two properties we can make use of when fetching pixels
|
||||
*
|
||||
* (a) Is the source clip just the image itself?
|
||||
*
|
||||
* (b) Do we know the coordinates of the pixel to fetch are
|
||||
* within the image boundaries;
|
||||
*
|
||||
* Source clips are almost never used, so the important case to optimize
|
||||
* for is when src_clip is false. Since inside_bounds is statically known,
|
||||
* the last part of the if statement will normally be optimized away.
|
||||
*/
|
||||
static force_inline uint32_t
|
||||
do_fetch (bits_image_t *pict, int x, int y, fetchPixelProc32 fetch,
|
||||
pixman_bool_t src_clip,
|
||||
pixman_bool_t inside_bounds)
|
||||
{
|
||||
if (src_clip)
|
||||
{
|
||||
if (pixman_region32_contains_point (pict->common.src_clip, x, y,NULL))
|
||||
return fetch (pict, x, y);
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
else if (inside_bounds)
|
||||
{
|
||||
return fetch (pict, x, y);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (x >= 0 && x < pict->width && y >= 0 && y < pict->height)
|
||||
return fetch (pict, x, y);
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Fetching Algorithms
|
||||
*/
|
||||
static inline uint32_t
|
||||
fetch_nearest (bits_image_t *pict,
|
||||
fetchPixelProc32 fetch,
|
||||
pixman_bool_t affine,
|
||||
pixman_repeat_t repeat,
|
||||
pixman_bool_t has_src_clip,
|
||||
const pixman_vector_t *v)
|
||||
{
|
||||
if (!v->vector[2])
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
int x, y;
|
||||
pixman_bool_t inside_bounds;
|
||||
|
||||
if (!affine)
|
||||
{
|
||||
x = DIV(v->vector[0], v->vector[2]);
|
||||
y = DIV(v->vector[1], v->vector[2]);
|
||||
}
|
||||
else
|
||||
{
|
||||
x = v->vector[0]>>16;
|
||||
y = v->vector[1]>>16;
|
||||
}
|
||||
|
||||
switch (repeat)
|
||||
{
|
||||
case PIXMAN_REPEAT_NORMAL:
|
||||
x = MOD (x, pict->width);
|
||||
y = MOD (y, pict->height);
|
||||
inside_bounds = TRUE;
|
||||
break;
|
||||
|
||||
case PIXMAN_REPEAT_PAD:
|
||||
x = CLIP (x, 0, pict->width-1);
|
||||
y = CLIP (y, 0, pict->height-1);
|
||||
inside_bounds = TRUE;
|
||||
break;
|
||||
|
||||
case PIXMAN_REPEAT_REFLECT: /* FIXME: this should be implemented for images */
|
||||
case PIXMAN_REPEAT_NONE:
|
||||
inside_bounds = FALSE;
|
||||
break;
|
||||
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
|
||||
return do_fetch (pict, x, y, fetch, has_src_clip, inside_bounds);
|
||||
}
|
||||
}
|
||||
|
||||
static inline uint32_t
|
||||
fetch_bilinear (bits_image_t *pict,
|
||||
fetchPixelProc32 fetch,
|
||||
pixman_bool_t affine,
|
||||
pixman_repeat_t repeat,
|
||||
pixman_bool_t has_src_clip,
|
||||
const pixman_vector_t *v)
|
||||
{
|
||||
if (!v->vector[2])
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
int x1, x2, y1, y2, distx, idistx, disty, idisty;
|
||||
uint32_t tl, tr, bl, br, r;
|
||||
uint32_t ft, fb;
|
||||
pixman_bool_t inside_bounds;
|
||||
|
||||
if (!affine)
|
||||
{
|
||||
pixman_fixed_48_16_t div;
|
||||
div = ((pixman_fixed_48_16_t)v->vector[0] << 16)/v->vector[2];
|
||||
x1 = div >> 16;
|
||||
distx = ((pixman_fixed_t)div >> 8) & 0xff;
|
||||
div = ((pixman_fixed_48_16_t)v->vector[1] << 16)/v->vector[2];
|
||||
y1 = div >> 16;
|
||||
disty = ((pixman_fixed_t)div >> 8) & 0xff;
|
||||
}
|
||||
else
|
||||
{
|
||||
x1 = v->vector[0] >> 16;
|
||||
distx = (v->vector[0] >> 8) & 0xff;
|
||||
y1 = v->vector[1] >> 16;
|
||||
disty = (v->vector[1] >> 8) & 0xff;
|
||||
}
|
||||
x2 = x1 + 1;
|
||||
y2 = y1 + 1;
|
||||
|
||||
idistx = 256 - distx;
|
||||
idisty = 256 - disty;
|
||||
|
||||
switch (repeat)
|
||||
{
|
||||
case PIXMAN_REPEAT_NORMAL:
|
||||
x1 = MOD (x1, pict->width);
|
||||
x2 = MOD (x2, pict->width);
|
||||
y1 = MOD (y1, pict->height);
|
||||
y2 = MOD (y2, pict->height);
|
||||
inside_bounds = TRUE;
|
||||
break;
|
||||
|
||||
case PIXMAN_REPEAT_PAD:
|
||||
x1 = CLIP (x1, 0, pict->width-1);
|
||||
x2 = CLIP (x2, 0, pict->width-1);
|
||||
y1 = CLIP (y1, 0, pict->height-1);
|
||||
y2 = CLIP (y2, 0, pict->height-1);
|
||||
inside_bounds = TRUE;
|
||||
break;
|
||||
|
||||
case PIXMAN_REPEAT_REFLECT: /* FIXME: this should be implemented for images */
|
||||
case PIXMAN_REPEAT_NONE:
|
||||
inside_bounds = FALSE;
|
||||
break;
|
||||
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
|
||||
tl = do_fetch(pict, x1, y1, fetch, has_src_clip, inside_bounds);
|
||||
tr = do_fetch(pict, x2, y1, fetch, has_src_clip, inside_bounds);
|
||||
bl = do_fetch(pict, x1, y2, fetch, has_src_clip, inside_bounds);
|
||||
br = do_fetch(pict, x2, y2, fetch, has_src_clip, inside_bounds);
|
||||
|
||||
ft = FbGet8(tl,0) * idistx + FbGet8(tr,0) * distx;
|
||||
fb = FbGet8(bl,0) * idistx + FbGet8(br,0) * distx;
|
||||
r = (((ft * idisty + fb * disty) >> 16) & 0xff);
|
||||
ft = FbGet8(tl,8) * idistx + FbGet8(tr,8) * distx;
|
||||
fb = FbGet8(bl,8) * idistx + FbGet8(br,8) * distx;
|
||||
r |= (((ft * idisty + fb * disty) >> 8) & 0xff00);
|
||||
ft = FbGet8(tl,16) * idistx + FbGet8(tr,16) * distx;
|
||||
fb = FbGet8(bl,16) * idistx + FbGet8(br,16) * distx;
|
||||
r |= (((ft * idisty + fb * disty)) & 0xff0000);
|
||||
ft = FbGet8(tl,24) * idistx + FbGet8(tr,24) * distx;
|
||||
fb = FbGet8(bl,24) * idistx + FbGet8(br,24) * distx;
|
||||
r |= (((ft * idisty + fb * disty) << 8) & 0xff000000);
|
||||
|
||||
return r;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
fbFetchTransformed_Convolution(bits_image_t * pict, int width, uint32_t *buffer, uint32_t *mask, uint32_t maskBits,
|
||||
pixman_bool_t affine, pixman_vector_t v, pixman_vector_t unit)
|
||||
{
|
||||
fetchPixelProc32 fetch;
|
||||
int i;
|
||||
|
||||
pixman_fixed_t *params = pict->common.filter_params;
|
||||
int32_t cwidth = pixman_fixed_to_int(params[0]);
|
||||
int32_t cheight = pixman_fixed_to_int(params[1]);
|
||||
int xoff = (params[0] - pixman_fixed_1) >> 1;
|
||||
int yoff = (params[1] - pixman_fixed_1) >> 1;
|
||||
fetch = ACCESS(pixman_fetchPixelProcForPicture32)(pict);
|
||||
|
||||
params += 2;
|
||||
for (i = 0; i < width; ++i) {
|
||||
if (!mask || mask[i] & maskBits)
|
||||
{
|
||||
if (!v.vector[2]) {
|
||||
*(buffer + i) = 0;
|
||||
} else {
|
||||
int x1, x2, y1, y2, x, y;
|
||||
int32_t srtot, sgtot, sbtot, satot;
|
||||
pixman_fixed_t *p = params;
|
||||
|
||||
if (!affine) {
|
||||
pixman_fixed_48_16_t tmp;
|
||||
tmp = ((pixman_fixed_48_16_t)v.vector[0] << 16)/v.vector[2] - xoff;
|
||||
x1 = pixman_fixed_to_int(tmp);
|
||||
tmp = ((pixman_fixed_48_16_t)v.vector[1] << 16)/v.vector[2] - yoff;
|
||||
y1 = pixman_fixed_to_int(tmp);
|
||||
} else {
|
||||
x1 = pixman_fixed_to_int(v.vector[0] - xoff);
|
||||
y1 = pixman_fixed_to_int(v.vector[1] - yoff);
|
||||
}
|
||||
x2 = x1 + cwidth;
|
||||
y2 = y1 + cheight;
|
||||
|
||||
srtot = sgtot = sbtot = satot = 0;
|
||||
|
||||
for (y = y1; y < y2; y++) {
|
||||
int ty;
|
||||
switch (pict->common.repeat) {
|
||||
case PIXMAN_REPEAT_NORMAL:
|
||||
ty = MOD (y, pict->height);
|
||||
break;
|
||||
case PIXMAN_REPEAT_PAD:
|
||||
ty = CLIP (y, 0, pict->height-1);
|
||||
break;
|
||||
default:
|
||||
ty = y;
|
||||
}
|
||||
for (x = x1; x < x2; x++) {
|
||||
if (*p) {
|
||||
int tx;
|
||||
switch (pict->common.repeat) {
|
||||
case PIXMAN_REPEAT_NORMAL:
|
||||
tx = MOD (x, pict->width);
|
||||
break;
|
||||
case PIXMAN_REPEAT_PAD:
|
||||
tx = CLIP (x, 0, pict->width-1);
|
||||
break;
|
||||
default:
|
||||
tx = x;
|
||||
}
|
||||
if (pixman_region32_contains_point (pict->common.src_clip, tx, ty, NULL)) {
|
||||
uint32_t c = fetch(pict, tx, ty);
|
||||
|
||||
srtot += Red(c) * *p;
|
||||
sgtot += Green(c) * *p;
|
||||
sbtot += Blue(c) * *p;
|
||||
satot += Alpha(c) * *p;
|
||||
}
|
||||
}
|
||||
p++;
|
||||
}
|
||||
}
|
||||
|
||||
satot >>= 16;
|
||||
srtot >>= 16;
|
||||
sgtot >>= 16;
|
||||
sbtot >>= 16;
|
||||
|
||||
if (satot < 0) satot = 0; else if (satot > 0xff) satot = 0xff;
|
||||
if (srtot < 0) srtot = 0; else if (srtot > 0xff) srtot = 0xff;
|
||||
if (sgtot < 0) sgtot = 0; else if (sgtot > 0xff) sgtot = 0xff;
|
||||
if (sbtot < 0) sbtot = 0; else if (sbtot > 0xff) sbtot = 0xff;
|
||||
|
||||
*(buffer + i) = ((satot << 24) |
|
||||
(srtot << 16) |
|
||||
(sgtot << 8) |
|
||||
(sbtot ));
|
||||
}
|
||||
}
|
||||
v.vector[0] += unit.vector[0];
|
||||
v.vector[1] += unit.vector[1];
|
||||
v.vector[2] += unit.vector[2];
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
adjust (pixman_vector_t *v, pixman_vector_t *u, pixman_fixed_t adjustment)
|
||||
{
|
||||
int delta_v = (adjustment * v->vector[2]) >> 16;
|
||||
int delta_u = (adjustment * u->vector[2]) >> 16;
|
||||
|
||||
v->vector[0] += delta_v;
|
||||
v->vector[1] += delta_v;
|
||||
|
||||
u->vector[0] += delta_u;
|
||||
u->vector[1] += delta_u;
|
||||
}
|
||||
|
||||
void
|
||||
ACCESS(fbFetchTransformed)(bits_image_t * pict, int x, int y, int width,
|
||||
uint32_t *buffer, uint32_t *mask, uint32_t maskBits)
|
||||
{
|
||||
uint32_t *bits;
|
||||
int32_t stride;
|
||||
pixman_vector_t v;
|
||||
pixman_vector_t unit;
|
||||
pixman_bool_t affine = TRUE;
|
||||
|
||||
bits = pict->bits;
|
||||
stride = pict->rowstride;
|
||||
|
||||
/* reference point is the center of the pixel */
|
||||
v.vector[0] = pixman_int_to_fixed(x) + pixman_fixed_1 / 2;
|
||||
v.vector[1] = pixman_int_to_fixed(y) + pixman_fixed_1 / 2;
|
||||
v.vector[2] = pixman_fixed_1;
|
||||
|
||||
/* when using convolution filters or PIXMAN_REPEAT_PAD one might get here without a transform */
|
||||
if (pict->common.transform)
|
||||
{
|
||||
if (!pixman_transform_point_3d (pict->common.transform, &v))
|
||||
return;
|
||||
unit.vector[0] = pict->common.transform->matrix[0][0];
|
||||
unit.vector[1] = pict->common.transform->matrix[1][0];
|
||||
unit.vector[2] = pict->common.transform->matrix[2][0];
|
||||
|
||||
affine = (v.vector[2] == pixman_fixed_1 && unit.vector[2] == 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
unit.vector[0] = pixman_fixed_1;
|
||||
unit.vector[1] = 0;
|
||||
unit.vector[2] = 0;
|
||||
}
|
||||
|
||||
/* This allows filtering code to pretend that pixels are located at integer coordinates */
|
||||
if (pict->common.filter == PIXMAN_FILTER_NEAREST || pict->common.filter == PIXMAN_FILTER_FAST)
|
||||
{
|
||||
fetchPixelProc32 fetch;
|
||||
pixman_bool_t src_clip;
|
||||
int i;
|
||||
|
||||
/* Round down to closest integer, ensuring that 0.5 rounds to 0, not 1 */
|
||||
adjust (&v, &unit, - pixman_fixed_e);
|
||||
|
||||
fetch = ACCESS(pixman_fetchPixelProcForPicture32)(pict);
|
||||
|
||||
src_clip = pict->common.src_clip != &(pict->common.full_region);
|
||||
|
||||
for ( i = 0; i < width; ++i)
|
||||
{
|
||||
if (!mask || mask[i] & maskBits)
|
||||
*(buffer + i) = fetch_nearest (pict, fetch, affine, pict->common.repeat, src_clip, &v);
|
||||
|
||||
v.vector[0] += unit.vector[0];
|
||||
v.vector[1] += unit.vector[1];
|
||||
v.vector[2] += unit.vector[2];
|
||||
}
|
||||
}
|
||||
else if (pict->common.filter == PIXMAN_FILTER_BILINEAR ||
|
||||
pict->common.filter == PIXMAN_FILTER_GOOD ||
|
||||
pict->common.filter == PIXMAN_FILTER_BEST)
|
||||
{
|
||||
pixman_bool_t src_clip;
|
||||
fetchPixelProc32 fetch;
|
||||
int i;
|
||||
|
||||
/* Let the bilinear code pretend that pixels fall on integer coordinaters */
|
||||
adjust (&v, &unit, -(pixman_fixed_1 / 2));
|
||||
|
||||
fetch = ACCESS(pixman_fetchPixelProcForPicture32)(pict);
|
||||
src_clip = pict->common.src_clip != &(pict->common.full_region);
|
||||
|
||||
for (i = 0; i < width; ++i)
|
||||
{
|
||||
if (!mask || mask[i] & maskBits)
|
||||
*(buffer + i) = fetch_bilinear (pict, fetch, affine, pict->common.repeat, src_clip, &v);
|
||||
|
||||
v.vector[0] += unit.vector[0];
|
||||
v.vector[1] += unit.vector[1];
|
||||
v.vector[2] += unit.vector[2];
|
||||
}
|
||||
}
|
||||
else if (pict->common.filter == PIXMAN_FILTER_CONVOLUTION)
|
||||
{
|
||||
/* Round to closest integer, ensuring that 0.5 rounds to 0, not 1 */
|
||||
adjust (&v, &unit, - pixman_fixed_e);
|
||||
|
||||
fbFetchTransformed_Convolution(pict, width, buffer, mask, maskBits, affine, v, unit);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
ACCESS(fbFetchTransformed64)(bits_image_t * pict, int x, int y, int width,
|
||||
uint64_t *buffer, uint64_t *mask, uint32_t maskBits)
|
||||
{
|
||||
// TODO: Don't lose precision for wide pictures!
|
||||
uint32_t *mask8 = NULL;
|
||||
|
||||
// Contract the mask image, if one exists, so that the 32-bit fetch function
|
||||
// can use it.
|
||||
if (mask) {
|
||||
mask8 = pixman_malloc_ab(width, sizeof(uint32_t));
|
||||
pixman_contract(mask8, mask, width);
|
||||
}
|
||||
|
||||
// Fetch the image into the first half of buffer.
|
||||
ACCESS(fbFetchTransformed)(pict, x, y, width, (uint32_t*)buffer, mask8,
|
||||
maskBits);
|
||||
|
||||
// Expand from 32bpp to 64bpp in place.
|
||||
pixman_expand(buffer, (uint32_t*)buffer, PIXMAN_a8r8g8b8, width);
|
||||
|
||||
free(mask8);
|
||||
}
|
||||
|
||||
#define SCANLINE_BUFFER_LENGTH 2048
|
||||
|
||||
void
|
||||
ACCESS(fbFetchExternalAlpha)(bits_image_t * pict, int x, int y, int width,
|
||||
uint32_t *buffer, uint32_t *mask,
|
||||
uint32_t maskBits)
|
||||
{
|
||||
int i;
|
||||
uint32_t _alpha_buffer[SCANLINE_BUFFER_LENGTH];
|
||||
uint32_t *alpha_buffer = _alpha_buffer;
|
||||
|
||||
if (!pict->common.alpha_map) {
|
||||
ACCESS(fbFetchTransformed) (pict, x, y, width, buffer, mask, maskBits);
|
||||
return;
|
||||
}
|
||||
if (width > SCANLINE_BUFFER_LENGTH)
|
||||
alpha_buffer = (uint32_t *) pixman_malloc_ab (width, sizeof(uint32_t));
|
||||
|
||||
ACCESS(fbFetchTransformed)(pict, x, y, width, buffer, mask, maskBits);
|
||||
ACCESS(fbFetchTransformed)((bits_image_t *)pict->common.alpha_map, x - pict->common.alpha_origin.x,
|
||||
y - pict->common.alpha_origin.y, width,
|
||||
alpha_buffer, mask, maskBits);
|
||||
for (i = 0; i < width; ++i) {
|
||||
if (!mask || mask[i] & maskBits)
|
||||
{
|
||||
int a = alpha_buffer[i]>>24;
|
||||
*(buffer + i) = (a << 24)
|
||||
| (div_255(Red(*(buffer + i)) * a) << 16)
|
||||
| (div_255(Green(*(buffer + i)) * a) << 8)
|
||||
| (div_255(Blue(*(buffer + i)) * a));
|
||||
}
|
||||
}
|
||||
|
||||
if (alpha_buffer != _alpha_buffer)
|
||||
free(alpha_buffer);
|
||||
}
|
||||
|
||||
void
|
||||
ACCESS(fbFetchExternalAlpha64)(bits_image_t * pict, int x, int y, int width,
|
||||
uint64_t *buffer, uint64_t *mask,
|
||||
uint32_t maskBits)
|
||||
{
|
||||
int i;
|
||||
uint64_t _alpha_buffer[SCANLINE_BUFFER_LENGTH];
|
||||
uint64_t *alpha_buffer = _alpha_buffer;
|
||||
uint64_t maskBits64;
|
||||
|
||||
if (!pict->common.alpha_map) {
|
||||
ACCESS(fbFetchTransformed64) (pict, x, y, width, buffer, mask, maskBits);
|
||||
return;
|
||||
}
|
||||
if (width > SCANLINE_BUFFER_LENGTH)
|
||||
alpha_buffer = (uint64_t *) pixman_malloc_ab (width, sizeof(uint64_t));
|
||||
|
||||
ACCESS(fbFetchTransformed64)(pict, x, y, width, buffer, mask, maskBits);
|
||||
ACCESS(fbFetchTransformed64)((bits_image_t *)pict->common.alpha_map, x - pict->common.alpha_origin.x,
|
||||
y - pict->common.alpha_origin.y, width,
|
||||
alpha_buffer, mask, maskBits);
|
||||
|
||||
pixman_expand(&maskBits64, &maskBits, PIXMAN_a8r8g8b8, 1);
|
||||
|
||||
for (i = 0; i < width; ++i) {
|
||||
if (!mask || mask[i] & maskBits64)
|
||||
{
|
||||
int64_t a = alpha_buffer[i]>>48;
|
||||
*(buffer + i) = (a << 48)
|
||||
| (div_65535(Red64(*(buffer + i)) * a) << 32)
|
||||
| (div_65535(Green64(*(buffer + i)) * a) << 16)
|
||||
| (div_65535(Blue64(*(buffer + i)) * a));
|
||||
}
|
||||
}
|
||||
|
||||
if (alpha_buffer != _alpha_buffer)
|
||||
free(alpha_buffer);
|
||||
}
|
||||
|
||||
void
|
||||
ACCESS(fbStoreExternalAlpha)(bits_image_t * pict, int x, int y, int width,
|
||||
uint32_t *buffer)
|
||||
{
|
||||
uint32_t *bits, *alpha_bits;
|
||||
int32_t stride, astride;
|
||||
int ax, ay;
|
||||
storeProc32 store;
|
||||
storeProc32 astore;
|
||||
const pixman_indexed_t * indexed = pict->indexed;
|
||||
const pixman_indexed_t * aindexed;
|
||||
|
||||
if (!pict->common.alpha_map) {
|
||||
// XXX[AGP]: This should never happen!
|
||||
// fbStore(pict, x, y, width, buffer);
|
||||
abort();
|
||||
return;
|
||||
}
|
||||
|
||||
store = ACCESS(pixman_storeProcForPicture32)(pict);
|
||||
astore = ACCESS(pixman_storeProcForPicture32)(pict->common.alpha_map);
|
||||
aindexed = pict->common.alpha_map->indexed;
|
||||
|
||||
ax = x;
|
||||
ay = y;
|
||||
|
||||
bits = pict->bits;
|
||||
stride = pict->rowstride;
|
||||
|
||||
alpha_bits = pict->common.alpha_map->bits;
|
||||
astride = pict->common.alpha_map->rowstride;
|
||||
|
||||
bits += y*stride;
|
||||
alpha_bits += (ay - pict->common.alpha_origin.y)*astride;
|
||||
|
||||
|
||||
store((pixman_image_t *)pict, bits, buffer, x, width, indexed);
|
||||
astore((pixman_image_t *)pict->common.alpha_map,
|
||||
alpha_bits, buffer, ax - pict->common.alpha_origin.x, width, aindexed);
|
||||
}
|
||||
|
||||
void
|
||||
ACCESS(fbStoreExternalAlpha64)(bits_image_t * pict, int x, int y, int width,
|
||||
uint64_t *buffer)
|
||||
{
|
||||
uint32_t *bits, *alpha_bits;
|
||||
int32_t stride, astride;
|
||||
int ax, ay;
|
||||
storeProc64 store;
|
||||
storeProc64 astore;
|
||||
const pixman_indexed_t * indexed = pict->indexed;
|
||||
const pixman_indexed_t * aindexed;
|
||||
|
||||
store = ACCESS(pixman_storeProcForPicture64)(pict);
|
||||
astore = ACCESS(pixman_storeProcForPicture64)(pict->common.alpha_map);
|
||||
aindexed = pict->common.alpha_map->indexed;
|
||||
|
||||
ax = x;
|
||||
ay = y;
|
||||
|
||||
bits = pict->bits;
|
||||
stride = pict->rowstride;
|
||||
|
||||
alpha_bits = pict->common.alpha_map->bits;
|
||||
astride = pict->common.alpha_map->rowstride;
|
||||
|
||||
bits += y*stride;
|
||||
alpha_bits += (ay - pict->common.alpha_origin.y)*astride;
|
||||
|
||||
|
||||
store((pixman_image_t *)pict, bits, buffer, x, width, indexed);
|
||||
astore((pixman_image_t *)pict->common.alpha_map,
|
||||
alpha_bits, buffer, ax - pict->common.alpha_origin.x, width, aindexed);
|
||||
}
|
||||
284
uppdev/plugin/pixman/lib/pixman-trap.c
Normal file
284
uppdev/plugin/pixman/lib/pixman-trap.c
Normal file
|
|
@ -0,0 +1,284 @@
|
|||
/*
|
||||
* Copyright © 2004 Keith Packard
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and its
|
||||
* documentation for any purpose is hereby granted without fee, provided that
|
||||
* the above copyright notice appear in all copies and that both that
|
||||
* copyright notice and this permission notice appear in supporting
|
||||
* documentation, and that the name of Keith Packard not be used in
|
||||
* advertising or publicity pertaining to distribution of the software without
|
||||
* specific, written prior permission. Keith Packard makes no
|
||||
* representations about the suitability of this software for any purpose. It
|
||||
* is provided "as is" without express or implied warranty.
|
||||
*
|
||||
* KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
||||
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
|
||||
* EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
|
||||
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
||||
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
||||
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include "pixman-private.h"
|
||||
|
||||
typedef uint32_t FbBits;
|
||||
|
||||
PIXMAN_EXPORT void
|
||||
pixman_add_traps (pixman_image_t * image,
|
||||
int16_t x_off,
|
||||
int16_t y_off,
|
||||
int ntrap,
|
||||
pixman_trap_t *traps)
|
||||
{
|
||||
int bpp;
|
||||
int width;
|
||||
int height;
|
||||
|
||||
pixman_fixed_t x_off_fixed;
|
||||
pixman_fixed_t y_off_fixed;
|
||||
pixman_edge_t l, r;
|
||||
pixman_fixed_t t, b;
|
||||
|
||||
width = image->bits.width;
|
||||
height = image->bits.height;
|
||||
bpp = PIXMAN_FORMAT_BPP (image->bits.format);
|
||||
|
||||
x_off_fixed = pixman_int_to_fixed(x_off);
|
||||
y_off_fixed = pixman_int_to_fixed(y_off);
|
||||
|
||||
while (ntrap--)
|
||||
{
|
||||
t = traps->top.y + y_off_fixed;
|
||||
if (t < 0)
|
||||
t = 0;
|
||||
t = pixman_sample_ceil_y (t, bpp);
|
||||
|
||||
b = traps->bot.y + y_off_fixed;
|
||||
if (pixman_fixed_to_int (b) >= height)
|
||||
b = pixman_int_to_fixed (height) - 1;
|
||||
b = pixman_sample_floor_y (b, bpp);
|
||||
|
||||
if (b >= t)
|
||||
{
|
||||
/* initialize edge walkers */
|
||||
pixman_edge_init (&l, bpp, t,
|
||||
traps->top.l + x_off_fixed,
|
||||
traps->top.y + y_off_fixed,
|
||||
traps->bot.l + x_off_fixed,
|
||||
traps->bot.y + y_off_fixed);
|
||||
|
||||
pixman_edge_init (&r, bpp, t,
|
||||
traps->top.r + x_off_fixed,
|
||||
traps->top.y + y_off_fixed,
|
||||
traps->bot.r + x_off_fixed,
|
||||
traps->bot.y + y_off_fixed);
|
||||
|
||||
pixman_rasterize_edges (image, &l, &r, t, b);
|
||||
}
|
||||
traps++;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
dump_image (pixman_image_t *image,
|
||||
const char *title)
|
||||
{
|
||||
int i, j;
|
||||
|
||||
if (!image->type == BITS)
|
||||
{
|
||||
printf ("%s is not a regular image\n", title);
|
||||
}
|
||||
|
||||
if (!image->bits.format == PIXMAN_a8)
|
||||
{
|
||||
printf ("%s is not an alpha mask\n", title);
|
||||
}
|
||||
|
||||
printf ("\n\n\n%s: \n", title);
|
||||
|
||||
for (i = 0; i < image->bits.height; ++i)
|
||||
{
|
||||
uint8_t *line =
|
||||
(uint8_t *)&(image->bits.bits[i * image->bits.rowstride]);
|
||||
|
||||
for (j = 0; j < image->bits.width; ++j)
|
||||
printf ("%c", line[j]? '#' : ' ');
|
||||
|
||||
printf ("\n");
|
||||
}
|
||||
}
|
||||
|
||||
PIXMAN_EXPORT void
|
||||
pixman_add_trapezoids (pixman_image_t *image,
|
||||
int16_t x_off,
|
||||
int y_off,
|
||||
int ntraps,
|
||||
const pixman_trapezoid_t *traps)
|
||||
{
|
||||
int i;
|
||||
|
||||
#if 0
|
||||
dump_image (image, "before");
|
||||
#endif
|
||||
|
||||
for (i = 0; i < ntraps; ++i)
|
||||
{
|
||||
const pixman_trapezoid_t *trap = &(traps[i]);
|
||||
|
||||
if (!pixman_trapezoid_valid (trap))
|
||||
continue;
|
||||
|
||||
pixman_rasterize_trapezoid (image, trap, x_off, y_off);
|
||||
}
|
||||
|
||||
#if 0
|
||||
dump_image (image, "after");
|
||||
#endif
|
||||
}
|
||||
|
||||
PIXMAN_EXPORT void
|
||||
pixman_rasterize_trapezoid (pixman_image_t * image,
|
||||
const pixman_trapezoid_t *trap,
|
||||
int x_off,
|
||||
int y_off)
|
||||
{
|
||||
int bpp;
|
||||
int width;
|
||||
int height;
|
||||
|
||||
pixman_fixed_t x_off_fixed;
|
||||
pixman_fixed_t y_off_fixed;
|
||||
pixman_edge_t l, r;
|
||||
pixman_fixed_t t, b;
|
||||
|
||||
return_if_fail (image->type == BITS);
|
||||
|
||||
if (!pixman_trapezoid_valid (trap))
|
||||
return;
|
||||
|
||||
width = image->bits.width;
|
||||
height = image->bits.height;
|
||||
bpp = PIXMAN_FORMAT_BPP (image->bits.format);
|
||||
|
||||
x_off_fixed = pixman_int_to_fixed(x_off);
|
||||
y_off_fixed = pixman_int_to_fixed(y_off);
|
||||
t = trap->top + y_off_fixed;
|
||||
if (t < 0)
|
||||
t = 0;
|
||||
t = pixman_sample_ceil_y (t, bpp);
|
||||
|
||||
b = trap->bottom + y_off_fixed;
|
||||
if (pixman_fixed_to_int (b) >= height)
|
||||
b = pixman_int_to_fixed (height) - 1;
|
||||
b = pixman_sample_floor_y (b, bpp);
|
||||
|
||||
if (b >= t)
|
||||
{
|
||||
/* initialize edge walkers */
|
||||
pixman_line_fixed_edge_init (&l, bpp, t, &trap->left, x_off, y_off);
|
||||
pixman_line_fixed_edge_init (&r, bpp, t, &trap->right, x_off, y_off);
|
||||
|
||||
pixman_rasterize_edges (image, &l, &r, t, b);
|
||||
}
|
||||
}
|
||||
|
||||
#if 0
|
||||
static int
|
||||
_GreaterY (pixman_point_fixed_t *a, pixman_point_fixed_t *b)
|
||||
{
|
||||
if (a->y == b->y)
|
||||
return a->x > b->x;
|
||||
return a->y > b->y;
|
||||
}
|
||||
|
||||
/*
|
||||
* Note that the definition of this function is a bit odd because
|
||||
* of the X coordinate space (y increasing downwards).
|
||||
*/
|
||||
static int
|
||||
_Clockwise (pixman_point_fixed_t *ref, pixman_point_fixed_t *a, pixman_point_fixed_t *b)
|
||||
{
|
||||
pixman_point_fixed_t ad, bd;
|
||||
|
||||
ad.x = a->x - ref->x;
|
||||
ad.y = a->y - ref->y;
|
||||
bd.x = b->x - ref->x;
|
||||
bd.y = b->y - ref->y;
|
||||
|
||||
return ((pixman_fixed_32_32_t) bd.y * ad.x - (pixman_fixed_32_32_t) ad.y * bd.x) < 0;
|
||||
}
|
||||
|
||||
/* FIXME -- this could be made more efficient */
|
||||
void
|
||||
fbAddTriangles (pixman_image_t * pPicture,
|
||||
int16_t x_off,
|
||||
int16_t y_off,
|
||||
int ntri,
|
||||
xTriangle *tris)
|
||||
{
|
||||
pixman_point_fixed_t *top, *left, *right, *tmp;
|
||||
xTrapezoid trap;
|
||||
|
||||
for (; ntri; ntri--, tris++)
|
||||
{
|
||||
top = &tris->p1;
|
||||
left = &tris->p2;
|
||||
right = &tris->p3;
|
||||
if (_GreaterY (top, left)) {
|
||||
tmp = left; left = top; top = tmp;
|
||||
}
|
||||
if (_GreaterY (top, right)) {
|
||||
tmp = right; right = top; top = tmp;
|
||||
}
|
||||
if (_Clockwise (top, right, left)) {
|
||||
tmp = right; right = left; left = tmp;
|
||||
}
|
||||
|
||||
/*
|
||||
* Two cases:
|
||||
*
|
||||
* + +
|
||||
* / \ / \
|
||||
* / \ / \
|
||||
* / + + \
|
||||
* / -- -- \
|
||||
* / -- -- \
|
||||
* / --- --- \
|
||||
* +-- --+
|
||||
*/
|
||||
|
||||
trap.top = top->y;
|
||||
trap.left.p1 = *top;
|
||||
trap.left.p2 = *left;
|
||||
trap.right.p1 = *top;
|
||||
trap.right.p2 = *right;
|
||||
if (right->y < left->y)
|
||||
trap.bottom = right->y;
|
||||
else
|
||||
trap.bottom = left->y;
|
||||
fbRasterizeTrapezoid (pPicture, &trap, x_off, y_off);
|
||||
if (right->y < left->y)
|
||||
{
|
||||
trap.top = right->y;
|
||||
trap.bottom = left->y;
|
||||
trap.right.p1 = *right;
|
||||
trap.right.p2 = *left;
|
||||
}
|
||||
else
|
||||
{
|
||||
trap.top = left->y;
|
||||
trap.bottom = right->y;
|
||||
trap.left.p1 = *left;
|
||||
trap.left.p2 = *right;
|
||||
}
|
||||
fbRasterizeTrapezoid (pPicture, &trap, x_off, y_off);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
581
uppdev/plugin/pixman/lib/pixman-utils.c
Normal file
581
uppdev/plugin/pixman/lib/pixman-utils.c
Normal file
|
|
@ -0,0 +1,581 @@
|
|||
/*
|
||||
* Copyright © 2000 SuSE, Inc.
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and its
|
||||
* documentation for any purpose is hereby granted without fee, provided that
|
||||
* the above copyright notice appear in all copies and that both that
|
||||
* copyright notice and this permission notice appear in supporting
|
||||
* documentation, and that the name of SuSE not be used in advertising or
|
||||
* publicity pertaining to distribution of the software without specific,
|
||||
* written prior permission. SuSE makes no representations about the
|
||||
* suitability of this software for any purpose. It is provided "as is"
|
||||
* without express or implied warranty.
|
||||
*
|
||||
* SuSE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL SuSE
|
||||
* BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
|
||||
* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
|
||||
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*
|
||||
* Author: Keith Packard, SuSE, Inc.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "pixman-private.h"
|
||||
#include "pixman-mmx.h"
|
||||
#include "pixman-sse2.h"
|
||||
|
||||
#if defined(USE_SSE2) && defined(__GNUC__) && !defined(__x86_64__) && !defined(__amd64__)
|
||||
__attribute__((__force_align_arg_pointer__))
|
||||
#endif
|
||||
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)
|
||||
{
|
||||
#ifdef USE_SSE2
|
||||
if (pixman_have_sse2())
|
||||
{
|
||||
return pixmanBltsse2 (src_bits, dst_bits, src_stride, dst_stride, src_bpp, dst_bpp,
|
||||
src_x, src_y, dst_x, dst_y, width, height);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
#ifdef USE_MMX
|
||||
if (pixman_have_mmx())
|
||||
{
|
||||
return pixman_blt_mmx (src_bits, dst_bits, src_stride, dst_stride, src_bpp, dst_bpp,
|
||||
src_x, src_y, dst_x, dst_y, width, height);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
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
|
||||
*/
|
||||
|
||||
PIXMAN_EXPORT pixman_fixed_t
|
||||
pixman_sample_ceil_y (pixman_fixed_t y, int n)
|
||||
{
|
||||
pixman_fixed_t f = pixman_fixed_frac(y);
|
||||
pixman_fixed_t i = pixman_fixed_floor(y);
|
||||
|
||||
f = ((f + Y_FRAC_FIRST(n)) / STEP_Y_SMALL(n)) * STEP_Y_SMALL(n) + Y_FRAC_FIRST(n);
|
||||
if (f > Y_FRAC_LAST(n))
|
||||
{
|
||||
f = Y_FRAC_FIRST(n);
|
||||
i += pixman_fixed_1;
|
||||
}
|
||||
return (i | f);
|
||||
}
|
||||
|
||||
#define _div(a,b) ((a) >= 0 ? (a) / (b) : -((-(a) + (b) - 1) / (b)))
|
||||
|
||||
/*
|
||||
* Compute the largest value no greater than y which is on a
|
||||
* grid row
|
||||
*/
|
||||
PIXMAN_EXPORT pixman_fixed_t
|
||||
pixman_sample_floor_y (pixman_fixed_t y, int n)
|
||||
{
|
||||
pixman_fixed_t f = pixman_fixed_frac(y);
|
||||
pixman_fixed_t i = pixman_fixed_floor (y);
|
||||
|
||||
f = _div(f - Y_FRAC_FIRST(n), STEP_Y_SMALL(n)) * STEP_Y_SMALL(n) + Y_FRAC_FIRST(n);
|
||||
if (f < Y_FRAC_FIRST(n))
|
||||
{
|
||||
f = Y_FRAC_LAST(n);
|
||||
i -= pixman_fixed_1;
|
||||
}
|
||||
return (i | f);
|
||||
}
|
||||
|
||||
/*
|
||||
* Step an edge by any amount (including negative values)
|
||||
*/
|
||||
PIXMAN_EXPORT void
|
||||
pixman_edge_step (pixman_edge_t *e, int n)
|
||||
{
|
||||
pixman_fixed_48_16_t ne;
|
||||
|
||||
e->x += n * e->stepx;
|
||||
|
||||
ne = e->e + n * (pixman_fixed_48_16_t) e->dx;
|
||||
|
||||
if (n >= 0)
|
||||
{
|
||||
if (ne > 0)
|
||||
{
|
||||
int nx = (ne + e->dy - 1) / e->dy;
|
||||
e->e = ne - nx * (pixman_fixed_48_16_t) e->dy;
|
||||
e->x += nx * e->signdx;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (ne <= -e->dy)
|
||||
{
|
||||
int nx = (-ne) / e->dy;
|
||||
e->e = ne + nx * (pixman_fixed_48_16_t) e->dy;
|
||||
e->x -= nx * e->signdx;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* A private routine to initialize the multi-step
|
||||
* elements of an edge structure
|
||||
*/
|
||||
static void
|
||||
_pixman_edge_tMultiInit (pixman_edge_t *e, int n, pixman_fixed_t *stepx_p, pixman_fixed_t *dx_p)
|
||||
{
|
||||
pixman_fixed_t stepx;
|
||||
pixman_fixed_48_16_t ne;
|
||||
|
||||
ne = n * (pixman_fixed_48_16_t) e->dx;
|
||||
stepx = n * e->stepx;
|
||||
if (ne > 0)
|
||||
{
|
||||
int nx = ne / e->dy;
|
||||
ne -= nx * e->dy;
|
||||
stepx += nx * e->signdx;
|
||||
}
|
||||
*dx_p = ne;
|
||||
*stepx_p = stepx;
|
||||
}
|
||||
|
||||
/*
|
||||
* Initialize one edge structure given the line endpoints and a
|
||||
* starting y value
|
||||
*/
|
||||
PIXMAN_EXPORT void
|
||||
pixman_edge_init (pixman_edge_t *e,
|
||||
int n,
|
||||
pixman_fixed_t y_start,
|
||||
pixman_fixed_t x_top,
|
||||
pixman_fixed_t y_top,
|
||||
pixman_fixed_t x_bot,
|
||||
pixman_fixed_t y_bot)
|
||||
{
|
||||
pixman_fixed_t dx, dy;
|
||||
|
||||
e->x = x_top;
|
||||
e->e = 0;
|
||||
dx = x_bot - x_top;
|
||||
dy = y_bot - y_top;
|
||||
e->dy = dy;
|
||||
e->dx = 0;
|
||||
if (dy)
|
||||
{
|
||||
if (dx >= 0)
|
||||
{
|
||||
e->signdx = 1;
|
||||
e->stepx = dx / dy;
|
||||
e->dx = dx % dy;
|
||||
e->e = -dy;
|
||||
}
|
||||
else
|
||||
{
|
||||
e->signdx = -1;
|
||||
e->stepx = -(-dx / dy);
|
||||
e->dx = -dx % dy;
|
||||
e->e = 0;
|
||||
}
|
||||
|
||||
_pixman_edge_tMultiInit (e, STEP_Y_SMALL(n), &e->stepx_small, &e->dx_small);
|
||||
_pixman_edge_tMultiInit (e, STEP_Y_BIG(n), &e->stepx_big, &e->dx_big);
|
||||
}
|
||||
pixman_edge_step (e, y_start - y_top);
|
||||
}
|
||||
|
||||
/*
|
||||
* Initialize one edge structure given a line, starting y value
|
||||
* and a pixel offset for the line
|
||||
*/
|
||||
PIXMAN_EXPORT void
|
||||
pixman_line_fixed_edge_init (pixman_edge_t *e,
|
||||
int n,
|
||||
pixman_fixed_t y,
|
||||
const pixman_line_fixed_t *line,
|
||||
int x_off,
|
||||
int y_off)
|
||||
{
|
||||
pixman_fixed_t x_off_fixed = pixman_int_to_fixed(x_off);
|
||||
pixman_fixed_t y_off_fixed = pixman_int_to_fixed(y_off);
|
||||
const pixman_point_fixed_t *top, *bot;
|
||||
|
||||
if (line->p1.y <= line->p2.y)
|
||||
{
|
||||
top = &line->p1;
|
||||
bot = &line->p2;
|
||||
}
|
||||
else
|
||||
{
|
||||
top = &line->p2;
|
||||
bot = &line->p1;
|
||||
}
|
||||
pixman_edge_init (e, n, y,
|
||||
top->x + x_off_fixed,
|
||||
top->y + y_off_fixed,
|
||||
bot->x + x_off_fixed,
|
||||
bot->y + y_off_fixed);
|
||||
}
|
||||
|
||||
pixman_bool_t
|
||||
pixman_multiply_overflows_int (unsigned int a,
|
||||
unsigned int b)
|
||||
{
|
||||
return a >= INT32_MAX / b;
|
||||
}
|
||||
|
||||
pixman_bool_t
|
||||
pixman_addition_overflows_int (unsigned int a,
|
||||
unsigned int b)
|
||||
{
|
||||
return a > INT32_MAX - b;
|
||||
}
|
||||
|
||||
void *
|
||||
pixman_malloc_ab(unsigned int a,
|
||||
unsigned int b)
|
||||
{
|
||||
if (a >= INT32_MAX / b)
|
||||
return NULL;
|
||||
|
||||
return malloc (a * b);
|
||||
}
|
||||
|
||||
void *
|
||||
pixman_malloc_abc (unsigned int a,
|
||||
unsigned int b,
|
||||
unsigned int c)
|
||||
{
|
||||
if (a >= INT32_MAX / b)
|
||||
return NULL;
|
||||
else if (a * b >= INT32_MAX / c)
|
||||
return NULL;
|
||||
else
|
||||
return malloc (a * b * c);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* pixman_version:
|
||||
*
|
||||
* Returns the version of the pixman library encoded in a single
|
||||
* integer as per %PIXMAN_VERSION_ENCODE. The encoding ensures that
|
||||
* later versions compare greater than earlier versions.
|
||||
*
|
||||
* A run-time comparison to check that pixman's version is greater than
|
||||
* or equal to version X.Y.Z could be performed as follows:
|
||||
*
|
||||
* <informalexample><programlisting>
|
||||
* if (pixman_version() >= PIXMAN_VERSION_ENCODE(X,Y,Z)) {...}
|
||||
* </programlisting></informalexample>
|
||||
*
|
||||
* See also pixman_version_string() as well as the compile-time
|
||||
* equivalents %PIXMAN_VERSION and %PIXMAN_VERSION_STRING.
|
||||
*
|
||||
* Return value: the encoded version.
|
||||
**/
|
||||
PIXMAN_EXPORT int
|
||||
pixman_version (void)
|
||||
{
|
||||
return PIXMAN_VERSION;
|
||||
}
|
||||
|
||||
/**
|
||||
* pixman_version_string:
|
||||
*
|
||||
* Returns the version of the pixman library as a human-readable string
|
||||
* of the form "X.Y.Z".
|
||||
*
|
||||
* See also pixman_version() as well as the compile-time equivalents
|
||||
* %PIXMAN_VERSION_STRING and %PIXMAN_VERSION.
|
||||
*
|
||||
* Return value: a string containing the version.
|
||||
**/
|
||||
PIXMAN_EXPORT const char*
|
||||
pixman_version_string (void)
|
||||
{
|
||||
return PIXMAN_VERSION_STRING;
|
||||
}
|
||||
|
||||
/**
|
||||
* pixman_format_supported_destination:
|
||||
* @format: A pixman_format_code_t format
|
||||
*
|
||||
* Return value: whether the provided format code is a supported
|
||||
* format for a pixman surface used as a destination in
|
||||
* rendering.
|
||||
*
|
||||
* Currently, all pixman_format_code_t values are supported
|
||||
* except for the YUV formats.
|
||||
**/
|
||||
PIXMAN_EXPORT pixman_bool_t
|
||||
pixman_format_supported_destination (pixman_format_code_t format)
|
||||
{
|
||||
switch (format) {
|
||||
/* 32 bpp formats */
|
||||
case PIXMAN_a2b10g10r10:
|
||||
case PIXMAN_x2b10g10r10:
|
||||
case PIXMAN_a8r8g8b8:
|
||||
case PIXMAN_x8r8g8b8:
|
||||
case PIXMAN_a8b8g8r8:
|
||||
case PIXMAN_x8b8g8r8:
|
||||
case PIXMAN_r8g8b8:
|
||||
case PIXMAN_b8g8r8:
|
||||
case PIXMAN_r5g6b5:
|
||||
case PIXMAN_b5g6r5:
|
||||
/* 16 bpp formats */
|
||||
case PIXMAN_a1r5g5b5:
|
||||
case PIXMAN_x1r5g5b5:
|
||||
case PIXMAN_a1b5g5r5:
|
||||
case PIXMAN_x1b5g5r5:
|
||||
case PIXMAN_a4r4g4b4:
|
||||
case PIXMAN_x4r4g4b4:
|
||||
case PIXMAN_a4b4g4r4:
|
||||
case PIXMAN_x4b4g4r4:
|
||||
/* 8bpp formats */
|
||||
case PIXMAN_a8:
|
||||
case PIXMAN_r3g3b2:
|
||||
case PIXMAN_b2g3r3:
|
||||
case PIXMAN_a2r2g2b2:
|
||||
case PIXMAN_a2b2g2r2:
|
||||
case PIXMAN_c8:
|
||||
case PIXMAN_g8:
|
||||
case PIXMAN_x4a4:
|
||||
/* Collides with PIXMAN_c8
|
||||
case PIXMAN_x4c4:
|
||||
*/
|
||||
/* Collides with PIXMAN_g8
|
||||
case PIXMAN_x4g4:
|
||||
*/
|
||||
/* 4bpp formats */
|
||||
case PIXMAN_a4:
|
||||
case PIXMAN_r1g2b1:
|
||||
case PIXMAN_b1g2r1:
|
||||
case PIXMAN_a1r1g1b1:
|
||||
case PIXMAN_a1b1g1r1:
|
||||
case PIXMAN_c4:
|
||||
case PIXMAN_g4:
|
||||
/* 1bpp formats */
|
||||
case PIXMAN_a1:
|
||||
case PIXMAN_g1:
|
||||
return TRUE;
|
||||
|
||||
/* YUV formats */
|
||||
case PIXMAN_yuy2:
|
||||
case PIXMAN_yv12:
|
||||
default:
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* pixman_format_supported_source:
|
||||
* @format: A pixman_format_code_t format
|
||||
*
|
||||
* Return value: whether the provided format code is a supported
|
||||
* format for a pixman surface used as a source in
|
||||
* rendering.
|
||||
*
|
||||
* Currently, all pixman_format_code_t values are supported.
|
||||
**/
|
||||
PIXMAN_EXPORT pixman_bool_t
|
||||
pixman_format_supported_source (pixman_format_code_t format)
|
||||
{
|
||||
switch (format) {
|
||||
/* 32 bpp formats */
|
||||
case PIXMAN_a2b10g10r10:
|
||||
case PIXMAN_x2b10g10r10:
|
||||
case PIXMAN_a8r8g8b8:
|
||||
case PIXMAN_x8r8g8b8:
|
||||
case PIXMAN_a8b8g8r8:
|
||||
case PIXMAN_x8b8g8r8:
|
||||
case PIXMAN_r8g8b8:
|
||||
case PIXMAN_b8g8r8:
|
||||
case PIXMAN_r5g6b5:
|
||||
case PIXMAN_b5g6r5:
|
||||
/* 16 bpp formats */
|
||||
case PIXMAN_a1r5g5b5:
|
||||
case PIXMAN_x1r5g5b5:
|
||||
case PIXMAN_a1b5g5r5:
|
||||
case PIXMAN_x1b5g5r5:
|
||||
case PIXMAN_a4r4g4b4:
|
||||
case PIXMAN_x4r4g4b4:
|
||||
case PIXMAN_a4b4g4r4:
|
||||
case PIXMAN_x4b4g4r4:
|
||||
/* 8bpp formats */
|
||||
case PIXMAN_a8:
|
||||
case PIXMAN_r3g3b2:
|
||||
case PIXMAN_b2g3r3:
|
||||
case PIXMAN_a2r2g2b2:
|
||||
case PIXMAN_a2b2g2r2:
|
||||
case PIXMAN_c8:
|
||||
case PIXMAN_g8:
|
||||
case PIXMAN_x4a4:
|
||||
/* Collides with PIXMAN_c8
|
||||
case PIXMAN_x4c4:
|
||||
*/
|
||||
/* Collides with PIXMAN_g8
|
||||
case PIXMAN_x4g4:
|
||||
*/
|
||||
/* 4bpp formats */
|
||||
case PIXMAN_a4:
|
||||
case PIXMAN_r1g2b1:
|
||||
case PIXMAN_b1g2r1:
|
||||
case PIXMAN_a1r1g1b1:
|
||||
case PIXMAN_a1b1g1r1:
|
||||
case PIXMAN_c4:
|
||||
case PIXMAN_g4:
|
||||
/* 1bpp formats */
|
||||
case PIXMAN_a1:
|
||||
case PIXMAN_g1:
|
||||
/* YUV formats */
|
||||
case PIXMAN_yuy2:
|
||||
case PIXMAN_yv12:
|
||||
return TRUE;
|
||||
|
||||
default:
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
50
uppdev/plugin/pixman/lib/pixman-version.h
Normal file
50
uppdev/plugin/pixman/lib/pixman-version.h
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
/*
|
||||
* Copyright © 2008 Red Hat, Inc.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person
|
||||
* obtaining a copy of this software and associated documentation
|
||||
* files (the "Software"), to deal in the Software without
|
||||
* restriction, including without limitation the rights to use, copy,
|
||||
* modify, merge, publish, distribute, sublicense, and/or sell copies
|
||||
* of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
|
||||
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
||||
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*
|
||||
* Author: Carl D. Worth <cworth@cworth.org>
|
||||
*/
|
||||
|
||||
#ifndef PIXMAN_VERSION_H__
|
||||
#define PIXMAN_VERSION_H__
|
||||
|
||||
#ifndef PIXMAN_H__
|
||||
# error pixman-version.h should only be included by pixman.h
|
||||
#endif
|
||||
|
||||
#define PIXMAN_VERSION_MAJOR 0
|
||||
#define PIXMAN_VERSION_MINOR 13
|
||||
#define PIXMAN_VERSION_MICRO 2
|
||||
|
||||
#define PIXMAN_VERSION_STRING "0.13.2"
|
||||
|
||||
#define PIXMAN_VERSION_ENCODE(major, minor, micro) ( \
|
||||
((major) * 10000) \
|
||||
+ ((minor) * 100) \
|
||||
+ ((micro) * 1))
|
||||
|
||||
#define PIXMAN_VERSION PIXMAN_VERSION_ENCODE( \
|
||||
PIXMAN_VERSION_MAJOR, \
|
||||
PIXMAN_VERSION_MINOR, \
|
||||
PIXMAN_VERSION_MICRO)
|
||||
|
||||
#endif /* PIXMAN_VERSION_H__ */
|
||||
1064
uppdev/plugin/pixman/lib/pixman-vmx.c
Normal file
1064
uppdev/plugin/pixman/lib/pixman-vmx.c
Normal file
File diff suppressed because it is too large
Load diff
308
uppdev/plugin/pixman/lib/pixman-vmx.h
Normal file
308
uppdev/plugin/pixman/lib/pixman-vmx.h
Normal file
|
|
@ -0,0 +1,308 @@
|
|||
/*
|
||||
* Copyright © 2007 Luca Barbato
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and its
|
||||
* documentation for any purpose is hereby granted without fee, provided that
|
||||
* the above copyright notice appear in all copies and that both that
|
||||
* copyright notice and this permission notice appear in supporting
|
||||
* documentation, and that the name of Luca Barbato not be used in advertising or
|
||||
* publicity pertaining to distribution of the software without specific,
|
||||
* written prior permission. Luca Barbato makes no representations about the
|
||||
* suitability of this software for any purpose. It is provided "as is"
|
||||
* without express or implied warranty.
|
||||
*
|
||||
* THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
|
||||
* SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
* FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
* SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
|
||||
* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
|
||||
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
|
||||
* SOFTWARE.
|
||||
*
|
||||
* Author: Luca Barbato (lu_zero@gentoo.org)
|
||||
*
|
||||
* Based on work by Owen Taylor, Søren Sandmann and Lars Knoll
|
||||
*/
|
||||
|
||||
#include "pixman-private.h"
|
||||
|
||||
#ifdef USE_VMX
|
||||
|
||||
pixman_bool_t pixman_have_vmx(void);
|
||||
|
||||
#else
|
||||
#define pixman_have_vmx() FALSE
|
||||
#endif
|
||||
|
||||
#ifdef USE_VMX
|
||||
|
||||
#define AVV(x...) {x}
|
||||
|
||||
void fbComposeSetupVMX (void);
|
||||
|
||||
#if 0
|
||||
void fbCompositeIn_nx8x8vmx (pixman_operator_t op,
|
||||
pixman_image_t * pSrc,
|
||||
pixman_image_t * pMask,
|
||||
pixman_image_t * pDst,
|
||||
INT16 xSrc,
|
||||
INT16 ySrc,
|
||||
INT16 xMask,
|
||||
INT16 yMask,
|
||||
INT16 xDst,
|
||||
INT16 yDst,
|
||||
CARD16 width,
|
||||
CARD16 height);
|
||||
|
||||
void fbCompositeSolidMask_nx8888x0565Cvmx (pixman_operator_t op,
|
||||
pixman_image_t * pSrc,
|
||||
pixman_image_t * pMask,
|
||||
pixman_image_t * pDst,
|
||||
INT16 xSrc,
|
||||
INT16 ySrc,
|
||||
INT16 xMask,
|
||||
INT16 yMask,
|
||||
INT16 xDst,
|
||||
INT16 yDst,
|
||||
CARD16 width,
|
||||
CARD16 height);
|
||||
|
||||
void fbCompositeSrcAdd_8888x8888vmx (pixman_operator_t op,
|
||||
pixman_image_t * pSrc,
|
||||
pixman_image_t * pMask,
|
||||
pixman_image_t * pDst,
|
||||
INT16 xSrc,
|
||||
INT16 ySrc,
|
||||
INT16 xMask,
|
||||
INT16 yMask,
|
||||
INT16 xDst,
|
||||
INT16 yDst,
|
||||
CARD16 width,
|
||||
CARD16 height);
|
||||
|
||||
void fbCompositeSolidMask_nx8888x8888Cvmx (pixman_operator_t op,
|
||||
pixman_image_t * pSrc,
|
||||
pixman_image_t * pMask,
|
||||
pixman_image_t * pDst,
|
||||
INT16 xSrc,
|
||||
INT16 ySrc,
|
||||
INT16 xMask,
|
||||
INT16 yMask,
|
||||
INT16 xDst,
|
||||
INT16 yDst,
|
||||
CARD16 width,
|
||||
CARD16 height);
|
||||
|
||||
void fbCompositeSolidMask_nx8x8888vmx (pixman_operator_t op,
|
||||
pixman_image_t * pSrc,
|
||||
pixman_image_t * pMask,
|
||||
pixman_image_t * pDst,
|
||||
INT16 xSrc,
|
||||
INT16 ySrc,
|
||||
INT16 xMask,
|
||||
INT16 yMask,
|
||||
INT16 xDst,
|
||||
INT16 yDst,
|
||||
CARD16 width,
|
||||
CARD16 height);
|
||||
|
||||
void fbCompositeSolidMaskSrc_nx8x8888vmx (pixman_operator_t op,
|
||||
pixman_image_t * pSrc,
|
||||
pixman_image_t * pMask,
|
||||
pixman_image_t * pDst,
|
||||
INT16 xSrc,
|
||||
INT16 ySrc,
|
||||
INT16 xMask,
|
||||
INT16 yMask,
|
||||
INT16 xDst,
|
||||
INT16 yDst,
|
||||
CARD16 width,
|
||||
CARD16 height);
|
||||
|
||||
void fbCompositeSrcAdd_8888x8x8vmx (pixman_operator_t op,
|
||||
pixman_image_t * pSrc,
|
||||
pixman_image_t * pMask,
|
||||
pixman_image_t * pDst,
|
||||
INT16 xSrc,
|
||||
INT16 ySrc,
|
||||
INT16 xMask,
|
||||
INT16 yMask,
|
||||
INT16 xDst,
|
||||
INT16 yDst,
|
||||
CARD16 width,
|
||||
CARD16 height);
|
||||
|
||||
void fbCompositeIn_8x8vmx (pixman_operator_t op,
|
||||
pixman_image_t * pSrc,
|
||||
pixman_image_t * pMask,
|
||||
pixman_image_t * pDst,
|
||||
INT16 xSrc,
|
||||
INT16 ySrc,
|
||||
INT16 xMask,
|
||||
INT16 yMask,
|
||||
INT16 xDst,
|
||||
INT16 yDst,
|
||||
CARD16 width,
|
||||
CARD16 height);
|
||||
|
||||
void fbCompositeSrcAdd_8000x8000vmx (pixman_operator_t op,
|
||||
pixman_image_t * pSrc,
|
||||
pixman_image_t * pMask,
|
||||
pixman_image_t * pDst,
|
||||
INT16 xSrc,
|
||||
INT16 ySrc,
|
||||
INT16 xMask,
|
||||
INT16 yMask,
|
||||
INT16 xDst,
|
||||
INT16 yDst,
|
||||
CARD16 width,
|
||||
CARD16 height);
|
||||
|
||||
void fbCompositeSrc_8888RevNPx8888vmx (pixman_operator_t op,
|
||||
pixman_image_t * pSrc,
|
||||
pixman_image_t * pMask,
|
||||
pixman_image_t * pDst,
|
||||
INT16 xSrc,
|
||||
INT16 ySrc,
|
||||
INT16 xMask,
|
||||
INT16 yMask,
|
||||
INT16 xDst,
|
||||
INT16 yDst,
|
||||
CARD16 width,
|
||||
CARD16 height);
|
||||
|
||||
void fbCompositeSrc_8888x0565vmx (pixman_operator_t op,
|
||||
pixman_image_t * pSrc,
|
||||
pixman_image_t * pMask,
|
||||
pixman_image_t * pDst,
|
||||
INT16 xSrc,
|
||||
INT16 ySrc,
|
||||
INT16 xMask,
|
||||
INT16 yMask,
|
||||
INT16 xDst,
|
||||
INT16 yDst,
|
||||
CARD16 width,
|
||||
CARD16 height);
|
||||
|
||||
void fbCompositeSrc_8888RevNPx0565vmx (pixman_operator_t op,
|
||||
pixman_image_t * pSrc,
|
||||
pixman_image_t * pMask,
|
||||
pixman_image_t * pDst,
|
||||
INT16 xSrc,
|
||||
INT16 ySrc,
|
||||
INT16 xMask,
|
||||
INT16 yMask,
|
||||
INT16 xDst,
|
||||
INT16 yDst,
|
||||
CARD16 width,
|
||||
CARD16 height);
|
||||
|
||||
void fbCompositeSolid_nx8888vmx (pixman_operator_t op,
|
||||
pixman_image_t * pSrc,
|
||||
pixman_image_t * pMask,
|
||||
pixman_image_t * pDst,
|
||||
INT16 xSrc,
|
||||
INT16 ySrc,
|
||||
INT16 xMask,
|
||||
INT16 yMask,
|
||||
INT16 xDst,
|
||||
INT16 yDst,
|
||||
CARD16 width,
|
||||
CARD16 height);
|
||||
|
||||
void fbCompositeSolid_nx0565vmx (pixman_operator_t op,
|
||||
pixman_image_t * pSrc,
|
||||
pixman_image_t * pMask,
|
||||
pixman_image_t * pDst,
|
||||
INT16 xSrc,
|
||||
INT16 ySrc,
|
||||
INT16 xMask,
|
||||
INT16 yMask,
|
||||
INT16 xDst,
|
||||
INT16 yDst,
|
||||
CARD16 width,
|
||||
CARD16 height);
|
||||
|
||||
void fbCompositeSolidMask_nx8x0565vmx (pixman_operator_t op,
|
||||
pixman_image_t * pSrc,
|
||||
pixman_image_t * pMask,
|
||||
pixman_image_t * pDst,
|
||||
INT16 xSrc,
|
||||
INT16 ySrc,
|
||||
INT16 xMask,
|
||||
INT16 yMask,
|
||||
INT16 xDst,
|
||||
INT16 yDst,
|
||||
CARD16 width,
|
||||
CARD16 height);
|
||||
|
||||
void fbCompositeSrc_x888x8x8888vmx (pixman_operator_t op,
|
||||
pixman_image_t * pSrc,
|
||||
pixman_image_t * pMask,
|
||||
pixman_image_t * pDst,
|
||||
INT16 xSrc,
|
||||
INT16 ySrc,
|
||||
INT16 xMask,
|
||||
INT16 yMask,
|
||||
INT16 xDst,
|
||||
INT16 yDst,
|
||||
CARD16 width,
|
||||
CARD16 height);
|
||||
|
||||
void fbCompositeSrc_8888x8x8888vmx (pixman_operator_t op,
|
||||
pixman_image_t * pSrc,
|
||||
pixman_image_t * pMask,
|
||||
pixman_image_t * pDst,
|
||||
INT16 xSrc,
|
||||
INT16 ySrc,
|
||||
INT16 xMask,
|
||||
INT16 yMask,
|
||||
INT16 xDst,
|
||||
INT16 yDst,
|
||||
CARD16 width,
|
||||
CARD16 height);
|
||||
|
||||
void fbCompositeSrc_8888x8888vmx (pixman_operator_t op,
|
||||
pixman_image_t * pSrc,
|
||||
pixman_image_t * pMask,
|
||||
pixman_image_t * pDst,
|
||||
INT16 xSrc,
|
||||
INT16 ySrc,
|
||||
INT16 xMask,
|
||||
INT16 yMask,
|
||||
INT16 xDst,
|
||||
INT16 yDst,
|
||||
CARD16 width,
|
||||
CARD16 height);
|
||||
|
||||
pixman_bool_t fbCopyAreavmx (FbPixels *pSrc,
|
||||
FbPixels *pDst,
|
||||
int src_x,
|
||||
int src_y,
|
||||
int dst_x,
|
||||
int dst_y,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
void fbCompositeCopyAreavmx (pixman_operator_t op,
|
||||
pixman_image_t * pSrc,
|
||||
pixman_image_t * pMask,
|
||||
pixman_image_t * pDst,
|
||||
INT16 xSrc,
|
||||
INT16 ySrc,
|
||||
INT16 xMask,
|
||||
INT16 yMask,
|
||||
INT16 xDst,
|
||||
INT16 yDst,
|
||||
CARD16 width,
|
||||
CARD16 height);
|
||||
|
||||
pixman_bool_t fbSolidFillvmx (FbPixels *pDraw,
|
||||
int x,
|
||||
int y,
|
||||
int width,
|
||||
int height,
|
||||
FbBits xor);
|
||||
#endif
|
||||
#endif /* USE_VMX */
|
||||
901
uppdev/plugin/pixman/lib/pixman.h
Normal file
901
uppdev/plugin/pixman/lib/pixman.h
Normal file
|
|
@ -0,0 +1,901 @@
|
|||
/***********************************************************
|
||||
|
||||
Copyright 1987, 1998 The Open Group
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this software and its
|
||||
documentation for any purpose is hereby granted without fee, provided that
|
||||
the above copyright notice appear in all copies and that both that
|
||||
copyright notice and this permission notice appear in supporting
|
||||
documentation.
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
||||
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
Except as contained in this notice, the name of The Open Group shall not be
|
||||
used in advertising or otherwise to promote the sale, use or other dealings
|
||||
in this Software without prior written authorization from The Open Group.
|
||||
|
||||
Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
|
||||
|
||||
All Rights Reserved
|
||||
|
||||
Permission to use, copy, modify, and distribute this software and its
|
||||
documentation for any purpose and without fee is hereby granted,
|
||||
provided that the above copyright notice appear in all copies and that
|
||||
both that copyright notice and this permission notice appear in
|
||||
supporting documentation, and that the name of Digital not be
|
||||
used in advertising or publicity pertaining to distribution of the
|
||||
software without specific, written prior permission.
|
||||
|
||||
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
|
||||
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
|
||||
DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
|
||||
ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
||||
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
|
||||
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
|
||||
SOFTWARE.
|
||||
|
||||
******************************************************************/
|
||||
/*
|
||||
* Copyright © 1998, 2004 Keith Packard
|
||||
* Copyright 2007 Red Hat, Inc.
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and its
|
||||
* documentation for any purpose is hereby granted without fee, provided that
|
||||
* the above copyright notice appear in all copies and that both that
|
||||
* copyright notice and this permission notice appear in supporting
|
||||
* documentation, and that the name of Keith Packard not be used in
|
||||
* advertising or publicity pertaining to distribution of the software without
|
||||
* specific, written prior permission. Keith Packard makes no
|
||||
* representations about the suitability of this software for any purpose. It
|
||||
* is provided "as is" without express or implied warranty.
|
||||
*
|
||||
* KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
||||
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
|
||||
* EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
|
||||
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
||||
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
||||
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef PIXMAN_H__
|
||||
#define PIXMAN_H__
|
||||
|
||||
#include <pixman-version.h>
|
||||
|
||||
/*
|
||||
* Standard integers
|
||||
*/
|
||||
#if defined (_SVR4) || defined (SVR4) || defined (__OpenBSD__) || defined (_sgi) || defined (__sun) || defined (sun) || defined (__digital__)
|
||||
# include <inttypes.h>
|
||||
#elif defined (_MSC_VER)
|
||||
typedef __int8 int8_t;
|
||||
typedef unsigned __int8 uint8_t;
|
||||
typedef __int16 int16_t;
|
||||
typedef unsigned __int16 uint16_t;
|
||||
typedef __int32 int32_t;
|
||||
typedef unsigned __int32 uint32_t;
|
||||
typedef __int64 int64_t;
|
||||
typedef unsigned __int64 uint64_t;
|
||||
#elif defined (_AIX)
|
||||
# include <sys/inttypes.h>
|
||||
#else
|
||||
# include <stdint.h>
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Boolean
|
||||
*/
|
||||
typedef int pixman_bool_t;
|
||||
|
||||
/*
|
||||
* Fixpoint numbers
|
||||
*/
|
||||
typedef int64_t pixman_fixed_32_32_t;
|
||||
typedef pixman_fixed_32_32_t pixman_fixed_48_16_t;
|
||||
typedef uint32_t pixman_fixed_1_31_t;
|
||||
typedef uint32_t pixman_fixed_1_16_t;
|
||||
typedef int32_t pixman_fixed_16_16_t;
|
||||
typedef pixman_fixed_16_16_t pixman_fixed_t;
|
||||
|
||||
#define pixman_fixed_e ((pixman_fixed_t) 1)
|
||||
#define pixman_fixed_1 (pixman_int_to_fixed(1))
|
||||
#define pixman_fixed_1_minus_e (pixman_fixed_1 - pixman_fixed_e)
|
||||
#define pixman_fixed_to_int(f) ((int) ((f) >> 16))
|
||||
#define pixman_int_to_fixed(i) ((pixman_fixed_t) ((i) << 16))
|
||||
#define pixman_fixed_to_double(f) (double) ((f) / (double) pixman_fixed_1)
|
||||
#define pixman_double_to_fixed(d) ((pixman_fixed_t) ((d) * 65536.0))
|
||||
#define pixman_fixed_frac(f) ((f) & pixman_fixed_1_minus_e)
|
||||
#define pixman_fixed_floor(f) ((f) & ~pixman_fixed_1_minus_e)
|
||||
#define pixman_fixed_ceil(f) pixman_fixed_floor ((f) + pixman_fixed_1_minus_e)
|
||||
#define pixman_fixed_fraction(f) ((f) & pixman_fixed_1_minus_e)
|
||||
#define pixman_fixed_mod_2(f) ((f) & (pixman_fixed1 | pixman_fixed_1_minus_e))
|
||||
#define pixman_max_fixed_48_16 ((pixman_fixed_48_16_t) 0x7fffffff)
|
||||
#define pixman_min_fixed_48_16 (-((pixman_fixed_48_16_t) 1 << 31))
|
||||
|
||||
/*
|
||||
* Misc structs
|
||||
*/
|
||||
typedef struct pixman_color pixman_color_t;
|
||||
typedef struct pixman_point_fixed pixman_point_fixed_t;
|
||||
typedef struct pixman_line_fixed pixman_line_fixed_t;
|
||||
typedef struct pixman_vector pixman_vector_t;
|
||||
typedef struct pixman_transform pixman_transform_t;
|
||||
|
||||
struct pixman_color
|
||||
{
|
||||
uint16_t red;
|
||||
uint16_t green;
|
||||
uint16_t blue;
|
||||
uint16_t alpha;
|
||||
};
|
||||
|
||||
struct pixman_point_fixed
|
||||
{
|
||||
pixman_fixed_t x;
|
||||
pixman_fixed_t y;
|
||||
};
|
||||
|
||||
struct pixman_line_fixed
|
||||
{
|
||||
pixman_point_fixed_t p1, p2;
|
||||
};
|
||||
|
||||
/*
|
||||
* Fixed point matrices
|
||||
*/
|
||||
|
||||
struct pixman_vector
|
||||
{
|
||||
pixman_fixed_t vector[3];
|
||||
};
|
||||
|
||||
struct pixman_transform
|
||||
{
|
||||
pixman_fixed_t matrix[3][3];
|
||||
};
|
||||
|
||||
/* forward declaration (sorry) */
|
||||
struct pixman_box16;
|
||||
|
||||
void
|
||||
pixman_transform_init_identity(struct pixman_transform *matrix);
|
||||
|
||||
pixman_bool_t
|
||||
pixman_transform_point_3d (const struct pixman_transform *transform,
|
||||
struct pixman_vector *vector);
|
||||
|
||||
pixman_bool_t
|
||||
pixman_transform_point(const struct pixman_transform *transform,
|
||||
struct pixman_vector *vector);
|
||||
|
||||
pixman_bool_t
|
||||
pixman_transform_multiply (struct pixman_transform *dst,
|
||||
const struct pixman_transform *l,
|
||||
const struct pixman_transform *r);
|
||||
|
||||
void
|
||||
pixman_transform_init_scale (struct pixman_transform *t,
|
||||
pixman_fixed_t sx,
|
||||
pixman_fixed_t sy);
|
||||
|
||||
pixman_bool_t
|
||||
pixman_transform_scale(struct pixman_transform *forward,
|
||||
struct pixman_transform *reverse,
|
||||
pixman_fixed_t sx, pixman_fixed_t sy);
|
||||
|
||||
void
|
||||
pixman_transform_init_rotate(struct pixman_transform *t,
|
||||
pixman_fixed_t cos,
|
||||
pixman_fixed_t sin);
|
||||
|
||||
pixman_bool_t
|
||||
pixman_transform_rotate(struct pixman_transform *forward,
|
||||
struct pixman_transform *reverse,
|
||||
pixman_fixed_t c, pixman_fixed_t s);
|
||||
|
||||
void
|
||||
pixman_transform_init_translate(struct pixman_transform *t,
|
||||
pixman_fixed_t tx, pixman_fixed_t ty);
|
||||
|
||||
|
||||
pixman_bool_t
|
||||
pixman_transform_translate(struct pixman_transform *forward,
|
||||
struct pixman_transform *reverse,
|
||||
pixman_fixed_t tx, pixman_fixed_t ty);
|
||||
|
||||
pixman_bool_t
|
||||
pixman_transform_bounds(const struct pixman_transform *matrix,
|
||||
struct pixman_box16 *b);
|
||||
|
||||
|
||||
pixman_bool_t
|
||||
pixman_transform_invert (struct pixman_transform *dst,
|
||||
const struct pixman_transform *src);
|
||||
|
||||
pixman_bool_t
|
||||
pixman_transform_is_identity(const struct pixman_transform *t);
|
||||
|
||||
pixman_bool_t
|
||||
pixman_transform_is_scale(const struct pixman_transform *t);
|
||||
|
||||
pixman_bool_t
|
||||
pixman_transform_is_int_translate(const struct pixman_transform *t);
|
||||
|
||||
pixman_bool_t
|
||||
pixman_transform_is_inverse (const struct pixman_transform *a,
|
||||
const struct pixman_transform *b);
|
||||
|
||||
|
||||
/*
|
||||
* Floating point matrices
|
||||
*/
|
||||
struct pixman_f_vector {
|
||||
double v[3];
|
||||
};
|
||||
|
||||
struct pixman_f_transform {
|
||||
double m[3][3];
|
||||
};
|
||||
|
||||
pixman_bool_t
|
||||
pixman_transform_from_pixman_f_transform (struct pixman_transform *t,
|
||||
const struct pixman_f_transform *ft);
|
||||
|
||||
void
|
||||
pixman_f_transform_from_pixman_transform (struct pixman_f_transform *ft,
|
||||
const struct pixman_transform *t);
|
||||
|
||||
pixman_bool_t
|
||||
pixman_transform_from_pixman_f_transform (struct pixman_transform *t,
|
||||
const struct pixman_f_transform *ft);
|
||||
|
||||
pixman_bool_t
|
||||
pixman_f_transform_invert (struct pixman_f_transform *dst,
|
||||
const struct pixman_f_transform *src);
|
||||
|
||||
pixman_bool_t
|
||||
pixman_f_transform_point (const struct pixman_f_transform *t,
|
||||
struct pixman_f_vector *v);
|
||||
|
||||
void
|
||||
pixman_f_transform_point_3d (const struct pixman_f_transform *t,
|
||||
struct pixman_f_vector *v);
|
||||
|
||||
|
||||
void
|
||||
pixman_f_transform_multiply (struct pixman_f_transform *dst,
|
||||
const struct pixman_f_transform *l,
|
||||
const struct pixman_f_transform *r);
|
||||
|
||||
void
|
||||
pixman_f_transform_init_scale (struct pixman_f_transform *t, double sx, double sy);
|
||||
|
||||
pixman_bool_t
|
||||
pixman_f_transform_scale (struct pixman_f_transform *forward,
|
||||
struct pixman_f_transform *reverse,
|
||||
double sx, double sy);
|
||||
|
||||
void
|
||||
pixman_f_transform_init_rotate (struct pixman_f_transform *t, double cos, double sin);
|
||||
|
||||
pixman_bool_t
|
||||
pixman_f_transform_rotate (struct pixman_f_transform *forward,
|
||||
struct pixman_f_transform *reverse,
|
||||
double c, double s);
|
||||
|
||||
void
|
||||
pixman_f_transform_init_translate (struct pixman_f_transform *t, double tx, double ty);
|
||||
|
||||
pixman_bool_t
|
||||
pixman_f_transform_translate (struct pixman_f_transform *forward,
|
||||
struct pixman_f_transform *reverse,
|
||||
double tx, double ty);
|
||||
|
||||
pixman_bool_t
|
||||
pixman_f_transform_bounds (const struct pixman_f_transform *t, struct pixman_box16 *b);
|
||||
|
||||
void
|
||||
pixman_f_transform_init_identity (struct pixman_f_transform *t);
|
||||
|
||||
/* Don't blame me, blame XRender */
|
||||
typedef enum
|
||||
{
|
||||
PIXMAN_REPEAT_NONE,
|
||||
PIXMAN_REPEAT_NORMAL,
|
||||
PIXMAN_REPEAT_PAD,
|
||||
PIXMAN_REPEAT_REFLECT
|
||||
} pixman_repeat_t;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
PIXMAN_FILTER_FAST,
|
||||
PIXMAN_FILTER_GOOD,
|
||||
PIXMAN_FILTER_BEST,
|
||||
PIXMAN_FILTER_NEAREST,
|
||||
PIXMAN_FILTER_BILINEAR,
|
||||
PIXMAN_FILTER_CONVOLUTION
|
||||
} pixman_filter_t;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
PIXMAN_OP_CLEAR = 0x00,
|
||||
PIXMAN_OP_SRC = 0x01,
|
||||
PIXMAN_OP_DST = 0x02,
|
||||
PIXMAN_OP_OVER = 0x03,
|
||||
PIXMAN_OP_OVER_REVERSE = 0x04,
|
||||
PIXMAN_OP_IN = 0x05,
|
||||
PIXMAN_OP_IN_REVERSE = 0x06,
|
||||
PIXMAN_OP_OUT = 0x07,
|
||||
PIXMAN_OP_OUT_REVERSE = 0x08,
|
||||
PIXMAN_OP_ATOP = 0x09,
|
||||
PIXMAN_OP_ATOP_REVERSE = 0x0a,
|
||||
PIXMAN_OP_XOR = 0x0b,
|
||||
PIXMAN_OP_ADD = 0x0c,
|
||||
PIXMAN_OP_SATURATE = 0x0d,
|
||||
|
||||
PIXMAN_OP_DISJOINT_CLEAR = 0x10,
|
||||
PIXMAN_OP_DISJOINT_SRC = 0x11,
|
||||
PIXMAN_OP_DISJOINT_DST = 0x12,
|
||||
PIXMAN_OP_DISJOINT_OVER = 0x13,
|
||||
PIXMAN_OP_DISJOINT_OVER_REVERSE = 0x14,
|
||||
PIXMAN_OP_DISJOINT_IN = 0x15,
|
||||
PIXMAN_OP_DISJOINT_IN_REVERSE = 0x16,
|
||||
PIXMAN_OP_DISJOINT_OUT = 0x17,
|
||||
PIXMAN_OP_DISJOINT_OUT_REVERSE = 0x18,
|
||||
PIXMAN_OP_DISJOINT_ATOP = 0x19,
|
||||
PIXMAN_OP_DISJOINT_ATOP_REVERSE = 0x1a,
|
||||
PIXMAN_OP_DISJOINT_XOR = 0x1b,
|
||||
|
||||
PIXMAN_OP_CONJOINT_CLEAR = 0x20,
|
||||
PIXMAN_OP_CONJOINT_SRC = 0x21,
|
||||
PIXMAN_OP_CONJOINT_DST = 0x22,
|
||||
PIXMAN_OP_CONJOINT_OVER = 0x23,
|
||||
PIXMAN_OP_CONJOINT_OVER_REVERSE = 0x24,
|
||||
PIXMAN_OP_CONJOINT_IN = 0x25,
|
||||
PIXMAN_OP_CONJOINT_IN_REVERSE = 0x26,
|
||||
PIXMAN_OP_CONJOINT_OUT = 0x27,
|
||||
PIXMAN_OP_CONJOINT_OUT_REVERSE = 0x28,
|
||||
PIXMAN_OP_CONJOINT_ATOP = 0x29,
|
||||
PIXMAN_OP_CONJOINT_ATOP_REVERSE = 0x2a,
|
||||
PIXMAN_OP_CONJOINT_XOR = 0x2b,
|
||||
|
||||
PIXMAN_OP_NONE
|
||||
} pixman_op_t;
|
||||
|
||||
/*
|
||||
* Regions
|
||||
*/
|
||||
typedef struct pixman_region16_data pixman_region16_data_t;
|
||||
typedef struct pixman_box16 pixman_box16_t;
|
||||
typedef struct pixman_rectangle16 pixman_rectangle16_t;
|
||||
typedef struct pixman_region16 pixman_region16_t;
|
||||
|
||||
struct pixman_region16_data {
|
||||
long size;
|
||||
long numRects;
|
||||
/* pixman_box16_t rects[size]; in memory but not explicitly declared */
|
||||
};
|
||||
|
||||
struct pixman_rectangle16
|
||||
{
|
||||
int16_t x, y;
|
||||
uint16_t width, height;
|
||||
};
|
||||
|
||||
struct pixman_box16
|
||||
{
|
||||
int16_t x1, y1, x2, y2;
|
||||
};
|
||||
|
||||
struct pixman_region16
|
||||
{
|
||||
pixman_box16_t extents;
|
||||
pixman_region16_data_t *data;
|
||||
};
|
||||
|
||||
typedef enum
|
||||
{
|
||||
PIXMAN_REGION_OUT,
|
||||
PIXMAN_REGION_IN,
|
||||
PIXMAN_REGION_PART
|
||||
} pixman_region_overlap_t;
|
||||
|
||||
/* This function exists only to make it possible to preserve the X ABI - it should
|
||||
* go away at first opportunity.
|
||||
*/
|
||||
void pixman_region_set_static_pointers (pixman_box16_t *empty_box,
|
||||
pixman_region16_data_t *empty_data,
|
||||
pixman_region16_data_t *broken_data);
|
||||
|
||||
|
||||
/* creation/destruction */
|
||||
void pixman_region_init (pixman_region16_t *region);
|
||||
void pixman_region_init_rect (pixman_region16_t *region,
|
||||
int x,
|
||||
int y,
|
||||
unsigned int width,
|
||||
unsigned int height);
|
||||
pixman_bool_t pixman_region_init_rects (pixman_region16_t *region,
|
||||
pixman_box16_t *boxes,
|
||||
int count);
|
||||
void pixman_region_init_with_extents (pixman_region16_t *region,
|
||||
pixman_box16_t *extents);
|
||||
void pixman_region_fini (pixman_region16_t *region);
|
||||
|
||||
|
||||
/* manipulation */
|
||||
void pixman_region_translate (pixman_region16_t *region,
|
||||
int x,
|
||||
int y);
|
||||
pixman_bool_t pixman_region_copy (pixman_region16_t *dest,
|
||||
pixman_region16_t *source);
|
||||
pixman_bool_t pixman_region_intersect (pixman_region16_t *newReg,
|
||||
pixman_region16_t *reg1,
|
||||
pixman_region16_t *reg2);
|
||||
pixman_bool_t pixman_region_union (pixman_region16_t *newReg,
|
||||
pixman_region16_t *reg1,
|
||||
pixman_region16_t *reg2);
|
||||
pixman_bool_t pixman_region_union_rect (pixman_region16_t *dest,
|
||||
pixman_region16_t *source,
|
||||
int x,
|
||||
int y,
|
||||
unsigned int width,
|
||||
unsigned int height);
|
||||
pixman_bool_t pixman_region_subtract (pixman_region16_t *regD,
|
||||
pixman_region16_t *regM,
|
||||
pixman_region16_t *regS);
|
||||
pixman_bool_t pixman_region_inverse (pixman_region16_t *newReg,
|
||||
pixman_region16_t *reg1,
|
||||
pixman_box16_t *invRect);
|
||||
pixman_bool_t pixman_region_contains_point (pixman_region16_t *region,
|
||||
int x,
|
||||
int y,
|
||||
pixman_box16_t *box);
|
||||
pixman_region_overlap_t pixman_region_contains_rectangle (pixman_region16_t *pixman_region16_t,
|
||||
pixman_box16_t *prect);
|
||||
pixman_bool_t pixman_region_not_empty (pixman_region16_t *region);
|
||||
pixman_box16_t * pixman_region_extents (pixman_region16_t *region);
|
||||
int pixman_region_n_rects (pixman_region16_t *region);
|
||||
pixman_box16_t * pixman_region_rectangles (pixman_region16_t *region,
|
||||
int *n_rects);
|
||||
pixman_bool_t pixman_region_equal (pixman_region16_t *region1,
|
||||
pixman_region16_t *region2);
|
||||
pixman_bool_t pixman_region_selfcheck (pixman_region16_t *region);
|
||||
void pixman_region_reset (pixman_region16_t *region,
|
||||
pixman_box16_t *box);
|
||||
|
||||
/*
|
||||
* 32 bit regions
|
||||
*/
|
||||
typedef struct pixman_region32_data pixman_region32_data_t;
|
||||
typedef struct pixman_box32 pixman_box32_t;
|
||||
typedef struct pixman_rectangle32 pixman_rectangle32_t;
|
||||
typedef struct pixman_region32 pixman_region32_t;
|
||||
|
||||
struct pixman_region32_data {
|
||||
long size;
|
||||
long numRects;
|
||||
/* pixman_box32_t rects[size]; in memory but not explicitly declared */
|
||||
};
|
||||
|
||||
struct pixman_rectangle32
|
||||
{
|
||||
int32_t x, y;
|
||||
uint32_t width, height;
|
||||
};
|
||||
|
||||
struct pixman_box32
|
||||
{
|
||||
int32_t x1, y1, x2, y2;
|
||||
};
|
||||
|
||||
struct pixman_region32
|
||||
{
|
||||
pixman_box32_t extents;
|
||||
pixman_region32_data_t *data;
|
||||
};
|
||||
|
||||
/* creation/destruction */
|
||||
void pixman_region32_init (pixman_region32_t *region);
|
||||
void pixman_region32_init_rect (pixman_region32_t *region,
|
||||
int x,
|
||||
int y,
|
||||
unsigned int width,
|
||||
unsigned int height);
|
||||
pixman_bool_t pixman_region32_init_rects (pixman_region32_t *region,
|
||||
pixman_box32_t *boxes,
|
||||
int count);
|
||||
void pixman_region32_init_with_extents (pixman_region32_t *region,
|
||||
pixman_box32_t *extents);
|
||||
void pixman_region32_fini (pixman_region32_t *region);
|
||||
|
||||
|
||||
/* manipulation */
|
||||
void pixman_region32_translate (pixman_region32_t *region,
|
||||
int x,
|
||||
int y);
|
||||
pixman_bool_t pixman_region32_copy (pixman_region32_t *dest,
|
||||
pixman_region32_t *source);
|
||||
pixman_bool_t pixman_region32_intersect (pixman_region32_t *newReg,
|
||||
pixman_region32_t *reg1,
|
||||
pixman_region32_t *reg2);
|
||||
pixman_bool_t pixman_region32_union (pixman_region32_t *newReg,
|
||||
pixman_region32_t *reg1,
|
||||
pixman_region32_t *reg2);
|
||||
pixman_bool_t pixman_region32_union_rect (pixman_region32_t *dest,
|
||||
pixman_region32_t *source,
|
||||
int x,
|
||||
int y,
|
||||
unsigned int width,
|
||||
unsigned int height);
|
||||
pixman_bool_t pixman_region32_subtract (pixman_region32_t *regD,
|
||||
pixman_region32_t *regM,
|
||||
pixman_region32_t *regS);
|
||||
pixman_bool_t pixman_region32_inverse (pixman_region32_t *newReg,
|
||||
pixman_region32_t *reg1,
|
||||
pixman_box32_t *invRect);
|
||||
pixman_bool_t pixman_region32_contains_point (pixman_region32_t *region,
|
||||
int x,
|
||||
int y,
|
||||
pixman_box32_t *box);
|
||||
pixman_region_overlap_t pixman_region32_contains_rectangle (pixman_region32_t *region,
|
||||
pixman_box32_t *prect);
|
||||
pixman_bool_t pixman_region32_not_empty (pixman_region32_t *region);
|
||||
pixman_box32_t * pixman_region32_extents (pixman_region32_t *region);
|
||||
int pixman_region32_n_rects (pixman_region32_t *region);
|
||||
pixman_box32_t * pixman_region32_rectangles (pixman_region32_t *region,
|
||||
int *n_rects);
|
||||
pixman_bool_t pixman_region32_equal (pixman_region32_t *region1,
|
||||
pixman_region32_t *region2);
|
||||
pixman_bool_t pixman_region32_selfcheck (pixman_region32_t *region);
|
||||
void pixman_region32_reset (pixman_region32_t *region,
|
||||
pixman_box32_t *box);
|
||||
|
||||
|
||||
/* Copy / Fill / Misc */
|
||||
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);
|
||||
pixman_bool_t pixman_fill (uint32_t *bits,
|
||||
int stride,
|
||||
int bpp,
|
||||
int x,
|
||||
int y,
|
||||
int width,
|
||||
int height,
|
||||
uint32_t _xor);
|
||||
|
||||
int pixman_version (void);
|
||||
const char* pixman_version_string (void);
|
||||
|
||||
/*
|
||||
* Images
|
||||
*/
|
||||
typedef union pixman_image pixman_image_t;
|
||||
typedef struct pixman_indexed pixman_indexed_t;
|
||||
typedef struct pixman_gradient_stop pixman_gradient_stop_t;
|
||||
|
||||
typedef uint32_t (* pixman_read_memory_func_t) (const void *src, int size);
|
||||
typedef void (* pixman_write_memory_func_t) (void *dst, uint32_t value, int size);
|
||||
|
||||
struct pixman_gradient_stop {
|
||||
pixman_fixed_t x;
|
||||
pixman_color_t color;
|
||||
};
|
||||
|
||||
#define PIXMAN_MAX_INDEXED 256 /* XXX depth must be <= 8 */
|
||||
|
||||
#if PIXMAN_MAX_INDEXED <= 256
|
||||
typedef uint8_t pixman_index_type;
|
||||
#endif
|
||||
|
||||
struct pixman_indexed
|
||||
{
|
||||
pixman_bool_t color;
|
||||
uint32_t rgba[PIXMAN_MAX_INDEXED];
|
||||
pixman_index_type ent[32768];
|
||||
};
|
||||
|
||||
/*
|
||||
* While the protocol is generous in format support, the
|
||||
* sample implementation allows only packed RGB and GBR
|
||||
* representations for data to simplify software rendering,
|
||||
*/
|
||||
#define PIXMAN_FORMAT(bpp,type,a,r,g,b) (((bpp) << 24) | \
|
||||
((type) << 16) | \
|
||||
((a) << 12) | \
|
||||
((r) << 8) | \
|
||||
((g) << 4) | \
|
||||
((b)))
|
||||
|
||||
#define PIXMAN_FORMAT_BPP(f) (((f) >> 24) )
|
||||
#define PIXMAN_FORMAT_TYPE(f) (((f) >> 16) & 0xff)
|
||||
#define PIXMAN_FORMAT_A(f) (((f) >> 12) & 0x0f)
|
||||
#define PIXMAN_FORMAT_R(f) (((f) >> 8) & 0x0f)
|
||||
#define PIXMAN_FORMAT_G(f) (((f) >> 4) & 0x0f)
|
||||
#define PIXMAN_FORMAT_B(f) (((f) ) & 0x0f)
|
||||
#define PIXMAN_FORMAT_RGB(f) (((f) ) & 0xfff)
|
||||
#define PIXMAN_FORMAT_VIS(f) (((f) ) & 0xffff)
|
||||
#define PIXMAN_FORMAT_DEPTH(f) (PIXMAN_FORMAT_A(f) + \
|
||||
PIXMAN_FORMAT_R(f) + \
|
||||
PIXMAN_FORMAT_G(f) + \
|
||||
PIXMAN_FORMAT_B(f))
|
||||
|
||||
#define PIXMAN_TYPE_OTHER 0
|
||||
#define PIXMAN_TYPE_A 1
|
||||
#define PIXMAN_TYPE_ARGB 2
|
||||
#define PIXMAN_TYPE_ABGR 3
|
||||
#define PIXMAN_TYPE_COLOR 4
|
||||
#define PIXMAN_TYPE_GRAY 5
|
||||
#define PIXMAN_TYPE_YUY2 6
|
||||
#define PIXMAN_TYPE_YV12 7
|
||||
|
||||
#define PIXMAN_FORMAT_COLOR(f) (PIXMAN_FORMAT_TYPE(f) & 2)
|
||||
|
||||
/* 32bpp formats */
|
||||
typedef enum {
|
||||
PIXMAN_a8r8g8b8 = PIXMAN_FORMAT(32,PIXMAN_TYPE_ARGB,8,8,8,8),
|
||||
PIXMAN_x8r8g8b8 = PIXMAN_FORMAT(32,PIXMAN_TYPE_ARGB,0,8,8,8),
|
||||
PIXMAN_a8b8g8r8 = PIXMAN_FORMAT(32,PIXMAN_TYPE_ABGR,8,8,8,8),
|
||||
PIXMAN_x8b8g8r8 = PIXMAN_FORMAT(32,PIXMAN_TYPE_ABGR,0,8,8,8),
|
||||
PIXMAN_x2b10g10r10 = PIXMAN_FORMAT(32,PIXMAN_TYPE_ABGR,0,10,10,10),
|
||||
PIXMAN_a2b10g10r10 = PIXMAN_FORMAT(32,PIXMAN_TYPE_ABGR,2,10,10,10),
|
||||
|
||||
/* 24bpp formats */
|
||||
PIXMAN_r8g8b8 = PIXMAN_FORMAT(24,PIXMAN_TYPE_ARGB,0,8,8,8),
|
||||
PIXMAN_b8g8r8 = PIXMAN_FORMAT(24,PIXMAN_TYPE_ABGR,0,8,8,8),
|
||||
|
||||
/* 16bpp formats */
|
||||
PIXMAN_r5g6b5 = PIXMAN_FORMAT(16,PIXMAN_TYPE_ARGB,0,5,6,5),
|
||||
PIXMAN_b5g6r5 = PIXMAN_FORMAT(16,PIXMAN_TYPE_ABGR,0,5,6,5),
|
||||
|
||||
PIXMAN_a1r5g5b5 = PIXMAN_FORMAT(16,PIXMAN_TYPE_ARGB,1,5,5,5),
|
||||
PIXMAN_x1r5g5b5 = PIXMAN_FORMAT(16,PIXMAN_TYPE_ARGB,0,5,5,5),
|
||||
PIXMAN_a1b5g5r5 = PIXMAN_FORMAT(16,PIXMAN_TYPE_ABGR,1,5,5,5),
|
||||
PIXMAN_x1b5g5r5 = PIXMAN_FORMAT(16,PIXMAN_TYPE_ABGR,0,5,5,5),
|
||||
PIXMAN_a4r4g4b4 = PIXMAN_FORMAT(16,PIXMAN_TYPE_ARGB,4,4,4,4),
|
||||
PIXMAN_x4r4g4b4 = PIXMAN_FORMAT(16,PIXMAN_TYPE_ARGB,0,4,4,4),
|
||||
PIXMAN_a4b4g4r4 = PIXMAN_FORMAT(16,PIXMAN_TYPE_ABGR,4,4,4,4),
|
||||
PIXMAN_x4b4g4r4 = PIXMAN_FORMAT(16,PIXMAN_TYPE_ABGR,0,4,4,4),
|
||||
|
||||
/* 8bpp formats */
|
||||
PIXMAN_a8 = PIXMAN_FORMAT(8,PIXMAN_TYPE_A,8,0,0,0),
|
||||
PIXMAN_r3g3b2 = PIXMAN_FORMAT(8,PIXMAN_TYPE_ARGB,0,3,3,2),
|
||||
PIXMAN_b2g3r3 = PIXMAN_FORMAT(8,PIXMAN_TYPE_ABGR,0,3,3,2),
|
||||
PIXMAN_a2r2g2b2 = PIXMAN_FORMAT(8,PIXMAN_TYPE_ARGB,2,2,2,2),
|
||||
PIXMAN_a2b2g2r2 = PIXMAN_FORMAT(8,PIXMAN_TYPE_ABGR,2,2,2,2),
|
||||
|
||||
PIXMAN_c8 = PIXMAN_FORMAT(8,PIXMAN_TYPE_COLOR,0,0,0,0),
|
||||
PIXMAN_g8 = PIXMAN_FORMAT(8,PIXMAN_TYPE_GRAY,0,0,0,0),
|
||||
|
||||
PIXMAN_x4a4 = PIXMAN_FORMAT(8,PIXMAN_TYPE_A,4,0,0,0),
|
||||
|
||||
PIXMAN_x4c4 = PIXMAN_FORMAT(8,PIXMAN_TYPE_COLOR,0,0,0,0),
|
||||
PIXMAN_x4g4 = PIXMAN_FORMAT(8,PIXMAN_TYPE_GRAY,0,0,0,0),
|
||||
|
||||
/* 4bpp formats */
|
||||
PIXMAN_a4 = PIXMAN_FORMAT(4,PIXMAN_TYPE_A,4,0,0,0),
|
||||
PIXMAN_r1g2b1 = PIXMAN_FORMAT(4,PIXMAN_TYPE_ARGB,0,1,2,1),
|
||||
PIXMAN_b1g2r1 = PIXMAN_FORMAT(4,PIXMAN_TYPE_ABGR,0,1,2,1),
|
||||
PIXMAN_a1r1g1b1 = PIXMAN_FORMAT(4,PIXMAN_TYPE_ARGB,1,1,1,1),
|
||||
PIXMAN_a1b1g1r1 = PIXMAN_FORMAT(4,PIXMAN_TYPE_ABGR,1,1,1,1),
|
||||
|
||||
PIXMAN_c4 = PIXMAN_FORMAT(4,PIXMAN_TYPE_COLOR,0,0,0,0),
|
||||
PIXMAN_g4 = PIXMAN_FORMAT(4,PIXMAN_TYPE_GRAY,0,0,0,0),
|
||||
|
||||
/* 1bpp formats */
|
||||
PIXMAN_a1 = PIXMAN_FORMAT(1,PIXMAN_TYPE_A,1,0,0,0),
|
||||
|
||||
PIXMAN_g1 = PIXMAN_FORMAT(1,PIXMAN_TYPE_GRAY,0,0,0,0),
|
||||
|
||||
/* YUV formats */
|
||||
PIXMAN_yuy2 = PIXMAN_FORMAT(16,PIXMAN_TYPE_YUY2,0,0,0,0),
|
||||
PIXMAN_yv12 = PIXMAN_FORMAT(12,PIXMAN_TYPE_YV12,0,0,0,0)
|
||||
} pixman_format_code_t;
|
||||
|
||||
/* Querying supported format values. */
|
||||
pixman_bool_t pixman_format_supported_destination (pixman_format_code_t format);
|
||||
pixman_bool_t pixman_format_supported_source (pixman_format_code_t format);
|
||||
|
||||
/* Constructors */
|
||||
pixman_image_t *pixman_image_create_solid_fill (pixman_color_t *color);
|
||||
pixman_image_t *pixman_image_create_linear_gradient (pixman_point_fixed_t *p1,
|
||||
pixman_point_fixed_t *p2,
|
||||
const pixman_gradient_stop_t *stops,
|
||||
int n_stops);
|
||||
pixman_image_t *pixman_image_create_radial_gradient (pixman_point_fixed_t *inner,
|
||||
pixman_point_fixed_t *outer,
|
||||
pixman_fixed_t inner_radius,
|
||||
pixman_fixed_t outer_radius,
|
||||
const pixman_gradient_stop_t *stops,
|
||||
int n_stops);
|
||||
pixman_image_t *pixman_image_create_conical_gradient (pixman_point_fixed_t *center,
|
||||
pixman_fixed_t angle,
|
||||
const pixman_gradient_stop_t *stops,
|
||||
int n_stops);
|
||||
pixman_image_t *pixman_image_create_bits (pixman_format_code_t format,
|
||||
int width,
|
||||
int height,
|
||||
uint32_t *bits,
|
||||
int rowstride_bytes);
|
||||
|
||||
/* Destructor */
|
||||
pixman_image_t *pixman_image_ref (pixman_image_t *image);
|
||||
pixman_bool_t pixman_image_unref (pixman_image_t *image);
|
||||
|
||||
|
||||
/* Set properties */
|
||||
pixman_bool_t pixman_image_set_clip_region (pixman_image_t *image,
|
||||
pixman_region16_t *region);
|
||||
pixman_bool_t pixman_image_set_clip_region32 (pixman_image_t *image,
|
||||
pixman_region32_t *region);
|
||||
void pixman_image_set_has_client_clip (pixman_image_t *image,
|
||||
pixman_bool_t clien_clip);
|
||||
pixman_bool_t pixman_image_set_transform (pixman_image_t *image,
|
||||
const pixman_transform_t *transform);
|
||||
void pixman_image_set_repeat (pixman_image_t *image,
|
||||
pixman_repeat_t repeat);
|
||||
pixman_bool_t pixman_image_set_filter (pixman_image_t *image,
|
||||
pixman_filter_t filter,
|
||||
const pixman_fixed_t *filter_params,
|
||||
int n_filter_params);
|
||||
void pixman_image_set_source_clipping (pixman_image_t *image,
|
||||
pixman_bool_t source_clipping);
|
||||
void pixman_image_set_alpha_map (pixman_image_t *image,
|
||||
pixman_image_t *alpha_map,
|
||||
int16_t x,
|
||||
int16_t y);
|
||||
void pixman_image_set_component_alpha (pixman_image_t *image,
|
||||
pixman_bool_t component_alpha);
|
||||
void pixman_image_set_accessors (pixman_image_t *image,
|
||||
pixman_read_memory_func_t read_func,
|
||||
pixman_write_memory_func_t write_func);
|
||||
void pixman_image_set_indexed (pixman_image_t *image,
|
||||
const pixman_indexed_t *indexed);
|
||||
uint32_t *pixman_image_get_data (pixman_image_t *image);
|
||||
int pixman_image_get_width (pixman_image_t *image);
|
||||
int pixman_image_get_height (pixman_image_t *image);
|
||||
int pixman_image_get_stride (pixman_image_t *image);
|
||||
int pixman_image_get_depth (pixman_image_t *image);
|
||||
pixman_bool_t pixman_image_fill_rectangles (pixman_op_t op,
|
||||
pixman_image_t *image,
|
||||
pixman_color_t *color,
|
||||
int n_rects,
|
||||
const pixman_rectangle16_t *rects);
|
||||
|
||||
/* Composite */
|
||||
pixman_bool_t pixman_compute_composite_region (pixman_region16_t *pRegion,
|
||||
pixman_image_t *pSrc,
|
||||
pixman_image_t *pMask,
|
||||
pixman_image_t *pDst,
|
||||
int16_t xSrc,
|
||||
int16_t ySrc,
|
||||
int16_t xMask,
|
||||
int16_t yMask,
|
||||
int16_t xDst,
|
||||
int16_t yDst,
|
||||
uint16_t width,
|
||||
uint16_t height);
|
||||
void pixman_image_composite (pixman_op_t op,
|
||||
pixman_image_t *src,
|
||||
pixman_image_t *mask,
|
||||
pixman_image_t *dest,
|
||||
int16_t src_x,
|
||||
int16_t src_y,
|
||||
int16_t mask_x,
|
||||
int16_t mask_y,
|
||||
int16_t dest_x,
|
||||
int16_t dest_y,
|
||||
uint16_t width,
|
||||
uint16_t height);
|
||||
|
||||
/*
|
||||
* Trapezoids
|
||||
*/
|
||||
typedef struct pixman_edge pixman_edge_t;
|
||||
typedef struct pixman_trapezoid pixman_trapezoid_t;
|
||||
typedef struct pixman_trap pixman_trap_t;
|
||||
typedef struct pixman_span_fix pixman_span_fix_t;
|
||||
|
||||
/*
|
||||
* An edge structure. This represents a single polygon edge
|
||||
* and can be quickly stepped across small or large gaps in the
|
||||
* sample grid
|
||||
*/
|
||||
struct pixman_edge
|
||||
{
|
||||
pixman_fixed_t x;
|
||||
pixman_fixed_t e;
|
||||
pixman_fixed_t stepx;
|
||||
pixman_fixed_t signdx;
|
||||
pixman_fixed_t dy;
|
||||
pixman_fixed_t dx;
|
||||
|
||||
pixman_fixed_t stepx_small;
|
||||
pixman_fixed_t stepx_big;
|
||||
pixman_fixed_t dx_small;
|
||||
pixman_fixed_t dx_big;
|
||||
};
|
||||
|
||||
struct pixman_trapezoid
|
||||
{
|
||||
pixman_fixed_t top, bottom;
|
||||
pixman_line_fixed_t left, right;
|
||||
};
|
||||
|
||||
|
||||
/* whether 't' is a well defined not obviously empty trapezoid */
|
||||
#define pixman_trapezoid_valid(t) \
|
||||
((t)->left.p1.y != (t)->left.p2.y && \
|
||||
(t)->right.p1.y != (t)->right.p2.y && \
|
||||
(int) ((t)->bottom - (t)->top) > 0)
|
||||
|
||||
struct pixman_span_fix
|
||||
{
|
||||
pixman_fixed_t l, r, y;
|
||||
};
|
||||
|
||||
struct pixman_trap
|
||||
{
|
||||
pixman_span_fix_t top, bot;
|
||||
};
|
||||
|
||||
pixman_fixed_t pixman_sample_ceil_y (pixman_fixed_t y,
|
||||
int bpp);
|
||||
pixman_fixed_t pixman_sample_floor_y (pixman_fixed_t y,
|
||||
int bpp);
|
||||
void pixman_edge_step (pixman_edge_t *e,
|
||||
int n);
|
||||
void pixman_edge_init (pixman_edge_t *e,
|
||||
int bpp,
|
||||
pixman_fixed_t y_start,
|
||||
pixman_fixed_t x_top,
|
||||
pixman_fixed_t y_top,
|
||||
pixman_fixed_t x_bot,
|
||||
pixman_fixed_t y_bot);
|
||||
void pixman_line_fixed_edge_init (pixman_edge_t *e,
|
||||
int bpp,
|
||||
pixman_fixed_t y,
|
||||
const pixman_line_fixed_t *line,
|
||||
int x_off,
|
||||
int y_off);
|
||||
void pixman_rasterize_edges (pixman_image_t *image,
|
||||
pixman_edge_t *l,
|
||||
pixman_edge_t *r,
|
||||
pixman_fixed_t t,
|
||||
pixman_fixed_t b);
|
||||
void pixman_add_traps (pixman_image_t *image,
|
||||
int16_t x_off,
|
||||
int16_t y_off,
|
||||
int ntrap,
|
||||
pixman_trap_t *traps);
|
||||
void pixman_add_trapezoids (pixman_image_t *image,
|
||||
int16_t x_off,
|
||||
int y_off,
|
||||
int ntraps,
|
||||
const pixman_trapezoid_t *traps);
|
||||
void pixman_rasterize_trapezoid (pixman_image_t *image,
|
||||
const pixman_trapezoid_t *trap,
|
||||
int x_off,
|
||||
int y_off);
|
||||
|
||||
|
||||
#endif /* PIXMAN_H__ */
|
||||
10
uppdev/plugin/pixman/pixman.upp
Normal file
10
uppdev/plugin/pixman/pixman.upp
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
options
|
||||
-I"./lib",
|
||||
-DPACKAGE="Pixman";
|
||||
|
||||
file
|
||||
pixmanlib1.c,
|
||||
pixmanlib2.c,
|
||||
pixmanlib3.c,
|
||||
pixmanlib4.c;
|
||||
|
||||
17
uppdev/plugin/pixman/pixmanlib1.c
Normal file
17
uppdev/plugin/pixman/pixmanlib1.c
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
#ifdef flagWIN32
|
||||
|
||||
#include "lib/pixman-access.c"
|
||||
#include "lib/pixman-combine32.c"
|
||||
#include "lib/pixman-compose.c"
|
||||
#include "lib/pixman-compute-region.c"
|
||||
#include "lib/pixman-edge.c"
|
||||
#include "lib/pixman-matrix.c"
|
||||
#include "lib/pixman-pict.c"
|
||||
#include "lib/pixman-region16.c"
|
||||
#include "lib/pixman-source.c"
|
||||
#include "lib/pixman-timer.c"
|
||||
#include "lib/pixman-trap.c"
|
||||
#include "lib/pixman-utils.c"
|
||||
//#include "lib/pixman-mmx.c"
|
||||
|
||||
#endif
|
||||
9
uppdev/plugin/pixman/pixmanlib2.c
Normal file
9
uppdev/plugin/pixman/pixmanlib2.c
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
#ifdef flagWIN32
|
||||
|
||||
#include "lib/pixman-access-accessors.c"
|
||||
#include "lib/pixman-compose-accessors.c"
|
||||
#include "lib/pixman-edge-accessors.c"
|
||||
#include "lib/pixman-transformed-accessors.c"
|
||||
#include "lib/pixman-region32.c"
|
||||
|
||||
#endif
|
||||
5
uppdev/plugin/pixman/pixmanlib3.c
Normal file
5
uppdev/plugin/pixman/pixmanlib3.c
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
#ifdef flagWIN32
|
||||
|
||||
#include "lib/pixman-combine64.c"
|
||||
|
||||
#endif
|
||||
6
uppdev/plugin/pixman/pixmanlib4.c
Normal file
6
uppdev/plugin/pixman/pixmanlib4.c
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
#ifdef flagWIN32
|
||||
|
||||
#include "lib/pixman-image.c"
|
||||
#include "lib/pixman-transformed.c"
|
||||
|
||||
#endif
|
||||
Loading…
Reference in a new issue