146
25
typedef struct radial_gradient radial_gradient_t;
147
26
typedef struct bits_image bits_image_t;
148
27
typedef struct circle circle_t;
149
typedef struct point point_t;
151
/* FIXME - the types and structures below should be give proper names
155
typedef FASTCALL void (*CombineMaskU32) (uint32_t *src, const uint32_t *mask, int width);
156
typedef FASTCALL void (*CombineFuncU32) (uint32_t *dest, const uint32_t *src, int width);
157
typedef FASTCALL void (*CombineFuncC32) (uint32_t *dest, uint32_t *src, uint32_t *mask, int width);
158
typedef FASTCALL void (*fetchProc32)(bits_image_t *pict, int x, int y, int width,
160
typedef FASTCALL uint32_t (*fetchPixelProc32)(bits_image_t *pict, int offset, int line);
161
typedef FASTCALL void (*storeProc32)(pixman_image_t *, uint32_t *bits,
162
const uint32_t *values, int x, int width,
163
const pixman_indexed_t *);
165
typedef FASTCALL void (*CombineMaskU64) (uint64_t *src, const uint64_t *mask, int width);
166
typedef FASTCALL void (*CombineFuncU64) (uint64_t *dest, const uint64_t *src, int width);
167
typedef FASTCALL void (*CombineFuncC64) (uint64_t *dest, uint64_t *src, uint64_t *mask, int width);
168
typedef FASTCALL void (*fetchProc64)(bits_image_t *pict, int x, int y, int width,
170
typedef FASTCALL uint64_t (*fetchPixelProc64)(bits_image_t *pict, int offset, int line);
171
typedef FASTCALL void (*storeProc64)(pixman_image_t *, uint32_t *bits,
172
const uint64_t *values, int x, int width,
173
const pixman_indexed_t *);
175
typedef struct _FbComposeData {
178
pixman_image_t *mask;
179
pixman_image_t *dest;
190
typedef struct _FbComposeFunctions32 {
191
CombineFuncU32 *combineU;
192
CombineFuncC32 *combineC;
193
CombineMaskU32 combineMaskU;
194
} FbComposeFunctions32;
196
typedef struct _FbComposeFunctions64 {
197
CombineFuncU64 *combineU;
198
CombineFuncC64 *combineC;
199
CombineMaskU64 combineMaskU;
200
} FbComposeFunctions64;
202
extern FbComposeFunctions32 pixman_composeFunctions;
203
extern FbComposeFunctions64 pixman_composeFunctions64;
205
void pixman_composite_rect_general_accessors (const FbComposeData *data,
210
void pixman_composite_rect_general (const FbComposeData *data);
212
fetchProc32 pixman_fetchProcForPicture32 (bits_image_t *);
213
fetchPixelProc32 pixman_fetchPixelProcForPicture32 (bits_image_t *);
214
storeProc32 pixman_storeProcForPicture32 (bits_image_t *);
215
fetchProc32 pixman_fetchProcForPicture32_accessors (bits_image_t *);
216
fetchPixelProc32 pixman_fetchPixelProcForPicture32_accessors (bits_image_t *);
217
storeProc32 pixman_storeProcForPicture32_accessors (bits_image_t *);
219
fetchProc64 pixman_fetchProcForPicture64 (bits_image_t *);
220
fetchPixelProc64 pixman_fetchPixelProcForPicture64 (bits_image_t *);
221
storeProc64 pixman_storeProcForPicture64 (bits_image_t *);
222
fetchProc64 pixman_fetchProcForPicture64_accessors (bits_image_t *);
223
fetchPixelProc64 pixman_fetchPixelProcForPicture64_accessors (bits_image_t *);
224
storeProc64 pixman_storeProcForPicture64_accessors (bits_image_t *);
226
void pixman_expand(uint64_t *dst, const uint32_t *src, pixman_format_code_t, int width);
227
void pixman_contract(uint32_t *dst, const uint64_t *src, int width);
229
void pixmanFetchSourcePict(source_image_t *, int x, int y, int width,
230
uint32_t *buffer, uint32_t *mask, uint32_t maskBits);
231
void pixmanFetchSourcePict64(source_image_t *, int x, int y, int width,
232
uint64_t *buffer, uint64_t *mask, uint32_t maskBits);
234
void fbFetchTransformed(bits_image_t *, int x, int y, int width,
235
uint32_t *buffer, uint32_t *mask, uint32_t maskBits);
236
void fbStoreExternalAlpha(bits_image_t *, int x, int y, int width,
238
void fbFetchExternalAlpha(bits_image_t *, int x, int y, int width,
239
uint32_t *buffer, uint32_t *mask, uint32_t maskBits);
241
void fbFetchTransformed_accessors(bits_image_t *, int x, int y, int width,
242
uint32_t *buffer, uint32_t *mask,
244
void fbStoreExternalAlpha_accessors(bits_image_t *, int x, int y, int width,
246
void fbFetchExternalAlpha_accessors(bits_image_t *, int x, int y, int width,
247
uint32_t *buffer, uint32_t *mask,
250
void fbFetchTransformed64(bits_image_t *, int x, int y, int width,
251
uint64_t *buffer, uint64_t *mask, uint32_t maskBits);
252
void fbStoreExternalAlpha64(bits_image_t *, int x, int y, int width,
254
void fbFetchExternalAlpha64(bits_image_t *, int x, int y, int width,
255
uint64_t *buffer, uint64_t *mask, uint32_t maskBits);
257
void fbFetchTransformed64_accessors(bits_image_t *, int x, int y, int width,
258
uint64_t *buffer, uint64_t *mask,
260
void fbStoreExternalAlpha64_accessors(bits_image_t *, int x, int y, int width,
262
void fbFetchExternalAlpha64_accessors(bits_image_t *, int x, int y, int width,
263
uint64_t *buffer, uint64_t *mask,
29
typedef void (*fetch_scanline_t) (pixman_image_t *image,
37
typedef uint32_t (*fetch_pixel_32_t) (bits_image_t *image,
41
typedef uint64_t (*fetch_pixel_64_t) (bits_image_t *image,
45
typedef void (*store_scanline_t) (bits_image_t * image,
49
const uint32_t *values);
347
141
struct radial_gradient
359
153
struct conical_gradient
362
pixman_point_fixed_t center;
363
pixman_fixed_t angle;
156
pixman_point_fixed_t center;
157
pixman_fixed_t angle;
366
160
struct bits_image
368
image_common_t common;
369
pixman_format_code_t format;
370
const pixman_indexed_t *indexed;
375
int rowstride; /* in number of uint32_t's */
162
image_common_t common;
163
pixman_format_code_t format;
164
const pixman_indexed_t * indexed;
169
int rowstride; /* in number of uint32_t's */
171
/* Fetch a pixel, disregarding alpha maps, transformations etc. */
172
fetch_pixel_32_t fetch_pixel_raw_32;
173
fetch_pixel_64_t fetch_pixel_raw_64;
175
/* Fetch a pixel, taking alpha maps into account */
176
fetch_pixel_32_t fetch_pixel_32;
177
fetch_pixel_64_t fetch_pixel_64;
179
/* Fetch raw scanlines, with no regard for transformations, alpha maps etc. */
180
fetch_scanline_t fetch_scanline_raw_32;
181
fetch_scanline_t fetch_scanline_raw_64;
183
/* Store scanlines with no regard for alpha maps */
184
store_scanline_t store_scanline_raw_32;
185
store_scanline_t store_scanline_raw_64;
187
/* Store a scanline, taking alpha maps into account */
188
store_scanline_t store_scanline_32;
189
store_scanline_t store_scanline_64;
191
/* Used for indirect access to the bits */
192
pixman_read_memory_func_t read_func;
193
pixman_write_memory_func_t write_func;
378
196
union pixman_image
381
image_common_t common;
384
linear_gradient_t linear;
385
conical_gradient_t conical;
386
radial_gradient_t radial;
199
image_common_t common;
201
source_image_t source;
203
linear_gradient_t linear;
204
conical_gradient_t conical;
205
radial_gradient_t radial;
391
#define LOG2_BITMAP_PAD 5
392
#define FB_STIP_SHIFT LOG2_BITMAP_PAD
393
#define FB_STIP_UNIT (1 << FB_STIP_SHIFT)
394
#define FB_STIP_MASK (FB_STIP_UNIT - 1)
395
#define FB_STIP_ALLONES ((uint32_t) -1)
397
#if BITMAP_BIT_ORDER == LSBFirst
398
#define FbScrLeft(x,n) ((x) >> (n))
399
#define FbScrRight(x,n) ((x) << (n))
400
#define FbLeftStipBits(x,n) ((x) & ((((uint32_t) 1) << (n)) - 1))
402
#define FbScrLeft(x,n) ((x) << (n))
403
#define FbScrRight(x,n) ((x) >> (n))
404
#define FbLeftStipBits(x,n) ((x) >> (FB_STIP_UNIT - (n)))
407
#define FbStipLeft(x,n) FbScrLeft(x,n)
408
#define FbStipRight(x,n) FbScrRight(x,n)
409
#define FbStipMask(x,w) (FbStipRight(FB_STIP_ALLONES,(x) & FB_STIP_MASK) & \
410
FbStipLeft(FB_STIP_ALLONES,(FB_STIP_UNIT - ((x)+(w))) & FB_STIP_MASK))
412
#define FbLeftMask(x) ( ((x) & FB_MASK) ? \
413
FbScrRight(FB_ALLONES,(x) & FB_MASK) : 0)
414
#define FbRightMask(x) ( ((FB_UNIT - (x)) & FB_MASK) ? \
415
FbScrLeft(FB_ALLONES,(FB_UNIT - (x)) & FB_MASK) : 0)
417
#define FbMaskBits(x,w,l,n,r) { \
419
r = FbRightMask((x)+n); \
422
n -= FB_UNIT - ((x) & FB_MASK); \
432
#if IMAGE_BYTE_ORDER == MSBFirst
433
#define Fetch24(img, a) ((unsigned long) (a) & 1 ? \
434
((READ(img, a) << 16) | READ(img, (uint16_t *) ((a)+1))) : \
435
((READ(img, (uint16_t *) (a)) << 8) | READ(img, (a)+2)))
436
#define Store24(img,a,v) ((unsigned long) (a) & 1 ? \
437
(WRITE(img, a, (uint8_t) ((v) >> 16)), \
438
WRITE(img, (uint16_t *) ((a)+1), (uint16_t) (v))) : \
439
(WRITE(img, (uint16_t *) (a), (uint16_t) ((v) >> 8)), \
440
WRITE(img, (a)+2, (uint8_t) (v))))
442
#define Fetch24(img,a) ((unsigned long) (a) & 1 ? \
443
(READ(img, a) | (READ(img, (uint16_t *) ((a)+1)) << 8)) : \
444
(READ(img, (uint16_t *) (a)) | (READ(img, (a)+2) << 16)))
445
#define Store24(img,a,v) ((unsigned long) (a) & 1 ? \
446
(WRITE(img, a, (uint8_t) (v)), \
447
WRITE(img, (uint16_t *) ((a)+1), (uint16_t) ((v) >> 8))) : \
448
(WRITE(img, (uint16_t *) (a), (uint16_t) (v)), \
449
WRITE(img, (a)+2, (uint8_t) ((v) >> 16))))
452
#define CvtR8G8B8toY15(s) (((((s) >> 16) & 0xff) * 153 + \
453
(((s) >> 8) & 0xff) * 301 + \
454
(((s) ) & 0xff) * 58) >> 2)
455
#define miCvtR8G8B8to15(s) ((((s) >> 3) & 0x001f) | \
456
(((s) >> 6) & 0x03e0) | \
457
(((s) >> 9) & 0x7c00))
458
#define miIndexToEnt15(mif,rgb15) ((mif)->ent[rgb15])
459
#define miIndexToEnt24(mif,rgb24) miIndexToEnt15(mif,miCvtR8G8B8to15(rgb24))
461
#define miIndexToEntY24(mif,rgb24) ((mif)->ent[CvtR8G8B8toY15(rgb24)])
464
#define FbIntMult(a,b,t) ( (t) = (a) * (b) + 0x80, ( ( ( (t)>>8 ) + (t) )>>8 ) )
465
#define FbIntDiv(a,b) (((uint16_t) (a) * 255) / (b))
467
#define FbGet8(v,i) ((uint16_t) (uint8_t) ((v) >> i))
470
#define cvt8888to0565(s) ((((s) >> 3) & 0x001f) | \
471
(((s) >> 5) & 0x07e0) | \
472
(((s) >> 8) & 0xf800))
473
#define cvt0565to0888(s) (((((s) << 3) & 0xf8) | (((s) >> 2) & 0x7)) | \
474
((((s) << 5) & 0xfc00) | (((s) >> 1) & 0x300)) | \
475
((((s) << 8) & 0xf80000) | (((s) << 3) & 0x70000)))
478
* There are two ways of handling alpha -- either as a single unified value or
479
* a separate value for each component, hence each macro must have two
480
* versions. The unified alpha version has a 'U' at the end of the name,
481
* the component version has a 'C'. Similarly, functions which deal with
482
* this difference will have two versions using the same convention.
485
#define FbOverU(x,y,i,a,t) ((t) = FbIntMult(FbGet8(y,i),(a),(t)) + FbGet8(x,i), \
486
(uint32_t) ((uint8_t) ((t) | (0 - ((t) >> 8)))) << (i))
488
#define FbOverC(x,y,i,a,t) ((t) = FbIntMult(FbGet8(y,i),FbGet8(a,i),(t)) + FbGet8(x,i), \
489
(uint32_t) ((uint8_t) ((t) | (0 - ((t) >> 8)))) << (i))
491
#define FbInU(x,i,a,t) ((uint32_t) FbIntMult(FbGet8(x,i),(a),(t)) << (i))
493
#define FbInC(x,i,a,t) ((uint32_t) FbIntMult(FbGet8(x,i),FbGet8(a,i),(t)) << (i))
495
#define FbAdd(x,y,i,t) ((t) = FbGet8(x,i) + FbGet8(y,i), \
496
(uint32_t) ((uint8_t) ((t) | (0 - ((t) >> 8)))) << (i))
498
#define div_255(x) (((x) + 0x80 + (((x) + 0x80) >> 8)) >> 8)
499
#define div_65535(x) (((x) + 0x8000 + (((x) + 0x8000) >> 16)) >> 16)
501
#define MOD(a,b) ((a) < 0 ? ((b) - ((-(a) - 1) % (b))) - 1 : (a) % (b))
503
#define DIV(a,b) ((((a) < 0) == ((b) < 0)) ? (a) / (b) : \
504
((a) - (b) + 1 - (((b) < 0) << 1)) / (b))
506
#define CLIP(a,b,c) ((a) < (b) ? (b) : ((a) > (c) ? (c) : (a)))
509
/* FIXME: the MOD macro above is equivalent, but faster I think */
510
#define mod(a,b) ((b) == 1 ? 0 : (a) >= 0 ? (a) % (b) : (b) - (-a) % (b))
513
/* FIXME: the (void)__read_func hides lots of warnings (which is what they
514
* are supposed to do), but some of them are real. For example the one
515
* where Fetch4 doesn't have a READ
519
/* Framebuffer access support macros */
520
#define ACCESS_MEM(code) \
522
const image_common_t *const com__ = \
523
(image_common_t *)image; \
525
if (!com__->read_func && !com__->write_func) \
527
const int do_access__ = 0; \
528
const pixman_read_memory_func_t read_func__ = NULL; \
529
const pixman_write_memory_func_t write_func__ = NULL; \
531
(void)write_func__; \
538
const int do_access__ = 1; \
539
const pixman_read_memory_func_t read_func__ = \
541
const pixman_write_memory_func_t write_func__ = \
544
(void)write_func__; \
552
#ifdef PIXMAN_FB_ACCESSORS
554
#define ACCESS(sym) sym##_accessors
556
#define READ(img, ptr) \
557
((img)->common.read_func ((ptr), sizeof(*(ptr))))
558
#define WRITE(img, ptr,val) \
559
((img)->common.write_func ((ptr), (val), sizeof (*(ptr))))
561
#define MEMCPY_WRAPPED(img, dst, src, size) \
564
uint8_t *_dst = (uint8_t*)(dst), *_src = (uint8_t*)(src); \
565
for(_i = 0; _i < size; _i++) { \
566
WRITE((img), _dst +_i, READ((img), _src + _i)); \
570
#define MEMSET_WRAPPED(img, dst, val, size) \
573
uint8_t *_dst = (uint8_t*)(dst); \
574
for(_i = 0; _i < (size_t) size; _i++) { \
575
WRITE((img), _dst +_i, (val)); \
581
#define ACCESS(sym) sym
583
#define READ(img, ptr) (*(ptr))
584
#define WRITE(img, ptr, val) (*(ptr) = (val))
585
#define MEMCPY_WRAPPED(img, dst, src, size) \
586
memcpy(dst, src, size)
587
#define MEMSET_WRAPPED(img, dst, val, size) \
588
memset(dst, val, size)
592
#define fbComposeGetSolid(img, res, fmt) \
211
_pixman_bits_image_setup_raw_accessors (bits_image_t *image);
214
_pixman_image_get_scanline_generic_64 (pixman_image_t *image,
219
const uint32_t *mask,
223
_pixman_image_classify (pixman_image_t *image,
230
_pixman_image_get_scanline_32 (pixman_image_t *image,
235
const uint32_t *mask,
238
/* Even thought the type of buffer is uint32_t *, the function actually expects
239
* a uint64_t *buffer.
242
_pixman_image_get_scanline_64 (pixman_image_t *image,
247
const uint32_t *unused,
251
_pixman_image_store_scanline_32 (bits_image_t * image,
255
const uint32_t *buffer);
257
_pixman_image_fetch_pixels (bits_image_t *image,
261
/* Even though the type of buffer is uint32_t *, the function
262
* actually expects a uint64_t *buffer.
265
_pixman_image_store_scanline_64 (bits_image_t * image,
269
const uint32_t *buffer);
272
_pixman_image_allocate (void);
275
_pixman_init_gradient (gradient_t * gradient,
276
const pixman_gradient_stop_t *stops,
279
_pixman_image_reset_clip_region (pixman_image_t *image);
282
_pixman_image_validate (pixman_image_t *image);
285
_pixman_image_is_opaque (pixman_image_t *image);
288
_pixman_image_is_solid (pixman_image_t *image);
291
_pixman_image_get_solid (pixman_image_t * image,
292
pixman_format_code_t format);
294
#define PIXMAN_IMAGE_GET_LINE(image, x, y, type, out_stride, line, mul) \
595
pixman_format_code_t format__; \
596
if (img->type == SOLID) \
598
format__ = PIXMAN_a8r8g8b8; \
599
(res) = img->solid.color; \
603
uint32_t *bits__ = (img)->bits.bits; \
604
format__ = (img)->bits.format; \
606
switch (PIXMAN_FORMAT_BPP((img)->bits.format)) \
609
(res) = READ(img, (uint32_t *)bits__); \
612
(res) = Fetch24(img, (uint8_t *) bits__); \
615
(res) = READ(img, (uint16_t *) bits__); \
616
(res) = cvt0565to0888(res); \
619
(res) = READ(img, (uint8_t *) bits__); \
620
(res) = (res) << 24; \
623
(res) = READ(img, (uint32_t *) bits__); \
624
(res) = FbLeftStipBits((res),1) ? 0xff000000 : 0x00000000; \
629
/* manage missing src alpha */ \
630
if (!PIXMAN_FORMAT_A((img)->bits.format)) \
631
(res) |= 0xff000000; \
634
/* If necessary, convert RGB <--> BGR. */ \
635
if (PIXMAN_FORMAT_TYPE (format__) != PIXMAN_FORMAT_TYPE(fmt)) \
637
(res) = ((((res) & 0xff000000) >> 0) | \
638
(((res) & 0x00ff0000) >> 16) | \
639
(((res) & 0x0000ff00) >> 0) | \
640
(((res) & 0x000000ff) << 16)); \
645
#define fbComposeGetStart(pict,x,y,type,out_stride,line,mul) do { \
646
uint32_t *__bits__; \
650
__bits__ = pict->bits.bits; \
651
__stride__ = pict->bits.rowstride; \
652
__bpp__ = PIXMAN_FORMAT_BPP(pict->bits.format); \
653
(out_stride) = __stride__ * (int) sizeof (uint32_t) / (int) sizeof (type); \
654
(line) = ((type *) __bits__) + \
655
(out_stride) * (y) + (mul) * (x); \
297
uint32_t *__bits__; \
300
__bits__ = image->bits.bits; \
301
__stride__ = image->bits.rowstride; \
303
__stride__ * (int) sizeof (uint32_t) / (int) sizeof (type); \
305
((type *) __bits__) + (out_stride) * (y) + (mul) * (x); \
659
#define PIXMAN_FORMAT_16BPC(f) (PIXMAN_FORMAT_A(f) > 8 || \
660
PIXMAN_FORMAT_R(f) > 8 || \
661
PIXMAN_FORMAT_G(f) > 8 || \
662
PIXMAN_FORMAT_B(f) > 8)
321
pixman_gradient_stop_t *stops;
326
} pixman_gradient_walker_t;
329
_pixman_gradient_walker_init (pixman_gradient_walker_t *walker,
330
gradient_t * gradient,
331
unsigned int spread);
334
_pixman_gradient_walker_reset (pixman_gradient_walker_t *walker,
335
pixman_fixed_32_32_t pos);
338
_pixman_gradient_walker_pixel (pixman_gradient_walker_t *walker,
339
pixman_fixed_32_32_t x);
667
#define MAX_ALPHA(n) ((1 << (n)) - 1)
668
#define N_Y_FRAC(n) ((n) == 1 ? 1 : (1 << ((n)/2)) - 1)
669
#define N_X_FRAC(n) ((n) == 1 ? 1 : (1 << ((n)/2)) + 1)
671
#define STEP_Y_SMALL(n) (pixman_fixed_1 / N_Y_FRAC(n))
672
#define STEP_Y_BIG(n) (pixman_fixed_1 - (N_Y_FRAC(n) - 1) * STEP_Y_SMALL(n))
674
#define Y_FRAC_FIRST(n) (STEP_Y_SMALL(n) / 2)
675
#define Y_FRAC_LAST(n) (Y_FRAC_FIRST(n) + (N_Y_FRAC(n) - 1) * STEP_Y_SMALL(n))
677
#define STEP_X_SMALL(n) (pixman_fixed_1 / N_X_FRAC(n))
678
#define STEP_X_BIG(n) (pixman_fixed_1 - (N_X_FRAC(n) - 1) * STEP_X_SMALL(n))
680
#define X_FRAC_FIRST(n) (STEP_X_SMALL(n) / 2)
681
#define X_FRAC_LAST(n) (X_FRAC_FIRST(n) + (N_X_FRAC(n) - 1) * STEP_X_SMALL(n))
683
#define RenderSamplesX(x,n) ((n) == 1 ? 0 : (pixman_fixed_frac (x) + X_FRAC_FIRST(n)) / STEP_X_SMALL(n))
686
* Step across a small sample grid gap
688
#define RenderEdgeStepSmall(edge) { \
689
edge->x += edge->stepx_small; \
690
edge->e += edge->dx_small; \
693
edge->e -= edge->dy; \
694
edge->x += edge->signdx; \
699
* Step across a large sample grid gap
701
#define RenderEdgeStepBig(edge) { \
702
edge->x += edge->stepx_big; \
703
edge->e += edge->dx_big; \
706
edge->e -= edge->dy; \
707
edge->x += edge->signdx; \
345
#define MAX_ALPHA(n) ((1 << (n)) - 1)
346
#define N_Y_FRAC(n) ((n) == 1 ? 1 : (1 << ((n) / 2)) - 1)
347
#define N_X_FRAC(n) ((n) == 1 ? 1 : (1 << ((n) / 2)) + 1)
349
#define STEP_Y_SMALL(n) (pixman_fixed_1 / N_Y_FRAC (n))
350
#define STEP_Y_BIG(n) (pixman_fixed_1 - (N_Y_FRAC (n) - 1) * STEP_Y_SMALL (n))
352
#define Y_FRAC_FIRST(n) (STEP_Y_SMALL (n) / 2)
353
#define Y_FRAC_LAST(n) (Y_FRAC_FIRST (n) + (N_Y_FRAC (n) - 1) * STEP_Y_SMALL (n))
355
#define STEP_X_SMALL(n) (pixman_fixed_1 / N_X_FRAC (n))
356
#define STEP_X_BIG(n) (pixman_fixed_1 - (N_X_FRAC (n) - 1) * STEP_X_SMALL (n))
358
#define X_FRAC_FIRST(n) (STEP_X_SMALL (n) / 2)
359
#define X_FRAC_LAST(n) (X_FRAC_FIRST (n) + (N_X_FRAC (n) - 1) * STEP_X_SMALL (n))
361
#define RENDER_SAMPLES_X(x, n) \
362
((n) == 1? 0 : (pixman_fixed_frac (x) + \
363
X_FRAC_FIRST (n)) / STEP_X_SMALL (n))
712
366
pixman_rasterize_edges_accessors (pixman_image_t *image,
719
pixman_image_is_opaque(pixman_image_t *image);
722
pixman_image_can_get_solid (pixman_image_t *image);
725
pixman_compute_composite_region32 (pixman_region32_t * pRegion,
726
pixman_image_t * pSrc,
727
pixman_image_t * pMask,
728
pixman_image_t * pDst,
739
#if defined(__GNUC__) && __GNUC__ >= 4
740
#define PIXMAN_EXPORT __attribute__ ((visibility("default")))
741
/* Sun Studio 8 visibility */
742
#elif defined(__SUNPRO_C) && (__SUNPRO_C >= 0x550)
743
#define PIXMAN_EXPORT __global
745
#define PIXMAN_EXPORT
376
typedef struct pixman_implementation_t pixman_implementation_t;
378
typedef void (*pixman_combine_32_func_t) (pixman_implementation_t *imp,
381
const uint32_t * src,
382
const uint32_t * mask,
385
typedef void (*pixman_combine_64_func_t) (pixman_implementation_t *imp,
388
const uint64_t * src,
389
const uint64_t * mask,
392
typedef void (*pixman_composite_func_t) (pixman_implementation_t *imp,
394
pixman_image_t * src,
395
pixman_image_t * mask,
396
pixman_image_t * dest,
405
typedef pixman_bool_t (*pixman_blt_func_t) (pixman_implementation_t *imp,
418
typedef pixman_bool_t (*pixman_fill_func_t) (pixman_implementation_t *imp,
428
void _pixman_setup_combiner_functions_32 (pixman_implementation_t *imp);
429
void _pixman_setup_combiner_functions_64 (pixman_implementation_t *imp);
431
struct pixman_implementation_t
433
pixman_implementation_t *toplevel;
434
pixman_implementation_t *delegate;
436
pixman_composite_func_t composite;
437
pixman_blt_func_t blt;
438
pixman_fill_func_t fill;
440
pixman_combine_32_func_t combine_32[PIXMAN_OP_LAST];
441
pixman_combine_32_func_t combine_32_ca[PIXMAN_OP_LAST];
442
pixman_combine_64_func_t combine_64[PIXMAN_OP_LAST];
443
pixman_combine_64_func_t combine_64_ca[PIXMAN_OP_LAST];
446
pixman_implementation_t *
447
_pixman_implementation_create (pixman_implementation_t *delegate);
450
_pixman_implementation_combine_32 (pixman_implementation_t *imp,
453
const uint32_t * src,
454
const uint32_t * mask,
457
_pixman_implementation_combine_64 (pixman_implementation_t *imp,
460
const uint64_t * src,
461
const uint64_t * mask,
464
_pixman_implementation_combine_32_ca (pixman_implementation_t *imp,
467
const uint32_t * src,
468
const uint32_t * mask,
471
_pixman_implementation_combine_64_ca (pixman_implementation_t *imp,
474
const uint64_t * src,
475
const uint64_t * mask,
478
_pixman_implementation_composite (pixman_implementation_t *imp,
480
pixman_image_t * src,
481
pixman_image_t * mask,
482
pixman_image_t * dest,
493
_pixman_implementation_blt (pixman_implementation_t *imp,
508
_pixman_implementation_fill (pixman_implementation_t *imp,
518
/* Specific implementations */
519
pixman_implementation_t *
520
_pixman_implementation_create_general (void);
522
pixman_implementation_t *
523
_pixman_implementation_create_fast_path (void);
526
pixman_implementation_t *
527
_pixman_implementation_create_mmx (void);
531
pixman_implementation_t *
532
_pixman_implementation_create_sse2 (void);
536
pixman_implementation_t *
537
_pixman_implementation_create_arm_simd (void);
541
pixman_implementation_t *
542
_pixman_implementation_create_arm_neon (void);
546
pixman_implementation_t *
547
_pixman_implementation_create_vmx (void);
550
pixman_implementation_t *
551
_pixman_choose_implementation (void);
559
/* These "formats" both have depth 0, so they
560
* will never clash with any real ones
562
#define PIXMAN_null PIXMAN_FORMAT (0, 0, 0, 0, 0, 0)
563
#define PIXMAN_solid PIXMAN_FORMAT (0, 1, 0, 0, 0, 0)
565
#define NEED_COMPONENT_ALPHA (1 << 0)
566
#define NEED_PIXBUF (1 << 1)
567
#define NEED_SOLID_MASK (1 << 2)
572
pixman_format_code_t src_format;
573
pixman_format_code_t mask_format;
574
pixman_format_code_t dest_format;
575
pixman_composite_func_t func;
577
} pixman_fast_path_t;
579
/* Memory allocation helpers */
581
pixman_malloc_ab (unsigned int n, unsigned int b);
584
pixman_malloc_abc (unsigned int a, unsigned int b, unsigned int c);
587
pixman_multiply_overflows_int (unsigned int a, unsigned int b);
590
pixman_addition_overflows_int (unsigned int a, unsigned int b);
592
/* Compositing utilities */
594
_pixman_run_fast_path (const pixman_fast_path_t *paths,
595
pixman_implementation_t * imp,
597
pixman_image_t * src,
598
pixman_image_t * mask,
599
pixman_image_t * dest,
610
_pixman_walk_composite_region (pixman_implementation_t *imp,
612
pixman_image_t * src_image,
613
pixman_image_t * mask_image,
614
pixman_image_t * dst_image,
623
pixman_composite_func_t composite_rect);
626
pixman_expand (uint64_t * dst,
627
const uint32_t * src,
628
pixman_format_code_t format,
632
pixman_contract (uint32_t * dst,
748
637
/* Region Helpers */
749
pixman_bool_t pixman_region32_copy_from_region16 (pixman_region32_t *dst,
750
pixman_region16_t *src);
751
pixman_bool_t pixman_region16_copy_from_region32 (pixman_region16_t *dst,
752
pixman_region32_t *src);
753
void pixman_region_internal_set_static_pointers (pixman_box16_t *empty_box,
754
pixman_region16_data_t *empty_data,
755
pixman_region16_data_t *broken_data);
639
pixman_region32_copy_from_region16 (pixman_region32_t *dst,
640
pixman_region16_t *src);
643
pixman_region16_copy_from_region32 (pixman_region16_t *dst,
644
pixman_region32_t *src);
658
# define MIN(a, b) ((a < b) ? a : b)
662
# define MAX(a, b) ((a > b) ? a : b)
665
/* Integer division that rounds towards -infinity */
667
((((a) < 0) == ((b) < 0)) ? (a) / (b) : \
668
((a) - (b) + 1 - (((b) < 0) << 1)) / (b))
670
/* Modulus that produces the remainder wrt. DIV */
671
#define MOD(a, b) ((a) < 0 ? ((b) - ((-(a) - 1) % (b))) - 1 : (a) % (b))
673
#define CLIP(v, low, high) ((v) < (low) ? (low) : ((v) > (high) ? (high) : (v)))
675
/* Conversion between 8888 and 0565 */
677
#define CONVERT_8888_TO_0565(s) \
678
((((s) >> 3) & 0x001f) | \
679
(((s) >> 5) & 0x07e0) | \
680
(((s) >> 8) & 0xf800))
682
#define CONVERT_0565_TO_0888(s) \
683
(((((s) << 3) & 0xf8) | (((s) >> 2) & 0x7)) | \
684
((((s) << 5) & 0xfc00) | (((s) >> 1) & 0x300)) | \
685
((((s) << 8) & 0xf80000) | (((s) << 3) & 0x70000)))
687
#define PIXMAN_FORMAT_IS_WIDE(f) \
688
(PIXMAN_FORMAT_A (f) > 8 || \
689
PIXMAN_FORMAT_R (f) > 8 || \
690
PIXMAN_FORMAT_G (f) > 8 || \
691
PIXMAN_FORMAT_B (f) > 8)
694
* Various debugging code
702
#define return_if_fail(expr) \
707
fprintf (stderr, "In %s: %s failed\n", FUNC, # expr); \
713
#define return_val_if_fail(expr, retval) \
718
fprintf (stderr, "In %s: %s failed\n", FUNC, # expr); \
726
#define return_if_fail(expr) \
734
#define return_val_if_fail(expr, retval) \
760
750
static inline uint64_t
761
751
oil_profile_stamp_rdtsc (void)
764
__asm__ __volatile__("rdtsc\n" : "=A" (ts));
755
__asm__ __volatile__ ("rdtsc\n" : "=A" (ts));
767
759
#define OIL_STAMP oil_profile_stamp_rdtsc
769
typedef struct PixmanTimer PixmanTimer;
761
typedef struct pixman_timer_t pixman_timer_t;
763
struct pixman_timer_t
769
pixman_timer_t *next;
780
772
extern int timer_defined;
781
void pixman_timer_register (PixmanTimer *timer);
783
#define TIMER_BEGIN(tname) \
785
static PixmanTimer timer##tname; \
786
uint64_t begin##tname; \
788
if (!timer##tname.initialized) \
790
timer##tname.initialized = 1; \
791
timer##tname.name = #tname; \
792
pixman_timer_register (&timer##tname); \
795
timer##tname.n_times++; \
796
begin##tname = OIL_STAMP();
798
#define TIMER_END(tname) \
799
timer##tname.total += OIL_STAMP() - begin##tname; \
774
void pixman_timer_register (pixman_timer_t *timer);
776
#define TIMER_BEGIN(tname) \
778
static pixman_timer_t timer ## tname; \
779
uint64_t begin ## tname; \
781
if (!timer ## tname.initialized) \
783
timer ## tname.initialized = 1; \
784
timer ## tname.name = # tname; \
785
pixman_timer_register (&timer ## tname); \
788
timer ## tname.n_times++; \
789
begin ## tname = OIL_STAMP ();
791
#define TIMER_END(tname) \
792
timer ## tname.total += OIL_STAMP () - begin ## tname; \
802
#endif /* PIXMAN_TIMING */
795
#endif /* PIXMAN_TIMERS */
804
797
#endif /* PIXMAN_PRIVATE_H */