mirror of
https://github.com/X11Libre/xserver.git
synced 2026-09-22 20:35:43 +00:00
Merge branch 'master' into XACE-SELINUX
Conflicts: dix/dixutils.c
This commit is contained in:
commit
e2a720c9a1
72 changed files with 1893 additions and 6318 deletions
|
|
@ -69,9 +69,7 @@ libfb_la_SOURCES = \
|
|||
fbutil.c \
|
||||
fbwindow.c \
|
||||
fbpseudocolor.c \
|
||||
fbpseudocolor.h \
|
||||
fbedge.c \
|
||||
fbedgeimp.h
|
||||
fbpseudocolor.h
|
||||
|
||||
libwfb_la_SOURCES = $(libfb_la_SOURCES)
|
||||
|
||||
|
|
|
|||
6
fb/fb.h
6
fb/fb.h
|
|
@ -26,6 +26,8 @@
|
|||
#define _FB_H_
|
||||
|
||||
#include <X11/X.h>
|
||||
#include <pixman/pixman.h>
|
||||
|
||||
#include "scrnintstr.h"
|
||||
#include "pixmap.h"
|
||||
#include "pixmapstr.h"
|
||||
|
|
@ -2147,4 +2149,8 @@ void
|
|||
fbPaintWindow(WindowPtr pWin, RegionPtr pRegion, int what);
|
||||
|
||||
|
||||
pixman_image_t *image_from_pict (PicturePtr pict,
|
||||
Bool has_clip);
|
||||
|
||||
#endif /* _FB_H_ */
|
||||
|
||||
|
|
|
|||
24
fb/fbcopy.c
24
fb/fbcopy.c
|
|
@ -60,21 +60,17 @@ fbCopyNtoN (DrawablePtr pSrcDrawable,
|
|||
|
||||
while (nbox--)
|
||||
{
|
||||
#ifdef USE_MMX
|
||||
#ifndef FB_ACCESS_WRAPPER /* pixman_blt() doesn't support accessors yet */
|
||||
if (pm == FB_ALLONES && alu == GXcopy && !reverse &&
|
||||
!upsidedown && fbHaveMMX())
|
||||
!upsidedown)
|
||||
{
|
||||
if (!fbCopyAreammx (pSrcDrawable,
|
||||
pDstDrawable,
|
||||
|
||||
(pbox->x1 + dx),
|
||||
(pbox->y1 + dy),
|
||||
|
||||
(pbox->x1),
|
||||
(pbox->y1),
|
||||
|
||||
(pbox->x2 - pbox->x1),
|
||||
(pbox->y2 - pbox->y1)))
|
||||
if (!pixman_blt ((uint32_t *)src, (uint32_t *)dst, srcStride, dstStride, srcBpp, dstBpp,
|
||||
(pbox->x1 + dx + srcXoff),
|
||||
(pbox->y1 + dy + srcYoff),
|
||||
(pbox->x1 + srcXoff),
|
||||
(pbox->y1 + srcYoff),
|
||||
(pbox->x2 - pbox->x1),
|
||||
(pbox->y2 - pbox->y1)))
|
||||
goto fallback;
|
||||
else
|
||||
goto next;
|
||||
|
|
@ -98,7 +94,7 @@ fbCopyNtoN (DrawablePtr pSrcDrawable,
|
|||
|
||||
reverse,
|
||||
upsidedown);
|
||||
#ifdef USE_MMX
|
||||
#ifndef FB_ACCESS_WRAPPER
|
||||
next:
|
||||
#endif
|
||||
pbox++;
|
||||
|
|
|
|||
314
fb/fbedge.c
314
fb/fbedge.c
|
|
@ -1,314 +0,0 @@
|
|||
/*
|
||||
* $Id$
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#ifdef HAVE_DIX_CONFIG_H
|
||||
#include <dix-config.h>
|
||||
#endif
|
||||
|
||||
#include "fb.h"
|
||||
|
||||
#ifdef RENDER
|
||||
|
||||
#include "picturestr.h"
|
||||
#include "mipict.h"
|
||||
#include "renderedge.h"
|
||||
#include "fbpict.h"
|
||||
|
||||
/*
|
||||
* 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) \
|
||||
CARD8 *__ap = (CARD8 *) line + ((x) >> 1); \
|
||||
int __ao = (x) & 1
|
||||
|
||||
#define StepAlpha ((__ap += __ao), (__ao ^= 1))
|
||||
|
||||
#define AddAlpha(a) { \
|
||||
CARD8 __o = READ(__ap); \
|
||||
CARD8 __a = (a) + Get4(__o, __ao); \
|
||||
WRITE(__ap, Put4 (__o, __ao, __a | (0 - ((__a) >> 4)))); \
|
||||
}
|
||||
|
||||
#include "fbedgeimp.h"
|
||||
|
||||
#undef AddAlpha
|
||||
#undef StepAlpha
|
||||
#undef DefineAlpha
|
||||
#undef rasterizeEdges
|
||||
#undef N_BITS
|
||||
|
||||
|
||||
/*
|
||||
* 1 bit alpha
|
||||
*/
|
||||
|
||||
#define N_BITS 1
|
||||
#define rasterizeEdges fbRasterizeEdges1
|
||||
|
||||
#include "fbedgeimp.h"
|
||||
|
||||
#undef rasterizeEdges
|
||||
#undef N_BITS
|
||||
|
||||
/*
|
||||
* 8 bit alpha
|
||||
*/
|
||||
|
||||
static INLINE CARD8
|
||||
clip255 (int x)
|
||||
{
|
||||
if (x > 255) return 255;
|
||||
return x;
|
||||
}
|
||||
|
||||
static INLINE void
|
||||
add_saturate_8 (CARD8 *buf, int value, int length)
|
||||
{
|
||||
while (length--)
|
||||
{
|
||||
WRITE(buf, clip255 (READ(buf) + value));
|
||||
buf++;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* 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 (FbBits *buf,
|
||||
int width,
|
||||
int stride,
|
||||
RenderEdge *l,
|
||||
RenderEdge *r,
|
||||
xFixed t,
|
||||
xFixed b)
|
||||
{
|
||||
xFixed y = t;
|
||||
FbBits *line;
|
||||
int fill_start = -1, fill_end = -1;
|
||||
int fill_size = 0;
|
||||
|
||||
line = buf + xFixedToInt (y) * stride;
|
||||
|
||||
for (;;)
|
||||
{
|
||||
CARD8 *ap = (CARD8 *) line;
|
||||
xFixed lx, rx;
|
||||
int lxi, rxi;
|
||||
|
||||
/* clip X */
|
||||
lx = l->x;
|
||||
if (lx < 0)
|
||||
lx = 0;
|
||||
rx = r->x;
|
||||
if (xFixedToInt (rx) >= width)
|
||||
rx = IntToxFixed (width);
|
||||
|
||||
/* Skip empty (or backwards) sections */
|
||||
if (rx > lx)
|
||||
{
|
||||
int lxs, rxs;
|
||||
|
||||
/* Find pixel bounds for span. */
|
||||
lxi = xFixedToInt (lx);
|
||||
rxi = xFixedToInt (rx);
|
||||
|
||||
/* Sample coverage for edge pixels */
|
||||
lxs = RenderSamplesX (lx, 8);
|
||||
rxs = RenderSamplesX (rx, 8);
|
||||
|
||||
/* Add coverage across row */
|
||||
if (lxi == rxi)
|
||||
{
|
||||
WRITE(ap +lxi, clip255 (READ(ap + lxi) + rxs - lxs));
|
||||
}
|
||||
else
|
||||
{
|
||||
WRITE(ap + lxi, clip255 (READ(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);
|
||||
}
|
||||
|
||||
/* Do not add in a 0 alpha here. This check is
|
||||
* necessary to avoid a buffer overrun, (when rx
|
||||
* is exactly on a pixel boundary). */
|
||||
if (rxs)
|
||||
WRITE(ap + rxi, clip255 (READ(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 (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 (xFixedFrac (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 (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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
fbRasterizeEdges (FbBits *buf,
|
||||
int bpp,
|
||||
int width,
|
||||
int stride,
|
||||
RenderEdge *l,
|
||||
RenderEdge *r,
|
||||
xFixed t,
|
||||
xFixed b)
|
||||
{
|
||||
switch (bpp) {
|
||||
case 1:
|
||||
fbRasterizeEdges1 (buf, width, stride, l, r, t, b);
|
||||
break;
|
||||
case 4:
|
||||
fbRasterizeEdges4 (buf, width, stride, l, r, t, b);
|
||||
break;
|
||||
case 8:
|
||||
fbRasterizeEdges8 (buf, width, stride, l, r, t, b);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* RENDER */
|
||||
145
fb/fbedgeimp.h
145
fb/fbedgeimp.h
|
|
@ -1,145 +0,0 @@
|
|||
/*
|
||||
* $Id$
|
||||
*
|
||||
* 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_DIX_CONFIG_H
|
||||
#include <dix-config.h>
|
||||
#endif
|
||||
|
||||
#ifndef rasterizeSpan
|
||||
#endif
|
||||
|
||||
static void
|
||||
rasterizeEdges (FbBits *buf,
|
||||
int width,
|
||||
int stride,
|
||||
RenderEdge *l,
|
||||
RenderEdge *r,
|
||||
xFixed t,
|
||||
xFixed b)
|
||||
{
|
||||
xFixed y = t;
|
||||
FbBits *line;
|
||||
|
||||
line = buf + xFixedToInt (y) * stride;
|
||||
|
||||
for (;;)
|
||||
{
|
||||
xFixed lx, rx;
|
||||
int lxi, rxi;
|
||||
|
||||
/* clip X */
|
||||
lx = l->x;
|
||||
if (lx < 0)
|
||||
lx = 0;
|
||||
rx = r->x;
|
||||
if (xFixedToInt (rx) >= width)
|
||||
rx = IntToxFixed (width);
|
||||
|
||||
/* Skip empty (or backwards) sections */
|
||||
if (rx > lx)
|
||||
{
|
||||
|
||||
/* Find pixel bounds for span */
|
||||
lxi = xFixedToInt (lx);
|
||||
rxi = xFixedToInt (rx);
|
||||
|
||||
#if N_BITS == 1
|
||||
{
|
||||
FbBits *a = line;
|
||||
FbBits startmask, 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(a, READ(a) | startmask);
|
||||
a++;
|
||||
}
|
||||
while (nmiddle--)
|
||||
WRITE(a++, FB_ALLONES);
|
||||
if (endmask)
|
||||
WRITE(a, READ(a) | endmask);
|
||||
}
|
||||
#else
|
||||
{
|
||||
DefineAlpha(line,lxi);
|
||||
int lxs, 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;
|
||||
}
|
||||
/* Do not add in a 0 alpha here. This check is necessary
|
||||
* to avoid a buffer overrun when rx is exactly on a pixel
|
||||
* boundary.
|
||||
*/
|
||||
if (rxs != 0)
|
||||
AddAlpha (rxs);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
if (y == b)
|
||||
break;
|
||||
|
||||
#if N_BITS > 1
|
||||
if (xFixedFrac (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
|
||||
19
fb/fbfill.c
19
fb/fbfill.c
|
|
@ -49,10 +49,13 @@ fbFill (DrawablePtr pDrawable,
|
|||
case FillSolid:
|
||||
#ifdef USE_MMX
|
||||
if (!pPriv->and && fbHaveMMX())
|
||||
if (fbSolidFillmmx (pDrawable, x, y, width, height, pPriv->xor)) {
|
||||
{
|
||||
if (fbFillmmx (dst, dstStride, dstBpp, x + dstXoff, y + dstYoff, width, height, pPriv->xor))
|
||||
{
|
||||
fbFinishAccess (pDrawable);
|
||||
return;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
fbSolid (dst + (y + dstYoff) * dstStride,
|
||||
dstStride,
|
||||
|
|
@ -218,13 +221,13 @@ fbSolidBoxClipped (DrawablePtr pDrawable,
|
|||
#ifdef USE_MMX
|
||||
if (!and && fbHaveMMX())
|
||||
{
|
||||
if (fbSolidFillmmx (pDrawable,
|
||||
partX1, partY1,
|
||||
(partX2 - partX1), (partY2 - partY1),
|
||||
xor)) {
|
||||
fbFinishAccess (pDrawable);
|
||||
return;
|
||||
}
|
||||
if (fbFillmmx (dst, dstStride, dstBpp,
|
||||
partX1 + dstXoff, partX2 + dstYoff, (partX2 - partX1), (partY2 - partY1),
|
||||
xor))
|
||||
{
|
||||
fbFinishAccess (pDrawable);
|
||||
return;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
fbSolid (dst + (partY1 + dstYoff) * dstStride,
|
||||
|
|
|
|||
2607
fb/fbmmx.c
2607
fb/fbmmx.c
File diff suppressed because it is too large
Load diff
264
fb/fbmmx.h
264
fb/fbmmx.h
|
|
@ -44,251 +44,21 @@ Bool fbHaveMMX(void);
|
|||
|
||||
#ifdef USE_MMX
|
||||
|
||||
void fbComposeSetupMMX(void);
|
||||
|
||||
void fbCompositeSolidMask_nx8888x0565Cmmx (CARD8 op,
|
||||
PicturePtr pSrc,
|
||||
PicturePtr pMask,
|
||||
PicturePtr pDst,
|
||||
INT16 xSrc,
|
||||
INT16 ySrc,
|
||||
INT16 xMask,
|
||||
INT16 yMask,
|
||||
INT16 xDst,
|
||||
INT16 yDst,
|
||||
CARD16 width,
|
||||
CARD16 height);
|
||||
void fbCompositeSrcAdd_8888x8888mmx (CARD8 op,
|
||||
PicturePtr pSrc,
|
||||
PicturePtr pMask,
|
||||
PicturePtr pDst,
|
||||
INT16 xSrc,
|
||||
INT16 ySrc,
|
||||
INT16 xMask,
|
||||
INT16 yMask,
|
||||
INT16 xDst,
|
||||
INT16 yDst,
|
||||
CARD16 width,
|
||||
CARD16 height);
|
||||
void fbCompositeSrc_8888x8888mmx (CARD8 op,
|
||||
PicturePtr pSrc,
|
||||
PicturePtr pMask,
|
||||
PicturePtr pDst,
|
||||
INT16 xSrc,
|
||||
INT16 ySrc,
|
||||
INT16 xMask,
|
||||
INT16 yMask,
|
||||
INT16 xDst,
|
||||
INT16 yDst,
|
||||
CARD16 width,
|
||||
CARD16 height);
|
||||
void
|
||||
fbCompositeSolidMaskSrc_nx8x8888mmx (CARD8 op,
|
||||
PicturePtr pSrc,
|
||||
PicturePtr pMask,
|
||||
PicturePtr pDst,
|
||||
INT16 xSrc,
|
||||
INT16 ySrc,
|
||||
INT16 xMask,
|
||||
INT16 yMask,
|
||||
INT16 xDst,
|
||||
INT16 yDst,
|
||||
CARD16 width,
|
||||
CARD16 height);
|
||||
void
|
||||
fbCompositeSrc_x888x8x8888mmx (CARD8 op,
|
||||
PicturePtr pSrc,
|
||||
PicturePtr pMask,
|
||||
PicturePtr pDst,
|
||||
INT16 xSrc,
|
||||
INT16 ySrc,
|
||||
INT16 xMask,
|
||||
INT16 yMask,
|
||||
INT16 xDst,
|
||||
INT16 yDst,
|
||||
CARD16 width,
|
||||
CARD16 height);
|
||||
void fbCompositeSolidMask_nx8888x8888Cmmx (CARD8 op,
|
||||
PicturePtr pSrc,
|
||||
PicturePtr pMask,
|
||||
PicturePtr pDst,
|
||||
INT16 xSrc,
|
||||
INT16 ySrc,
|
||||
INT16 xMask,
|
||||
INT16 yMask,
|
||||
INT16 xDst,
|
||||
INT16 yDst,
|
||||
CARD16 width,
|
||||
CARD16 height);
|
||||
void fbCompositeSolidMask_nx8x8888mmx (CARD8 op,
|
||||
PicturePtr pSrc,
|
||||
PicturePtr pMask,
|
||||
PicturePtr pDst,
|
||||
INT16 xSrc,
|
||||
INT16 ySrc,
|
||||
INT16 xMask,
|
||||
INT16 yMask,
|
||||
INT16 xDst,
|
||||
INT16 yDst,
|
||||
CARD16 width,
|
||||
CARD16 height);
|
||||
void fbCompositeIn_nx8x8mmx (CARD8 op,
|
||||
PicturePtr pSrc,
|
||||
PicturePtr pMask,
|
||||
PicturePtr pDst,
|
||||
INT16 xSrc,
|
||||
INT16 ySrc,
|
||||
INT16 xMask,
|
||||
INT16 yMask,
|
||||
INT16 xDst,
|
||||
INT16 yDst,
|
||||
CARD16 width,
|
||||
CARD16 height);
|
||||
void fbCompositeIn_8x8mmx (CARD8 op,
|
||||
PicturePtr pSrc,
|
||||
PicturePtr pMask,
|
||||
PicturePtr pDst,
|
||||
INT16 xSrc,
|
||||
INT16 ySrc,
|
||||
INT16 xMask,
|
||||
INT16 yMask,
|
||||
INT16 xDst,
|
||||
INT16 yDst,
|
||||
CARD16 width,
|
||||
CARD16 height);
|
||||
void fbCompositeSrcAdd_8888x8x8mmx (CARD8 op,
|
||||
PicturePtr pSrc,
|
||||
PicturePtr pMask,
|
||||
PicturePtr pDst,
|
||||
INT16 xSrc,
|
||||
INT16 ySrc,
|
||||
INT16 xMask,
|
||||
INT16 yMask,
|
||||
INT16 xDst,
|
||||
INT16 yDst,
|
||||
CARD16 width,
|
||||
CARD16 height);
|
||||
void fbCompositeSrcAdd_8000x8000mmx (CARD8 op,
|
||||
PicturePtr pSrc,
|
||||
PicturePtr pMask,
|
||||
PicturePtr pDst,
|
||||
INT16 xSrc,
|
||||
INT16 ySrc,
|
||||
INT16 xMask,
|
||||
INT16 yMask,
|
||||
INT16 xDst,
|
||||
INT16 yDst,
|
||||
CARD16 width,
|
||||
CARD16 height);
|
||||
void fbCompositeSrc_8888RevNPx8888mmx (CARD8 op,
|
||||
PicturePtr pSrc,
|
||||
PicturePtr pMask,
|
||||
PicturePtr pDst,
|
||||
INT16 xSrc,
|
||||
INT16 ySrc,
|
||||
INT16 xMask,
|
||||
INT16 yMask,
|
||||
INT16 xDst,
|
||||
INT16 yDst,
|
||||
CARD16 width,
|
||||
CARD16 height);
|
||||
void fbCompositeSrc_8888x0565mmx (CARD8 op,
|
||||
PicturePtr pSrc,
|
||||
PicturePtr pMask,
|
||||
PicturePtr pDst,
|
||||
INT16 xSrc,
|
||||
INT16 ySrc,
|
||||
INT16 xMask,
|
||||
INT16 yMask,
|
||||
INT16 xDst,
|
||||
INT16 yDst,
|
||||
CARD16 width,
|
||||
CARD16 height);
|
||||
void fbCompositeSrc_8888RevNPx0565mmx (CARD8 op,
|
||||
PicturePtr pSrc,
|
||||
PicturePtr pMask,
|
||||
PicturePtr pDst,
|
||||
INT16 xSrc,
|
||||
INT16 ySrc,
|
||||
INT16 xMask,
|
||||
INT16 yMask,
|
||||
INT16 xDst,
|
||||
INT16 yDst,
|
||||
CARD16 width,
|
||||
CARD16 height);
|
||||
void fbCompositeSolid_nx8888mmx (CARD8 op,
|
||||
PicturePtr pSrc,
|
||||
PicturePtr pMask,
|
||||
PicturePtr pDst,
|
||||
INT16 xSrc,
|
||||
INT16 ySrc,
|
||||
INT16 xMask,
|
||||
INT16 yMask,
|
||||
INT16 xDst,
|
||||
INT16 yDst,
|
||||
CARD16 width,
|
||||
CARD16 height);
|
||||
void fbCompositeSolid_nx0565mmx (CARD8 op,
|
||||
PicturePtr pSrc,
|
||||
PicturePtr pMask,
|
||||
PicturePtr pDst,
|
||||
INT16 xSrc,
|
||||
INT16 ySrc,
|
||||
INT16 xMask,
|
||||
INT16 yMask,
|
||||
INT16 xDst,
|
||||
INT16 yDst,
|
||||
CARD16 width,
|
||||
CARD16 height);
|
||||
void fbCompositeSolidMask_nx8x0565mmx (CARD8 op,
|
||||
PicturePtr pSrc,
|
||||
PicturePtr pMask,
|
||||
PicturePtr pDst,
|
||||
INT16 xSrc,
|
||||
INT16 ySrc,
|
||||
INT16 xMask,
|
||||
INT16 yMask,
|
||||
INT16 xDst,
|
||||
INT16 yDst,
|
||||
CARD16 width,
|
||||
CARD16 height);
|
||||
void fbCompositeSrc_8888x8x8888mmx (CARD8 op,
|
||||
PicturePtr pSrc,
|
||||
PicturePtr pMask,
|
||||
PicturePtr pDst,
|
||||
INT16 xSrc,
|
||||
INT16 ySrc,
|
||||
INT16 xMask,
|
||||
INT16 yMask,
|
||||
INT16 xDst,
|
||||
INT16 yDst,
|
||||
CARD16 width,
|
||||
CARD16 height);
|
||||
Bool fbCopyAreammx (DrawablePtr pSrc,
|
||||
DrawablePtr pDst,
|
||||
int src_x,
|
||||
int src_y,
|
||||
int dst_x,
|
||||
int dst_y,
|
||||
int width,
|
||||
int height);
|
||||
void fbCompositeCopyAreammx (CARD8 op,
|
||||
PicturePtr pSrc,
|
||||
PicturePtr pMask,
|
||||
PicturePtr pDst,
|
||||
INT16 xSrc,
|
||||
INT16 ySrc,
|
||||
INT16 xMask,
|
||||
INT16 yMask,
|
||||
INT16 xDst,
|
||||
INT16 yDst,
|
||||
CARD16 width,
|
||||
CARD16 height);
|
||||
Bool fbSolidFillmmx (DrawablePtr pDraw,
|
||||
int x,
|
||||
int y,
|
||||
int width,
|
||||
int height,
|
||||
FbBits xor);
|
||||
|
||||
Bool fbBltmmx (FbBits *src_bits,
|
||||
FbBits *dst_bits,
|
||||
FbStride src_stride,
|
||||
FbStride dst_stride,
|
||||
int src_bpp,
|
||||
int dst_bpp,
|
||||
int src_x, int src_y,
|
||||
int dst_x, int dst_y,
|
||||
int width, int height);
|
||||
Bool fbFillmmx (FbBits *bits,
|
||||
FbStride stride,
|
||||
int bpp,
|
||||
int x,
|
||||
int y,
|
||||
int width,
|
||||
int height,
|
||||
FbBits xor);
|
||||
#endif /* USE_MMX */
|
||||
|
|
|
|||
482
fb/fbpict.c
482
fb/fbpict.c
|
|
@ -30,7 +30,6 @@
|
|||
#include <string.h>
|
||||
|
||||
#include "fb.h"
|
||||
#include <pixman/pixman.h>
|
||||
|
||||
#ifdef RENDER
|
||||
|
||||
|
|
@ -39,228 +38,6 @@
|
|||
#include "fbpict.h"
|
||||
#include "fbmmx.h"
|
||||
|
||||
static pixman_image_t *
|
||||
create_solid_fill_image (PicturePtr pict)
|
||||
{
|
||||
PictSolidFill *solid = &pict->pSourcePict->solidFill;
|
||||
pixman_color_t color;
|
||||
CARD32 a, r, g, b;
|
||||
|
||||
a = (solid->color & 0xff000000) >> 24;
|
||||
r = (solid->color & 0x00ff0000) >> 16;
|
||||
g = (solid->color & 0x0000ff00) >> 8;
|
||||
b = (solid->color & 0x000000ff) >> 0;
|
||||
|
||||
color.alpha = (a << 8) | a;
|
||||
color.red = (r << 8) | r;
|
||||
color.green = (g << 8) | g;
|
||||
color.blue = (b << 8) | b;
|
||||
|
||||
return pixman_image_create_solid_fill (&color);
|
||||
}
|
||||
|
||||
static pixman_image_t *
|
||||
create_linear_gradient_image (PictGradient *gradient)
|
||||
{
|
||||
PictLinearGradient *linear = (PictLinearGradient *)gradient;
|
||||
pixman_point_fixed_t p1;
|
||||
pixman_point_fixed_t p2;
|
||||
|
||||
p1.x = linear->p1.x;
|
||||
p1.y = linear->p1.y;
|
||||
p2.x = linear->p2.x;
|
||||
p2.y = linear->p2.y;
|
||||
|
||||
return pixman_image_create_linear_gradient (
|
||||
&p1, &p2, (pixman_gradient_stop_t *)gradient->stops, gradient->nstops);
|
||||
}
|
||||
|
||||
static pixman_image_t *
|
||||
create_radial_gradient_image (PictGradient *gradient)
|
||||
{
|
||||
PictRadialGradient *radial = (PictRadialGradient *)gradient;
|
||||
pixman_point_fixed_t c1;
|
||||
pixman_point_fixed_t c2;
|
||||
|
||||
c1.x = radial->c1.x;
|
||||
c1.y = radial->c1.y;
|
||||
c2.x = radial->c2.x;
|
||||
c2.y = radial->c2.y;
|
||||
|
||||
return pixman_image_create_radial_gradient (
|
||||
&c1, &c2, radial->c1.radius,
|
||||
radial->c2.radius,
|
||||
(pixman_gradient_stop_t *)gradient->stops, gradient->nstops);
|
||||
}
|
||||
|
||||
static pixman_image_t *
|
||||
create_conical_gradient_image (PictGradient *gradient)
|
||||
{
|
||||
PictConicalGradient *conical = (PictConicalGradient *)gradient;
|
||||
pixman_point_fixed_t center;
|
||||
|
||||
center.x = conical->center.x;
|
||||
center.y = conical->center.y;
|
||||
|
||||
return pixman_image_create_conical_gradient (
|
||||
¢er, conical->angle, (pixman_gradient_stop_t *)gradient->stops,
|
||||
gradient->nstops);
|
||||
}
|
||||
|
||||
static pixman_image_t *
|
||||
create_bits_picture (PicturePtr pict)
|
||||
{
|
||||
FbBits *bits;
|
||||
FbStride stride;
|
||||
int bpp, xoff, yoff;
|
||||
pixman_image_t *image;
|
||||
|
||||
fbGetDrawable (pict->pDrawable, bits, stride, bpp, xoff, yoff);
|
||||
|
||||
bits += yoff * stride + xoff;
|
||||
|
||||
image = pixman_image_create_bits (
|
||||
pict->format,
|
||||
pict->pDrawable->width, pict->pDrawable->height,
|
||||
(uint32_t *)bits, stride * sizeof (FbStride));
|
||||
|
||||
|
||||
#ifdef FB_ACCESS_WRAPPER
|
||||
#if FB_SHIFT==5
|
||||
|
||||
pixman_image_set_accessors (image,
|
||||
(pixman_read_memory_func_t)wfbReadMemory,
|
||||
(pixman_write_memory_func_t)wfbWriteMemory);
|
||||
|
||||
#else
|
||||
|
||||
#error The pixman library only works when FbBits is 32 bits wide
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* pCompositeClip is undefined for source pictures, so
|
||||
* only set the clip region for pictures with drawables
|
||||
*/
|
||||
pixman_image_set_clip_region (image, pict->pCompositeClip);
|
||||
|
||||
/* Indexed table */
|
||||
if (pict->pFormat->index.devPrivate)
|
||||
pixman_image_set_indexed (image, pict->pFormat->index.devPrivate);
|
||||
|
||||
fbFinishAccess (pict->pDrawable);
|
||||
|
||||
return image;
|
||||
}
|
||||
|
||||
static pixman_image_t *image_from_pict (PicturePtr pict);
|
||||
|
||||
static void
|
||||
set_image_properties (pixman_image_t *image, PicturePtr pict)
|
||||
{
|
||||
pixman_repeat_t repeat;
|
||||
pixman_filter_t filter;
|
||||
|
||||
if (pict->transform)
|
||||
{
|
||||
pixman_image_set_transform (
|
||||
image, (pixman_transform_t *)pict->transform);
|
||||
}
|
||||
|
||||
switch (pict->repeatType)
|
||||
{
|
||||
default:
|
||||
case RepeatNone:
|
||||
repeat = PIXMAN_REPEAT_NONE;
|
||||
break;
|
||||
|
||||
case RepeatPad:
|
||||
repeat = PIXMAN_REPEAT_PAD;
|
||||
break;
|
||||
|
||||
case RepeatNormal:
|
||||
repeat = PIXMAN_REPEAT_NORMAL;
|
||||
break;
|
||||
|
||||
case RepeatReflect:
|
||||
repeat = PIXMAN_REPEAT_REFLECT;
|
||||
break;
|
||||
}
|
||||
|
||||
pixman_image_set_repeat (image, repeat);
|
||||
|
||||
if (pict->alphaMap)
|
||||
{
|
||||
pixman_image_t *alpha_map = image_from_pict (pict->alphaMap);
|
||||
|
||||
pixman_image_set_alpha_map (
|
||||
image, alpha_map, pict->alphaOrigin.x, pict->alphaOrigin.y);
|
||||
|
||||
pixman_image_unref (alpha_map);
|
||||
}
|
||||
|
||||
pixman_image_set_component_alpha (image, pict->componentAlpha);
|
||||
|
||||
switch (pict->filter)
|
||||
{
|
||||
default:
|
||||
case PictFilterNearest:
|
||||
case PictFilterFast:
|
||||
filter = PIXMAN_FILTER_NEAREST;
|
||||
break;
|
||||
|
||||
case PictFilterBilinear:
|
||||
case PictFilterGood:
|
||||
filter = PIXMAN_FILTER_BILINEAR;
|
||||
break;
|
||||
|
||||
case PictFilterConvolution:
|
||||
filter = PIXMAN_FILTER_CONVOLUTION;
|
||||
break;
|
||||
}
|
||||
|
||||
pixman_image_set_filter (image, filter, (pixman_fixed_t *)pict->filter_params, pict->filter_nparams);
|
||||
}
|
||||
|
||||
static pixman_image_t *
|
||||
image_from_pict (PicturePtr pict)
|
||||
{
|
||||
pixman_image_t *image = NULL;
|
||||
|
||||
if (!pict)
|
||||
return NULL;
|
||||
|
||||
if (pict->pDrawable)
|
||||
{
|
||||
image = create_bits_picture (pict);
|
||||
}
|
||||
else if (pict->pSourcePict)
|
||||
{
|
||||
SourcePict *sp = pict->pSourcePict;
|
||||
|
||||
if (sp->type == SourcePictTypeSolidFill)
|
||||
{
|
||||
image = create_solid_fill_image (pict);
|
||||
}
|
||||
else
|
||||
{
|
||||
PictGradient *gradient = &pict->pSourcePict->gradient;
|
||||
|
||||
if (sp->type == SourcePictTypeLinear)
|
||||
image = create_linear_gradient_image (gradient);
|
||||
else if (sp->type == SourcePictTypeRadial)
|
||||
image = create_radial_gradient_image (gradient);
|
||||
else if (sp->type == SourcePictTypeConical)
|
||||
image = create_conical_gradient_image (gradient);
|
||||
}
|
||||
}
|
||||
|
||||
if (image)
|
||||
set_image_properties (image, pict);
|
||||
|
||||
return image;
|
||||
}
|
||||
|
||||
#define mod(a,b) ((b) == 1 ? 0 : (a) >= 0 ? (a) % (b) : (b) - (-a) % (b))
|
||||
|
||||
void
|
||||
|
|
@ -381,26 +158,37 @@ fbComposite (CARD8 op,
|
|||
CARD16 width,
|
||||
CARD16 height)
|
||||
{
|
||||
pixman_region16_t region;
|
||||
pixman_image_t *src, *mask, *dest;
|
||||
|
||||
if (!miComputeCompositeRegion (®ion, pSrc, pMask, pDst, xSrc, ySrc,
|
||||
xMask, yMask, xDst, yDst, width, height))
|
||||
return;
|
||||
xDst += pDst->pDrawable->x;
|
||||
yDst += pDst->pDrawable->y;
|
||||
if (pSrc->pDrawable)
|
||||
{
|
||||
xSrc += pSrc->pDrawable->x;
|
||||
ySrc += pSrc->pDrawable->y;
|
||||
}
|
||||
if (pMask && pMask->pDrawable)
|
||||
{
|
||||
xMask += pMask->pDrawable->x;
|
||||
yMask += pMask->pDrawable->y;
|
||||
}
|
||||
|
||||
src = image_from_pict (pSrc);
|
||||
mask = image_from_pict (pMask);
|
||||
dest = image_from_pict (pDst);
|
||||
miCompositeSourceValidate (pSrc, xSrc, ySrc, width, height);
|
||||
if (pMask)
|
||||
miCompositeSourceValidate (pMask, xMask, yMask, width, height);
|
||||
|
||||
src = image_from_pict (pSrc, TRUE);
|
||||
mask = image_from_pict (pMask, TRUE);
|
||||
dest = image_from_pict (pDst, TRUE);
|
||||
|
||||
if (src && dest && !(pMask && !mask))
|
||||
{
|
||||
pixman_image_composite (op, src, mask, dest,
|
||||
xSrc, ySrc, xMask, yMask, xDst, yDst,
|
||||
width, height, ®ion);
|
||||
width, height);
|
||||
|
||||
}
|
||||
|
||||
pixman_region_fini (®ion);
|
||||
|
||||
if (src)
|
||||
pixman_image_unref (src);
|
||||
if (mask)
|
||||
|
|
@ -430,6 +218,234 @@ fbCompositeGeneral (CARD8 op,
|
|||
|
||||
#endif /* RENDER */
|
||||
|
||||
static pixman_image_t *
|
||||
create_solid_fill_image (PicturePtr pict)
|
||||
{
|
||||
PictSolidFill *solid = &pict->pSourcePict->solidFill;
|
||||
pixman_color_t color;
|
||||
CARD32 a, r, g, b;
|
||||
|
||||
a = (solid->color & 0xff000000) >> 24;
|
||||
r = (solid->color & 0x00ff0000) >> 16;
|
||||
g = (solid->color & 0x0000ff00) >> 8;
|
||||
b = (solid->color & 0x000000ff) >> 0;
|
||||
|
||||
color.alpha = (a << 8) | a;
|
||||
color.red = (r << 8) | r;
|
||||
color.green = (g << 8) | g;
|
||||
color.blue = (b << 8) | b;
|
||||
|
||||
return pixman_image_create_solid_fill (&color);
|
||||
}
|
||||
|
||||
static pixman_image_t *
|
||||
create_linear_gradient_image (PictGradient *gradient)
|
||||
{
|
||||
PictLinearGradient *linear = (PictLinearGradient *)gradient;
|
||||
pixman_point_fixed_t p1;
|
||||
pixman_point_fixed_t p2;
|
||||
|
||||
p1.x = linear->p1.x;
|
||||
p1.y = linear->p1.y;
|
||||
p2.x = linear->p2.x;
|
||||
p2.y = linear->p2.y;
|
||||
|
||||
return pixman_image_create_linear_gradient (
|
||||
&p1, &p2, (pixman_gradient_stop_t *)gradient->stops, gradient->nstops);
|
||||
}
|
||||
|
||||
static pixman_image_t *
|
||||
create_radial_gradient_image (PictGradient *gradient)
|
||||
{
|
||||
PictRadialGradient *radial = (PictRadialGradient *)gradient;
|
||||
pixman_point_fixed_t c1;
|
||||
pixman_point_fixed_t c2;
|
||||
|
||||
c1.x = radial->c1.x;
|
||||
c1.y = radial->c1.y;
|
||||
c2.x = radial->c2.x;
|
||||
c2.y = radial->c2.y;
|
||||
|
||||
return pixman_image_create_radial_gradient (
|
||||
&c1, &c2, radial->c1.radius,
|
||||
radial->c2.radius,
|
||||
(pixman_gradient_stop_t *)gradient->stops, gradient->nstops);
|
||||
}
|
||||
|
||||
static pixman_image_t *
|
||||
create_conical_gradient_image (PictGradient *gradient)
|
||||
{
|
||||
PictConicalGradient *conical = (PictConicalGradient *)gradient;
|
||||
pixman_point_fixed_t center;
|
||||
|
||||
center.x = conical->center.x;
|
||||
center.y = conical->center.y;
|
||||
|
||||
return pixman_image_create_conical_gradient (
|
||||
¢er, conical->angle, (pixman_gradient_stop_t *)gradient->stops,
|
||||
gradient->nstops);
|
||||
}
|
||||
|
||||
static pixman_image_t *
|
||||
create_bits_picture (PicturePtr pict,
|
||||
Bool has_clip)
|
||||
{
|
||||
FbBits *bits;
|
||||
FbStride stride;
|
||||
int bpp, xoff, yoff;
|
||||
pixman_image_t *image;
|
||||
|
||||
fbGetDrawable (pict->pDrawable, bits, stride, bpp, xoff, yoff);
|
||||
|
||||
bits += yoff * stride + xoff;
|
||||
|
||||
image = pixman_image_create_bits (
|
||||
pict->format,
|
||||
pict->pDrawable->width, pict->pDrawable->height,
|
||||
(uint32_t *)bits, stride * sizeof (FbStride));
|
||||
|
||||
|
||||
#ifdef FB_ACCESS_WRAPPER
|
||||
#if FB_SHIFT==5
|
||||
|
||||
pixman_image_set_accessors (image,
|
||||
(pixman_read_memory_func_t)wfbReadMemory,
|
||||
(pixman_write_memory_func_t)wfbWriteMemory);
|
||||
|
||||
#else
|
||||
|
||||
#error The pixman library only works when FbBits is 32 bits wide
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* pCompositeClip is undefined for source pictures, so
|
||||
* only set the clip region for pictures with drawables
|
||||
*/
|
||||
if (has_clip)
|
||||
{
|
||||
if (pict->clientClipType != CT_NONE)
|
||||
pixman_image_set_has_client_clip (image, TRUE);
|
||||
|
||||
pixman_image_set_clip_region (image, pict->pCompositeClip);
|
||||
}
|
||||
|
||||
/* Indexed table */
|
||||
if (pict->pFormat->index.devPrivate)
|
||||
pixman_image_set_indexed (image, pict->pFormat->index.devPrivate);
|
||||
|
||||
fbFinishAccess (pict->pDrawable);
|
||||
|
||||
return image;
|
||||
}
|
||||
|
||||
static void
|
||||
set_image_properties (pixman_image_t *image, PicturePtr pict)
|
||||
{
|
||||
pixman_repeat_t repeat;
|
||||
pixman_filter_t filter;
|
||||
|
||||
if (pict->transform)
|
||||
{
|
||||
pixman_image_set_transform (
|
||||
image, (pixman_transform_t *)pict->transform);
|
||||
}
|
||||
|
||||
switch (pict->repeatType)
|
||||
{
|
||||
default:
|
||||
case RepeatNone:
|
||||
repeat = PIXMAN_REPEAT_NONE;
|
||||
break;
|
||||
|
||||
case RepeatPad:
|
||||
repeat = PIXMAN_REPEAT_PAD;
|
||||
break;
|
||||
|
||||
case RepeatNormal:
|
||||
repeat = PIXMAN_REPEAT_NORMAL;
|
||||
break;
|
||||
|
||||
case RepeatReflect:
|
||||
repeat = PIXMAN_REPEAT_REFLECT;
|
||||
break;
|
||||
}
|
||||
|
||||
pixman_image_set_repeat (image, repeat);
|
||||
|
||||
if (pict->alphaMap)
|
||||
{
|
||||
pixman_image_t *alpha_map = image_from_pict (pict->alphaMap, TRUE);
|
||||
|
||||
pixman_image_set_alpha_map (
|
||||
image, alpha_map, pict->alphaOrigin.x, pict->alphaOrigin.y);
|
||||
|
||||
pixman_image_unref (alpha_map);
|
||||
}
|
||||
|
||||
pixman_image_set_component_alpha (image, pict->componentAlpha);
|
||||
|
||||
switch (pict->filter)
|
||||
{
|
||||
default:
|
||||
case PictFilterNearest:
|
||||
case PictFilterFast:
|
||||
filter = PIXMAN_FILTER_NEAREST;
|
||||
break;
|
||||
|
||||
case PictFilterBilinear:
|
||||
case PictFilterGood:
|
||||
filter = PIXMAN_FILTER_BILINEAR;
|
||||
break;
|
||||
|
||||
case PictFilterConvolution:
|
||||
filter = PIXMAN_FILTER_CONVOLUTION;
|
||||
break;
|
||||
}
|
||||
|
||||
pixman_image_set_filter (image, filter, (pixman_fixed_t *)pict->filter_params, pict->filter_nparams);
|
||||
}
|
||||
|
||||
pixman_image_t *
|
||||
image_from_pict (PicturePtr pict,
|
||||
Bool has_clip)
|
||||
{
|
||||
pixman_image_t *image = NULL;
|
||||
|
||||
if (!pict)
|
||||
return NULL;
|
||||
|
||||
if (pict->pDrawable)
|
||||
{
|
||||
image = create_bits_picture (pict, has_clip);
|
||||
}
|
||||
else if (pict->pSourcePict)
|
||||
{
|
||||
SourcePict *sp = pict->pSourcePict;
|
||||
|
||||
if (sp->type == SourcePictTypeSolidFill)
|
||||
{
|
||||
image = create_solid_fill_image (pict);
|
||||
}
|
||||
else
|
||||
{
|
||||
PictGradient *gradient = &pict->pSourcePict->gradient;
|
||||
|
||||
if (sp->type == SourcePictTypeLinear)
|
||||
image = create_linear_gradient_image (gradient);
|
||||
else if (sp->type == SourcePictTypeRadial)
|
||||
image = create_radial_gradient_image (gradient);
|
||||
else if (sp->type == SourcePictTypeConical)
|
||||
image = create_conical_gradient_image (gradient);
|
||||
}
|
||||
}
|
||||
|
||||
if (image)
|
||||
set_image_properties (image, pict);
|
||||
|
||||
return image;
|
||||
}
|
||||
|
||||
Bool
|
||||
fbPictureInit (ScreenPtr pScreen, PictFormatPtr formats, int nformats)
|
||||
{
|
||||
|
|
|
|||
12
fb/fbpict.h
12
fb/fbpict.h
|
|
@ -412,18 +412,6 @@ fbCompositeGeneral (CARD8 op,
|
|||
CARD16 width,
|
||||
CARD16 height);
|
||||
|
||||
|
||||
/* fbedge.c */
|
||||
void
|
||||
fbRasterizeEdges (FbBits *buf,
|
||||
int bpp,
|
||||
int width,
|
||||
int stride,
|
||||
RenderEdge *l,
|
||||
RenderEdge *r,
|
||||
xFixed t,
|
||||
xFixed b);
|
||||
|
||||
/* fbpict.c */
|
||||
void
|
||||
fbComposite (CARD8 op,
|
||||
|
|
|
|||
101
fb/fbtrap.c
101
fb/fbtrap.c
|
|
@ -42,61 +42,16 @@ fbAddTraps (PicturePtr pPicture,
|
|||
int ntrap,
|
||||
xTrap *traps)
|
||||
{
|
||||
FbBits *buf;
|
||||
int bpp;
|
||||
int width;
|
||||
int stride;
|
||||
int height;
|
||||
int pxoff, pyoff;
|
||||
pixman_image_t *image = image_from_pict (pPicture, FALSE);
|
||||
|
||||
xFixed x_off_fixed;
|
||||
xFixed y_off_fixed;
|
||||
RenderEdge l, r;
|
||||
xFixed t, b;
|
||||
if (!image)
|
||||
return;
|
||||
|
||||
fbGetDrawable (pPicture->pDrawable, buf, stride, bpp, pxoff, pyoff);
|
||||
|
||||
width = pPicture->pDrawable->width;
|
||||
height = pPicture->pDrawable->height;
|
||||
x_off += pxoff;
|
||||
y_off += pyoff;
|
||||
|
||||
x_off_fixed = IntToxFixed(y_off);
|
||||
y_off_fixed = IntToxFixed(y_off);
|
||||
|
||||
while (ntrap--)
|
||||
{
|
||||
t = traps->top.y + y_off_fixed;
|
||||
if (t < 0)
|
||||
t = 0;
|
||||
t = RenderSampleCeilY (t, bpp);
|
||||
|
||||
b = traps->bot.y + y_off_fixed;
|
||||
if (xFixedToInt (b) >= height)
|
||||
b = IntToxFixed (height) - 1;
|
||||
b = RenderSampleFloorY (b, bpp);
|
||||
|
||||
if (b >= t)
|
||||
{
|
||||
/* initialize edge walkers */
|
||||
RenderEdgeInit (&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);
|
||||
|
||||
RenderEdgeInit (&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);
|
||||
|
||||
fbRasterizeEdges (buf, bpp, width, stride, &l, &r, t, b);
|
||||
}
|
||||
traps++;
|
||||
}
|
||||
pixman_add_traps (image, x_off, y_off, ntrap, (pixman_trap_t *)traps);
|
||||
|
||||
fbFinishAccess (pPicture->pDrawable);
|
||||
|
||||
pixman_image_unref (image);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
@ -105,50 +60,16 @@ fbRasterizeTrapezoid (PicturePtr pPicture,
|
|||
int x_off,
|
||||
int y_off)
|
||||
{
|
||||
FbBits *buf;
|
||||
int bpp;
|
||||
int width;
|
||||
int stride;
|
||||
int height;
|
||||
int pxoff, pyoff;
|
||||
pixman_image_t *image = image_from_pict (pPicture, FALSE);
|
||||
|
||||
xFixed x_off_fixed;
|
||||
xFixed y_off_fixed;
|
||||
RenderEdge l, r;
|
||||
xFixed t, b;
|
||||
|
||||
if (!xTrapezoidValid (trap))
|
||||
if (!image)
|
||||
return;
|
||||
|
||||
fbGetDrawable (pPicture->pDrawable, buf, stride, bpp, pxoff, pyoff);
|
||||
|
||||
width = pPicture->pDrawable->width;
|
||||
height = pPicture->pDrawable->height;
|
||||
x_off += pxoff;
|
||||
y_off += pyoff;
|
||||
|
||||
x_off_fixed = IntToxFixed(x_off);
|
||||
y_off_fixed = IntToxFixed(y_off);
|
||||
t = trap->top + y_off_fixed;
|
||||
if (t < 0)
|
||||
t = 0;
|
||||
t = RenderSampleCeilY (t, bpp);
|
||||
|
||||
b = trap->bottom + y_off_fixed;
|
||||
if (xFixedToInt (b) >= height)
|
||||
b = IntToxFixed (height) - 1;
|
||||
b = RenderSampleFloorY (b, bpp);
|
||||
|
||||
if (b >= t)
|
||||
{
|
||||
/* initialize edge walkers */
|
||||
RenderLineFixedEdgeInit (&l, bpp, t, &trap->left, x_off, y_off);
|
||||
RenderLineFixedEdgeInit (&r, bpp, t, &trap->right, x_off, y_off);
|
||||
|
||||
fbRasterizeEdges (buf, bpp, width, stride, &l, &r, t, b);
|
||||
}
|
||||
pixman_rasterize_trapezoid (image, (pixman_trapezoid_t *)trap, x_off, y_off);
|
||||
|
||||
fbFinishAccess (pPicture->pDrawable);
|
||||
|
||||
pixman_image_unref (image);
|
||||
}
|
||||
|
||||
static int
|
||||
|
|
|
|||
|
|
@ -233,26 +233,27 @@ fbFillRegionSolid (DrawablePtr pDrawable,
|
|||
while (n--)
|
||||
{
|
||||
#ifdef USE_MMX
|
||||
if (!has_mmx || !fbSolidFillmmx (pDrawable,
|
||||
pbox->x1,
|
||||
pbox->y1,
|
||||
(pbox->x2 - pbox->x1),
|
||||
(pbox->y2 - pbox->y1), xor)) {
|
||||
if (!has_mmx || !fbFillmmx (dst, dstStride, dstBpp,
|
||||
pbox->x1 + dstXoff, pbox->y1 + dstYoff,
|
||||
(pbox->x2 - pbox->x1),
|
||||
(pbox->y2 - pbox->y1),
|
||||
xor))
|
||||
{
|
||||
#endif
|
||||
fbSolid (dst + (pbox->y1 + dstYoff) * dstStride,
|
||||
dstStride,
|
||||
(pbox->x1 + dstXoff) * dstBpp,
|
||||
dstBpp,
|
||||
(pbox->x2 - pbox->x1) * dstBpp,
|
||||
pbox->y2 - pbox->y1,
|
||||
and, xor);
|
||||
fbSolid (dst + (pbox->y1 + dstYoff) * dstStride,
|
||||
dstStride,
|
||||
(pbox->x1 + dstXoff) * dstBpp,
|
||||
dstBpp,
|
||||
(pbox->x2 - pbox->x1) * dstBpp,
|
||||
pbox->y2 - pbox->y1,
|
||||
and, xor);
|
||||
#ifdef USE_MMX
|
||||
}
|
||||
#endif
|
||||
fbValidateDrawable (pDrawable);
|
||||
pbox++;
|
||||
}
|
||||
|
||||
|
||||
fbFinishAccess (pDrawable);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -184,9 +184,11 @@
|
|||
#define fbUnmapWindow wfbUnmapWindow
|
||||
#define fbUnrealizeFont wfbUnrealizeFont
|
||||
#define fbValidateGC wfbValidateGC
|
||||
#define fbWalkCompositeRegion wfbWalkCompositeRegion
|
||||
#define fbWinPrivateIndex wfbWinPrivateIndex
|
||||
#define fbZeroLine wfbZeroLine
|
||||
#define fbZeroSegment wfbZeroSegment
|
||||
#define image_from_pict wfb_image_from_pict
|
||||
#define xxScrPrivateIndex wfbxxScrPrivateIndex
|
||||
#define xxGCPrivateIndex wfbxxGCPrivateIndex
|
||||
#define xxColormapPrivateIndex wfbxxColormapPrivateIndex
|
||||
|
|
|
|||
Loading…
Reference in a new issue