diff options
Diffstat (limited to 'fb/fbpict.h')
-rw-r--r-- | fb/fbpict.h | 103 |
1 files changed, 94 insertions, 9 deletions
diff --git a/fb/fbpict.h b/fb/fbpict.h index 9ecc7a909..82f722c41 100644 --- a/fb/fbpict.h +++ b/fb/fbpict.h @@ -25,6 +25,8 @@ #ifndef _FBPICT_H_ #define _FBPICT_H_ +#include "renderedge.h" + #define FbIntMult(a,b,t) ( (t) = (a) * (b) + 0x80, ( ( ( (t)>>8 ) + (t) )>>8 ) ) #define FbIntDiv(a,b) (((CARD16) (a) * 255) / (b)) @@ -70,6 +72,70 @@ typedef void (*CompositeFunc) (CARD8 op, CARD16 width, CARD16 height); +#define fbComposeGetSolid(pict, bits) { \ + FbBits *__bits__; \ + FbStride __stride__; \ + int __bpp__; \ + int __xoff__,__yoff__; \ +\ + fbGetDrawable((pict)->pDrawable,__bits__,__stride__,__bpp__,__xoff__,__yoff__); \ + switch (__bpp__) { \ + case 32: \ + (bits) = *(CARD32 *) __bits__; \ + break; \ + case 24: \ + (bits) = Fetch24 ((CARD8 *) __bits__); \ + break; \ + case 16: \ + (bits) = *(CARD16 *) __bits__; \ + (bits) = cvt0565to8888(bits); \ + break; \ + default: \ + return; \ + } \ + /* manage missing src alpha */ \ + if ((pict)->pFormat->direct.alphaMask == 0) \ + (bits) |= 0xff000000; \ +} + +#define fbComposeGetStart(pict,x,y,type,stride,line,mul) {\ + FbBits *__bits__; \ + FbStride __stride__; \ + int __bpp__; \ + int __xoff__,__yoff__; \ +\ + fbGetDrawable((pict)->pDrawable,__bits__,__stride__,__bpp__,__xoff__,__yoff__); \ + (stride) = __stride__ * sizeof (FbBits) / sizeof (type); \ + (line) = ((type *) __bits__) + (stride) * ((y) - __yoff__) + (mul) * ((x) - __xoff__); \ +} +#define cvt8888to0565(s) ((((s) >> 3) & 0x001f) | \ + (((s) >> 5) & 0x07e0) | \ + (((s) >> 8) & 0xf800)) +#define cvt0565to8888(s) (((((s) << 3) & 0xf8) | (((s) >> 2) & 0x7)) | \ + ((((s) << 5) & 0xfc00) | (((s) >> 1) & 0x300)) | \ + ((((s) << 8) & 0xf80000) | (((s) << 3) & 0x70000))) + +#if IMAGE_BYTE_ORDER == MSBFirst +#define Fetch24(a) ((unsigned long) (a) & 1 ? \ + ((*(a) << 16) | *((CARD16 *) ((a)+1))) : \ + ((*((CARD16 *) (a)) << 8) | *((a)+2))) +#define Store24(a,v) ((unsigned long) (a) & 1 ? \ + ((*(a) = (CARD8) ((v) >> 16)), \ + (*((CARD16 *) ((a)+1)) = (CARD16) (v))) : \ + ((*((CARD16 *) (a)) = (CARD16) ((v) >> 8)), \ + (*((a)+2) = (CARD8) (v)))) +#else +#define Fetch24(a) ((unsigned long) (a) & 1 ? \ + ((*(a)) | (*((CARD16 *) ((a)+1)) << 8)) : \ + ((*((CARD16 *) (a))) | (*((a)+2) << 16))) +#define Store24(a,v) ((unsigned long) (a) & 1 ? \ + ((*(a) = (CARD8) (v)), \ + (*((CARD16 *) ((a)+1)) = (CARD16) ((v) >> 8))) : \ + ((*((CARD16 *) (a)) = (CARD16) (v)),\ + (*((a)+2) = (CARD8) ((v) >> 16)))) +#endif + + typedef struct _FbCompositeOperand FbCompositeOperand; typedef CARD32 (*FbCompositeFetch)(FbCompositeOperand *op); @@ -333,15 +399,8 @@ fbCombineDisjointOverC (FbCompositeOperand *src, FbCompositeOperand *msk, FbCompositeOperand *dst); -void -fbCombineDisjointOverReverseU (FbCompositeOperand *src, - FbCompositeOperand *msk, - FbCompositeOperand *dst); - -void -fbCombineDisjointOverReverseC (FbCompositeOperand *src, - FbCompositeOperand *msk, - FbCompositeOperand *dst); +#define fbCombineDisjointOverReverseU fbCombineSaturateU +#define fbCombineDisjointOverReverseC fbCombineSaturateC void fbCombineDisjointInU (FbCompositeOperand *src, @@ -760,6 +819,17 @@ fbCompositeGeneral (CARD8 op, CARD16 height); +/* fbedge.c */ +void +fbRasterizeEdges (FbBits *buf, + int bpp, + int width, + int stride, + RenderEdge *l, + RenderEdge *r, + xFixed t, + xFixed b); + /* fbpict.c */ CARD32 fbOver (CARD32 x, CARD32 y); @@ -967,10 +1037,25 @@ fbComposite (CARD8 op, CARD16 height); /* fbtrap.c */ + +void +fbAddTraps (PicturePtr pPicture, + INT16 xOff, + INT16 yOff, + int ntrap, + xTrap *traps); + void fbRasterizeTrapezoid (PicturePtr alpha, xTrapezoid *trap, int x_off, int y_off); +void +fbAddTriangles (PicturePtr pPicture, + INT16 xOff, + INT16 yOff, + int ntri, + xTriangle *tris); + #endif /* _FBPICT_H_ */ |