3 * Copyright © 2000 Keith Packard, member of The XFree86 Project, Inc.
4 * 2005 Lars Knoll & Zack Rusin, Trolltech
5 * 2008 Aaron Plattner, NVIDIA Corporation
7 * Permission to use, copy, modify, distribute, and sell this software and its
8 * documentation for any purpose is hereby granted without fee, provided that
9 * the above copyright notice appear in all copies and that both that
10 * copyright notice and this permission notice appear in supporting
11 * documentation, and that the name of Keith Packard not be used in
12 * advertising or publicity pertaining to distribution of the software without
13 * specific, written prior permission. Keith Packard makes no
14 * representations about the suitability of this software for any purpose. It
15 * is provided "as is" without express or implied warranty.
17 * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
18 * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
19 * FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
20 * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
21 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
22 * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
23 * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
35 #include "pixman-private.h"
36 #include "pixman-accessor.h"
38 #define CONVERT_RGB24_TO_Y15(s) \
39 (((((s) >> 16) & 0xff) * 153 + \
40 (((s) >> 8) & 0xff) * 301 + \
41 (((s) ) & 0xff) * 58) >> 2)
43 #define CONVERT_RGB24_TO_RGB15(s) \
44 ((((s) >> 3) & 0x001f) | \
45 (((s) >> 6) & 0x03e0) | \
46 (((s) >> 9) & 0x7c00))
48 #define RGB15_TO_ENTRY(mif,rgb15) \
51 #define RGB24_TO_ENTRY(mif,rgb24) \
52 RGB15_TO_ENTRY (mif,CONVERT_RGB24_TO_RGB15 (rgb24))
54 #define RGB24_TO_ENTRY_Y(mif,rgb24) \
55 ((mif)->ent[CONVERT_RGB24_TO_Y15 (rgb24)])
58 * YV12 setup and access macros
61 #define YV12_SETUP(image) \
62 bits_image_t *__bits_image = (bits_image_t *)image; \
63 uint32_t *bits = __bits_image->bits; \
64 int stride = __bits_image->rowstride; \
65 int offset0 = stride < 0 ? \
66 ((-stride) >> 1) * ((__bits_image->height - 1) >> 1) - stride : \
67 stride * __bits_image->height; \
68 int offset1 = stride < 0 ? \
69 offset0 + ((-stride) >> 1) * ((__bits_image->height) >> 1) : \
70 offset0 + (offset0 >> 2)
72 /* Note no trailing semicolon on the above macro; if it's there, then
73 * the typical usage of YV12_SETUP(image); will have an extra trailing ;
74 * that some compilers will interpret as a statement -- and then any further
75 * variable declarations will cause an error.
78 #define YV12_Y(line) \
79 ((uint8_t *) ((bits) + (stride) * (line)))
81 #define YV12_U(line) \
82 ((uint8_t *) ((bits) + offset1 + \
83 ((stride) >> 1) * ((line) >> 1)))
85 #define YV12_V(line) \
86 ((uint8_t *) ((bits) + offset0 + \
87 ((stride) >> 1) * ((line) >> 1)))
89 /********************************** Fetch ************************************/
92 fetch_scanline_a8r8g8b8 (pixman_image_t *image,
100 const uint32_t *bits = image->bits.bits + y * image->bits.rowstride;
102 MEMCPY_WRAPPED (image,
103 buffer, (const uint32_t *)bits + x,
104 width * sizeof(uint32_t));
108 fetch_scanline_x8r8g8b8 (pixman_image_t *image,
113 const uint32_t *mask,
116 const uint32_t *bits = image->bits.bits + y * image->bits.rowstride;
117 const uint32_t *pixel = (const uint32_t *)bits + x;
118 const uint32_t *end = pixel + width;
121 *buffer++ = READ (image, pixel++) | 0xff000000;
125 fetch_scanline_a8b8g8r8 (pixman_image_t *image,
130 const uint32_t *mask,
133 const uint32_t *bits = image->bits.bits + y * image->bits.rowstride;
134 const uint32_t *pixel = (uint32_t *)bits + x;
135 const uint32_t *end = pixel + width;
139 uint32_t p = READ (image, pixel++);
141 *buffer++ = (p & 0xff00ff00) |
148 fetch_scanline_x8b8g8r8 (pixman_image_t *image,
153 const uint32_t *mask,
156 const uint32_t *bits = image->bits.bits + y * image->bits.rowstride;
157 const uint32_t *pixel = (uint32_t *)bits + x;
158 const uint32_t *end = pixel + width;
162 uint32_t p = READ (image, pixel++);
164 *buffer++ = 0xff000000 |
172 fetch_scanline_b8g8r8a8 (pixman_image_t *image,
177 const uint32_t *mask,
180 const uint32_t *bits = image->bits.bits + y * image->bits.rowstride;
181 const uint32_t *pixel = (uint32_t *)bits + x;
182 const uint32_t *end = pixel + width;
186 uint32_t p = READ (image, pixel++);
188 *buffer++ = (((p & 0xff000000) >> 24) |
189 ((p & 0x00ff0000) >> 8) |
190 ((p & 0x0000ff00) << 8) |
191 ((p & 0x000000ff) << 24));
196 fetch_scanline_b8g8r8x8 (pixman_image_t *image,
201 const uint32_t *mask,
204 const uint32_t *bits = image->bits.bits + y * image->bits.rowstride;
205 const uint32_t *pixel = (uint32_t *)bits + x;
206 const uint32_t *end = pixel + width;
210 uint32_t p = READ (image, pixel++);
212 *buffer++ = (0xff000000 |
213 ((p & 0xff000000) >> 24) |
214 ((p & 0x00ff0000) >> 8) |
215 ((p & 0x0000ff00) << 8));
219 /* Expects a uint64_t buffer */
221 fetch_scanline_a2r10g10b10 (pixman_image_t *image,
226 const uint32_t *mask,
229 const uint32_t *bits = image->bits.bits + y * image->bits.rowstride;
230 const uint32_t *pixel = bits + x;
231 const uint32_t *end = pixel + width;
232 uint64_t *buffer = (uint64_t *)b;
236 uint32_t p = READ (image, pixel++);
237 uint64_t a = p >> 30;
238 uint64_t r = (p >> 20) & 0x3ff;
239 uint64_t g = (p >> 10) & 0x3ff;
240 uint64_t b = p & 0x3ff;
251 *buffer++ = a << 48 | r << 32 | g << 16 | b;
255 /* Expects a uint64_t buffer */
257 fetch_scanline_x2r10g10b10 (pixman_image_t *image,
262 const uint32_t *mask,
265 const uint32_t *bits = image->bits.bits + y * image->bits.rowstride;
266 const uint32_t *pixel = (uint32_t *)bits + x;
267 const uint32_t *end = pixel + width;
268 uint64_t *buffer = (uint64_t *)b;
272 uint32_t p = READ (image, pixel++);
273 uint64_t r = (p >> 20) & 0x3ff;
274 uint64_t g = (p >> 10) & 0x3ff;
275 uint64_t b = p & 0x3ff;
281 *buffer++ = 0xffffULL << 48 | r << 32 | g << 16 | b;
285 /* Expects a uint64_t buffer */
287 fetch_scanline_a2b10g10r10 (pixman_image_t *image,
292 const uint32_t *mask,
295 const uint32_t *bits = image->bits.bits + y * image->bits.rowstride;
296 const uint32_t *pixel = bits + x;
297 const uint32_t *end = pixel + width;
298 uint64_t *buffer = (uint64_t *)b;
302 uint32_t p = READ (image, pixel++);
303 uint64_t a = p >> 30;
304 uint64_t b = (p >> 20) & 0x3ff;
305 uint64_t g = (p >> 10) & 0x3ff;
306 uint64_t r = p & 0x3ff;
317 *buffer++ = a << 48 | r << 32 | g << 16 | b;
321 /* Expects a uint64_t buffer */
323 fetch_scanline_x2b10g10r10 (pixman_image_t *image,
328 const uint32_t *mask,
331 const uint32_t *bits = image->bits.bits + y * image->bits.rowstride;
332 const uint32_t *pixel = (uint32_t *)bits + x;
333 const uint32_t *end = pixel + width;
334 uint64_t *buffer = (uint64_t *)b;
338 uint32_t p = READ (image, pixel++);
339 uint64_t b = (p >> 20) & 0x3ff;
340 uint64_t g = (p >> 10) & 0x3ff;
341 uint64_t r = p & 0x3ff;
347 *buffer++ = 0xffffULL << 48 | r << 32 | g << 16 | b;
352 fetch_scanline_r8g8b8 (pixman_image_t *image,
357 const uint32_t *mask,
360 const uint32_t *bits = image->bits.bits + y * image->bits.rowstride;
361 const uint8_t *pixel = (const uint8_t *)bits + 3 * x;
362 const uint8_t *end = pixel + 3 * width;
366 uint32_t b = 0xff000000;
368 #ifdef WORDS_BIGENDIAN
369 b |= (READ (image, pixel++) << 16);
370 b |= (READ (image, pixel++) << 8);
371 b |= (READ (image, pixel++));
373 b |= (READ (image, pixel++));
374 b |= (READ (image, pixel++) << 8);
375 b |= (READ (image, pixel++) << 16);
383 fetch_scanline_b8g8r8 (pixman_image_t *image,
388 const uint32_t *mask,
391 const uint32_t *bits = image->bits.bits + y * image->bits.rowstride;
392 const uint8_t *pixel = (const uint8_t *)bits + 3 * x;
393 const uint8_t *end = pixel + 3 * width;
397 uint32_t b = 0xff000000;
398 #ifdef WORDS_BIGENDIAN
399 b |= (READ (image, pixel++));
400 b |= (READ (image, pixel++) << 8);
401 b |= (READ (image, pixel++) << 16);
403 b |= (READ (image, pixel++) << 16);
404 b |= (READ (image, pixel++) << 8);
405 b |= (READ (image, pixel++));
412 fetch_scanline_r5g6b5 (pixman_image_t *image,
417 const uint32_t *mask,
420 const uint32_t *bits = image->bits.bits + y * image->bits.rowstride;
421 const uint16_t *pixel = (const uint16_t *)bits + x;
422 const uint16_t *end = pixel + width;
426 uint32_t p = READ (image, pixel++);
427 uint32_t r = (((p) << 3) & 0xf8) |
428 (((p) << 5) & 0xfc00) |
429 (((p) << 8) & 0xf80000);
431 r |= (r >> 5) & 0x70007;
432 r |= (r >> 6) & 0x300;
434 *buffer++ = 0xff000000 | r;
439 fetch_scanline_b5g6r5 (pixman_image_t *image,
444 const uint32_t *mask,
447 const uint32_t *bits = image->bits.bits + y * image->bits.rowstride;
448 const uint16_t *pixel = (const uint16_t *)bits + x;
449 const uint16_t *end = pixel + width;
453 uint32_t p = READ (image, pixel++);
456 b = ((p & 0xf800) | ((p & 0xe000) >> 5)) >> 8;
457 g = ((p & 0x07e0) | ((p & 0x0600) >> 6)) << 5;
458 r = ((p & 0x001c) | ((p & 0x001f) << 5)) << 14;
460 *buffer++ = 0xff000000 | r | g | b;
465 fetch_scanline_a1r5g5b5 (pixman_image_t *image,
470 const uint32_t *mask,
473 const uint32_t *bits = image->bits.bits + y * image->bits.rowstride;
474 const uint16_t *pixel = (const uint16_t *)bits + x;
475 const uint16_t *end = pixel + width;
479 uint32_t p = READ (image, pixel++);
482 a = (uint32_t) ((uint8_t) (0 - ((p & 0x8000) >> 15))) << 24;
483 r = ((p & 0x7c00) | ((p & 0x7000) >> 5)) << 9;
484 g = ((p & 0x03e0) | ((p & 0x0380) >> 5)) << 6;
485 b = ((p & 0x001c) | ((p & 0x001f) << 5)) >> 2;
487 *buffer++ = a | r | g | b;
492 fetch_scanline_x1r5g5b5 (pixman_image_t *image,
497 const uint32_t *mask,
500 const uint32_t *bits = image->bits.bits + y * image->bits.rowstride;
501 const uint16_t *pixel = (const uint16_t *)bits + x;
502 const uint16_t *end = pixel + width;
506 uint32_t p = READ (image, pixel++);
509 r = ((p & 0x7c00) | ((p & 0x7000) >> 5)) << 9;
510 g = ((p & 0x03e0) | ((p & 0x0380) >> 5)) << 6;
511 b = ((p & 0x001c) | ((p & 0x001f) << 5)) >> 2;
513 *buffer++ = 0xff000000 | r | g | b;
518 fetch_scanline_a1b5g5r5 (pixman_image_t *image,
523 const uint32_t *mask,
526 const uint32_t *bits = image->bits.bits + y * image->bits.rowstride;
527 const uint16_t *pixel = (const uint16_t *)bits + x;
528 const uint16_t *end = pixel + width;
533 uint32_t p = READ (image, pixel++);
535 a = (uint32_t) ((uint8_t) (0 - ((p & 0x8000) >> 15))) << 24;
536 b = ((p & 0x7c00) | ((p & 0x7000) >> 5)) >> 7;
537 g = ((p & 0x03e0) | ((p & 0x0380) >> 5)) << 6;
538 r = ((p & 0x001c) | ((p & 0x001f) << 5)) << 14;
540 *buffer++ = a | r | g | b;
545 fetch_scanline_x1b5g5r5 (pixman_image_t *image,
550 const uint32_t *mask,
553 const uint32_t *bits = image->bits.bits + y * image->bits.rowstride;
554 const uint16_t *pixel = (const uint16_t *)bits + x;
555 const uint16_t *end = pixel + width;
559 uint32_t p = READ (image, pixel++);
562 b = ((p & 0x7c00) | ((p & 0x7000) >> 5)) >> 7;
563 g = ((p & 0x03e0) | ((p & 0x0380) >> 5)) << 6;
564 r = ((p & 0x001c) | ((p & 0x001f) << 5)) << 14;
566 *buffer++ = 0xff000000 | r | g | b;
571 fetch_scanline_a4r4g4b4 (pixman_image_t *image,
576 const uint32_t *mask,
579 const uint32_t *bits = image->bits.bits + y * image->bits.rowstride;
580 const uint16_t *pixel = (const uint16_t *)bits + x;
581 const uint16_t *end = pixel + width;
585 uint32_t p = READ (image, pixel++);
588 a = ((p & 0xf000) | ((p & 0xf000) >> 4)) << 16;
589 r = ((p & 0x0f00) | ((p & 0x0f00) >> 4)) << 12;
590 g = ((p & 0x00f0) | ((p & 0x00f0) >> 4)) << 8;
591 b = ((p & 0x000f) | ((p & 0x000f) << 4));
593 *buffer++ = a | r | g | b;
598 fetch_scanline_x4r4g4b4 (pixman_image_t *image,
603 const uint32_t *mask,
606 const uint32_t *bits = image->bits.bits + y * image->bits.rowstride;
607 const uint16_t *pixel = (const uint16_t *)bits + x;
608 const uint16_t *end = pixel + width;
612 uint32_t p = READ (image, pixel++);
615 r = ((p & 0x0f00) | ((p & 0x0f00) >> 4)) << 12;
616 g = ((p & 0x00f0) | ((p & 0x00f0) >> 4)) << 8;
617 b = ((p & 0x000f) | ((p & 0x000f) << 4));
619 *buffer++ = 0xff000000 | r | g | b;
624 fetch_scanline_a4b4g4r4 (pixman_image_t *image,
629 const uint32_t *mask,
632 const uint32_t *bits = image->bits.bits + y * image->bits.rowstride;
633 const uint16_t *pixel = (const uint16_t *)bits + x;
634 const uint16_t *end = pixel + width;
638 uint32_t p = READ (image, pixel++);
641 a = ((p & 0xf000) | ((p & 0xf000) >> 4)) << 16;
642 b = ((p & 0x0f00) | ((p & 0x0f00) >> 4)) >> 4;
643 g = ((p & 0x00f0) | ((p & 0x00f0) >> 4)) << 8;
644 r = ((p & 0x000f) | ((p & 0x000f) << 4)) << 16;
646 *buffer++ = a | r | g | b;
651 fetch_scanline_x4b4g4r4 (pixman_image_t *image,
656 const uint32_t *mask,
659 const uint32_t *bits = image->bits.bits + y * image->bits.rowstride;
660 const uint16_t *pixel = (const uint16_t *)bits + x;
661 const uint16_t *end = pixel + width;
665 uint32_t p = READ (image, pixel++);
668 b = ((p & 0x0f00) | ((p & 0x0f00) >> 4)) >> 4;
669 g = ((p & 0x00f0) | ((p & 0x00f0) >> 4)) << 8;
670 r = ((p & 0x000f) | ((p & 0x000f) << 4)) << 16;
672 *buffer++ = 0xff000000 | r | g | b;
677 fetch_scanline_a8 (pixman_image_t *image,
682 const uint32_t *mask,
685 const uint32_t *bits = image->bits.bits + y * image->bits.rowstride;
686 const uint8_t *pixel = (const uint8_t *)bits + x;
687 const uint8_t *end = pixel + width;
690 *buffer++ = READ (image, pixel++) << 24;
694 fetch_scanline_r3g3b2 (pixman_image_t *image,
699 const uint32_t *mask,
702 const uint32_t *bits = image->bits.bits + y * image->bits.rowstride;
703 const uint8_t *pixel = (const uint8_t *)bits + x;
704 const uint8_t *end = pixel + width;
708 uint32_t p = READ (image, pixel++);
711 r = ((p & 0xe0) | ((p & 0xe0) >> 3) | ((p & 0xc0) >> 6)) << 16;
712 g = ((p & 0x1c) | ((p & 0x18) >> 3) | ((p & 0x1c) << 3)) << 8;
718 *buffer++ = 0xff000000 | r | g | b;
723 fetch_scanline_b2g3r3 (pixman_image_t *image,
728 const uint32_t *mask,
731 const uint32_t *bits = image->bits.bits + y * image->bits.rowstride;
732 const uint8_t *pixel = (const uint8_t *)bits + x;
733 const uint8_t *end = pixel + width;
737 uint32_t p = READ (image, pixel++);
745 g = ((p & 0x38) | ((p & 0x38) >> 3) | ((p & 0x30) << 2)) << 8;
749 ((p & 0x06) << 6)) << 16;
751 *buffer++ = 0xff000000 | r | g | b;
756 fetch_scanline_a2r2g2b2 (pixman_image_t *image,
761 const uint32_t *mask,
764 const uint32_t *bits = image->bits.bits + y * image->bits.rowstride;
765 const uint8_t *pixel = (const uint8_t *)bits + x;
766 const uint8_t *end = pixel + width;
770 uint32_t p = READ (image, pixel++);
773 a = ((p & 0xc0) * 0x55) << 18;
774 r = ((p & 0x30) * 0x55) << 12;
775 g = ((p & 0x0c) * 0x55) << 6;
776 b = ((p & 0x03) * 0x55);
778 *buffer++ = a | r | g | b;
783 fetch_scanline_a2b2g2r2 (pixman_image_t *image,
788 const uint32_t *mask,
791 const uint32_t *bits = image->bits.bits + y * image->bits.rowstride;
792 const uint8_t *pixel = (const uint8_t *)bits + x;
793 const uint8_t *end = pixel + width;
797 uint32_t p = READ (image, pixel++);
800 a = ((p & 0xc0) * 0x55) << 18;
801 b = ((p & 0x30) * 0x55) >> 6;
802 g = ((p & 0x0c) * 0x55) << 6;
803 r = ((p & 0x03) * 0x55) << 16;
805 *buffer++ = a | r | g | b;
810 fetch_scanline_c8 (pixman_image_t *image,
815 const uint32_t *mask,
818 const uint32_t *bits = image->bits.bits + y * image->bits.rowstride;
819 const pixman_indexed_t * indexed = image->bits.indexed;
820 const uint8_t *pixel = (const uint8_t *)bits + x;
821 const uint8_t *end = pixel + width;
825 uint32_t p = READ (image, pixel++);
827 *buffer++ = indexed->rgba[p];
832 fetch_scanline_x4a4 (pixman_image_t *image,
837 const uint32_t *mask,
840 const uint32_t *bits = image->bits.bits + y * image->bits.rowstride;
841 const uint8_t *pixel = (const uint8_t *)bits + x;
842 const uint8_t *end = pixel + width;
846 uint8_t p = READ (image, pixel++) & 0xf;
848 *buffer++ = (p | (p << 4)) << 24;
852 #define FETCH_8(img,l,o) (READ (img, (uint8_t *)(l) + ((o) >> 2)))
853 #ifdef WORDS_BIGENDIAN
854 #define FETCH_4(img,l,o) ((o) & 2 ? FETCH_8 (img,l,o) & 0xf : FETCH_8 (img,l,o) >> 4)
856 #define FETCH_4(img,l,o) ((o) & 2 ? FETCH_8 (img,l,o) >> 4 : FETCH_8 (img,l,o) & 0xf)
860 fetch_scanline_a4 (pixman_image_t *image,
865 const uint32_t *mask,
868 const uint32_t *bits = image->bits.bits + y * image->bits.rowstride;
871 for (i = 0; i < width; ++i)
873 uint32_t p = FETCH_4 (image, bits, i + x);
882 fetch_scanline_r1g2b1 (pixman_image_t *image,
887 const uint32_t *mask,
890 const uint32_t *bits = image->bits.bits + y * image->bits.rowstride;
893 for (i = 0; i < width; ++i)
895 uint32_t p = FETCH_4 (image, bits, i + x);
898 r = ((p & 0x8) * 0xff) << 13;
899 g = ((p & 0x6) * 0x55) << 7;
900 b = ((p & 0x1) * 0xff);
902 *buffer++ = 0xff000000 | r | g | b;
907 fetch_scanline_b1g2r1 (pixman_image_t *image,
912 const uint32_t *mask,
915 const uint32_t *bits = image->bits.bits + y * image->bits.rowstride;
918 for (i = 0; i < width; ++i)
920 uint32_t p = FETCH_4 (image, bits, i + x);
923 b = ((p & 0x8) * 0xff) >> 3;
924 g = ((p & 0x6) * 0x55) << 7;
925 r = ((p & 0x1) * 0xff) << 16;
927 *buffer++ = 0xff000000 | r | g | b;
932 fetch_scanline_a1r1g1b1 (pixman_image_t *image,
937 const uint32_t *mask,
941 const uint32_t *bits = image->bits.bits + y * image->bits.rowstride;
944 for (i = 0; i < width; ++i)
946 uint32_t p = FETCH_4 (image, bits, i + x);
948 a = ((p & 0x8) * 0xff) << 21;
949 r = ((p & 0x4) * 0xff) << 14;
950 g = ((p & 0x2) * 0xff) << 7;
951 b = ((p & 0x1) * 0xff);
953 *buffer++ = a | r | g | b;
958 fetch_scanline_a1b1g1r1 (pixman_image_t *image,
963 const uint32_t *mask,
966 const uint32_t *bits = image->bits.bits + y * image->bits.rowstride;
969 for (i = 0; i < width; ++i)
971 uint32_t p = FETCH_4 (image, bits, i + x);
974 a = ((p & 0x8) * 0xff) << 21;
975 r = ((p & 0x4) * 0xff) >> 3;
976 g = ((p & 0x2) * 0xff) << 7;
977 b = ((p & 0x1) * 0xff) << 16;
979 *buffer++ = a | r | g | b;
984 fetch_scanline_c4 (pixman_image_t *image,
989 const uint32_t *mask,
992 const uint32_t *bits = image->bits.bits + y * image->bits.rowstride;
993 const pixman_indexed_t * indexed = image->bits.indexed;
996 for (i = 0; i < width; ++i)
998 uint32_t p = FETCH_4 (image, bits, i + x);
1000 *buffer++ = indexed->rgba[p];
1005 fetch_scanline_a1 (pixman_image_t *image,
1010 const uint32_t *mask,
1013 const uint32_t *bits = image->bits.bits + y * image->bits.rowstride;
1016 for (i = 0; i < width; ++i)
1018 uint32_t p = READ (image, bits + ((i + x) >> 5));
1021 #ifdef WORDS_BIGENDIAN
1022 a = p >> (0x1f - ((i + x) & 0x1f));
1024 a = p >> ((i + x) & 0x1f);
1031 *buffer++ = a << 24;
1036 fetch_scanline_g1 (pixman_image_t *image,
1041 const uint32_t *mask,
1044 const uint32_t *bits = image->bits.bits + y * image->bits.rowstride;
1045 const pixman_indexed_t * indexed = image->bits.indexed;
1048 for (i = 0; i < width; ++i)
1050 uint32_t p = READ (image, bits + ((i + x) >> 5));
1053 #ifdef WORDS_BIGENDIAN
1054 a = p >> (0x1f - ((i + x) & 0x1f));
1056 a = p >> ((i + x) & 0x1f);
1060 *buffer++ = indexed->rgba[a];
1065 fetch_scanline_yuy2 (pixman_image_t *image,
1070 const uint32_t *mask,
1073 const uint32_t *bits = image->bits.bits + image->bits.rowstride * line;
1076 for (i = 0; i < width; i++)
1081 y = ((uint8_t *) bits)[(x + i) << 1] - 16;
1082 u = ((uint8_t *) bits)[(((x + i) << 1) & - 4) + 1] - 128;
1083 v = ((uint8_t *) bits)[(((x + i) << 1) & - 4) + 3] - 128;
1085 /* R = 1.164(Y - 16) + 1.596(V - 128) */
1086 r = 0x012b27 * y + 0x019a2e * v;
1087 /* G = 1.164(Y - 16) - 0.813(V - 128) - 0.391(U - 128) */
1088 g = 0x012b27 * y - 0x00d0f2 * v - 0x00647e * u;
1089 /* B = 1.164(Y - 16) + 2.018(U - 128) */
1090 b = 0x012b27 * y + 0x0206a2 * u;
1092 *buffer++ = 0xff000000 |
1093 (r >= 0 ? r < 0x1000000 ? r & 0xff0000 : 0xff0000 : 0) |
1094 (g >= 0 ? g < 0x1000000 ? (g >> 8) & 0x00ff00 : 0x00ff00 : 0) |
1095 (b >= 0 ? b < 0x1000000 ? (b >> 16) & 0x0000ff : 0x0000ff : 0);
1100 fetch_scanline_yv12 (pixman_image_t *image,
1105 const uint32_t *mask,
1109 uint8_t *y_line = YV12_Y (line);
1110 uint8_t *u_line = YV12_U (line);
1111 uint8_t *v_line = YV12_V (line);
1114 for (i = 0; i < width; i++)
1119 y = y_line[x + i] - 16;
1120 u = u_line[(x + i) >> 1] - 128;
1121 v = v_line[(x + i) >> 1] - 128;
1123 /* R = 1.164(Y - 16) + 1.596(V - 128) */
1124 r = 0x012b27 * y + 0x019a2e * v;
1125 /* G = 1.164(Y - 16) - 0.813(V - 128) - 0.391(U - 128) */
1126 g = 0x012b27 * y - 0x00d0f2 * v - 0x00647e * u;
1127 /* B = 1.164(Y - 16) + 2.018(U - 128) */
1128 b = 0x012b27 * y + 0x0206a2 * u;
1130 *buffer++ = 0xff000000 |
1131 (r >= 0 ? r < 0x1000000 ? r & 0xff0000 : 0xff0000 : 0) |
1132 (g >= 0 ? g < 0x1000000 ? (g >> 8) & 0x00ff00 : 0x00ff00 : 0) |
1133 (b >= 0 ? b < 0x1000000 ? (b >> 16) & 0x0000ff : 0x0000ff : 0);
1137 /**************************** Pixel wise fetching *****************************/
1139 /* Despite the type, expects a uint64_t buffer */
1141 fetch_pixel_a2r10g10b10 (bits_image_t *image,
1145 uint32_t *bits = image->bits + line * image->rowstride;
1146 uint32_t p = READ (image, bits + offset);
1147 uint64_t a = p >> 30;
1148 uint64_t r = (p >> 20) & 0x3ff;
1149 uint64_t g = (p >> 10) & 0x3ff;
1150 uint64_t b = p & 0x3ff;
1152 r = r << 6 | r >> 4;
1153 g = g << 6 | g >> 4;
1154 b = b << 6 | b >> 4;
1161 return a << 48 | r << 32 | g << 16 | b;
1164 /* Despite the type, this function expects a uint64_t buffer */
1166 fetch_pixel_x2r10g10b10 (bits_image_t *image,
1170 uint32_t *bits = image->bits + line * image->rowstride;
1171 uint32_t p = READ (image, bits + offset);
1172 uint64_t r = (p >> 20) & 0x3ff;
1173 uint64_t g = (p >> 10) & 0x3ff;
1174 uint64_t b = p & 0x3ff;
1176 r = r << 6 | r >> 4;
1177 g = g << 6 | g >> 4;
1178 b = b << 6 | b >> 4;
1180 return 0xffffULL << 48 | r << 32 | g << 16 | b;
1183 /* Despite the type, expects a uint64_t buffer */
1185 fetch_pixel_a2b10g10r10 (bits_image_t *image,
1189 uint32_t *bits = image->bits + line * image->rowstride;
1190 uint32_t p = READ (image, bits + offset);
1191 uint64_t a = p >> 30;
1192 uint64_t b = (p >> 20) & 0x3ff;
1193 uint64_t g = (p >> 10) & 0x3ff;
1194 uint64_t r = p & 0x3ff;
1196 r = r << 6 | r >> 4;
1197 g = g << 6 | g >> 4;
1198 b = b << 6 | b >> 4;
1205 return a << 48 | r << 32 | g << 16 | b;
1208 /* Despite the type, this function expects a uint64_t buffer */
1210 fetch_pixel_x2b10g10r10 (bits_image_t *image,
1214 uint32_t *bits = image->bits + line * image->rowstride;
1215 uint32_t p = READ (image, bits + offset);
1216 uint64_t b = (p >> 20) & 0x3ff;
1217 uint64_t g = (p >> 10) & 0x3ff;
1218 uint64_t r = p & 0x3ff;
1220 r = r << 6 | r >> 4;
1221 g = g << 6 | g >> 4;
1222 b = b << 6 | b >> 4;
1224 return 0xffffULL << 48 | r << 32 | g << 16 | b;
1228 fetch_pixel_a8r8g8b8 (bits_image_t *image,
1232 uint32_t *bits = image->bits + line * image->rowstride;
1233 return READ (image, (uint32_t *)bits + offset);
1237 fetch_pixel_x8r8g8b8 (bits_image_t *image,
1241 uint32_t *bits = image->bits + line * image->rowstride;
1243 return READ (image, (uint32_t *)bits + offset) | 0xff000000;
1247 fetch_pixel_a8b8g8r8 (bits_image_t *image,
1251 uint32_t *bits = image->bits + line * image->rowstride;
1252 uint32_t pixel = READ (image, (uint32_t *)bits + offset);
1254 return ((pixel & 0xff000000) |
1255 ((pixel >> 16) & 0xff) |
1256 (pixel & 0x0000ff00) |
1257 ((pixel & 0xff) << 16));
1261 fetch_pixel_x8b8g8r8 (bits_image_t *image,
1265 uint32_t *bits = image->bits + line * image->rowstride;
1266 uint32_t pixel = READ (image, (uint32_t *)bits + offset);
1268 return ((0xff000000) |
1269 ((pixel >> 16) & 0xff) |
1270 (pixel & 0x0000ff00) |
1271 ((pixel & 0xff) << 16));
1275 fetch_pixel_b8g8r8a8 (bits_image_t *image,
1279 uint32_t *bits = image->bits + line * image->rowstride;
1280 uint32_t pixel = READ (image, (uint32_t *)bits + offset);
1282 return ((pixel & 0xff000000) >> 24 |
1283 (pixel & 0x00ff0000) >> 8 |
1284 (pixel & 0x0000ff00) << 8 |
1285 (pixel & 0x000000ff) << 24);
1289 fetch_pixel_b8g8r8x8 (bits_image_t *image,
1293 uint32_t *bits = image->bits + line * image->rowstride;
1294 uint32_t pixel = READ (image, (uint32_t *)bits + offset);
1296 return ((0xff000000) |
1297 (pixel & 0xff000000) >> 24 |
1298 (pixel & 0x00ff0000) >> 8 |
1299 (pixel & 0x0000ff00) << 8);
1303 fetch_pixel_r8g8b8 (bits_image_t *image,
1307 uint32_t *bits = image->bits + line * image->rowstride;
1308 uint8_t *pixel = ((uint8_t *) bits) + (offset * 3);
1310 #ifdef WORDS_BIGENDIAN
1311 return (0xff000000 |
1312 (READ (image, pixel + 0) << 16) |
1313 (READ (image, pixel + 1) << 8) |
1314 (READ (image, pixel + 2)));
1316 return (0xff000000 |
1317 (READ (image, pixel + 2) << 16) |
1318 (READ (image, pixel + 1) << 8) |
1319 (READ (image, pixel + 0)));
1324 fetch_pixel_b8g8r8 (bits_image_t *image,
1328 uint32_t *bits = image->bits + line * image->rowstride;
1329 uint8_t *pixel = ((uint8_t *) bits) + (offset * 3);
1330 #ifdef WORDS_BIGENDIAN
1331 return (0xff000000 |
1332 (READ (image, pixel + 2) << 16) |
1333 (READ (image, pixel + 1) << 8) |
1334 (READ (image, pixel + 0)));
1336 return (0xff000000 |
1337 (READ (image, pixel + 0) << 16) |
1338 (READ (image, pixel + 1) << 8) |
1339 (READ (image, pixel + 2)));
1344 fetch_pixel_r5g6b5 (bits_image_t *image,
1348 uint32_t *bits = image->bits + line * image->rowstride;
1349 uint32_t pixel = READ (image, (uint16_t *) bits + offset);
1352 r = ((pixel & 0xf800) | ((pixel & 0xe000) >> 5)) << 8;
1353 g = ((pixel & 0x07e0) | ((pixel & 0x0600) >> 6)) << 5;
1354 b = ((pixel & 0x001c) | ((pixel & 0x001f) << 5)) >> 2;
1356 return (0xff000000 | r | g | b);
1360 fetch_pixel_b5g6r5 (bits_image_t *image,
1365 uint32_t *bits = image->bits + line * image->rowstride;
1366 uint32_t pixel = READ (image, (uint16_t *) bits + offset);
1368 b = ((pixel & 0xf800) | ((pixel & 0xe000) >> 5)) >> 8;
1369 g = ((pixel & 0x07e0) | ((pixel & 0x0600) >> 6)) << 5;
1370 r = ((pixel & 0x001c) | ((pixel & 0x001f) << 5)) << 14;
1372 return (0xff000000 | r | g | b);
1376 fetch_pixel_a1r5g5b5 (bits_image_t *image,
1380 uint32_t *bits = image->bits + line * image->rowstride;
1381 uint32_t pixel = READ (image, (uint16_t *) bits + offset);
1382 uint32_t a, r, g, b;
1384 a = (uint32_t) ((uint8_t) (0 - ((pixel & 0x8000) >> 15))) << 24;
1385 r = ((pixel & 0x7c00) | ((pixel & 0x7000) >> 5)) << 9;
1386 g = ((pixel & 0x03e0) | ((pixel & 0x0380) >> 5)) << 6;
1387 b = ((pixel & 0x001c) | ((pixel & 0x001f) << 5)) >> 2;
1389 return (a | r | g | b);
1393 fetch_pixel_x1r5g5b5 (bits_image_t *image,
1397 uint32_t *bits = image->bits + line * image->rowstride;
1398 uint32_t pixel = READ (image, (uint16_t *) bits + offset);
1401 r = ((pixel & 0x7c00) | ((pixel & 0x7000) >> 5)) << 9;
1402 g = ((pixel & 0x03e0) | ((pixel & 0x0380) >> 5)) << 6;
1403 b = ((pixel & 0x001c) | ((pixel & 0x001f) << 5)) >> 2;
1405 return (0xff000000 | r | g | b);
1409 fetch_pixel_a1b5g5r5 (bits_image_t *image,
1413 uint32_t *bits = image->bits + line * image->rowstride;
1414 uint32_t pixel = READ (image, (uint16_t *) bits + offset);
1415 uint32_t a, r, g, b;
1417 a = (uint32_t) ((uint8_t) (0 - ((pixel & 0x8000) >> 15))) << 24;
1418 b = ((pixel & 0x7c00) | ((pixel & 0x7000) >> 5)) >> 7;
1419 g = ((pixel & 0x03e0) | ((pixel & 0x0380) >> 5)) << 6;
1420 r = ((pixel & 0x001c) | ((pixel & 0x001f) << 5)) << 14;
1422 return (a | r | g | b);
1426 fetch_pixel_x1b5g5r5 (bits_image_t *image,
1430 uint32_t *bits = image->bits + line * image->rowstride;
1431 uint32_t pixel = READ (image, (uint16_t *) bits + offset);
1434 b = ((pixel & 0x7c00) | ((pixel & 0x7000) >> 5)) >> 7;
1435 g = ((pixel & 0x03e0) | ((pixel & 0x0380) >> 5)) << 6;
1436 r = ((pixel & 0x001c) | ((pixel & 0x001f) << 5)) << 14;
1438 return (0xff000000 | r | g | b);
1442 fetch_pixel_a4r4g4b4 (bits_image_t *image,
1446 uint32_t *bits = image->bits + line * image->rowstride;
1447 uint32_t pixel = READ (image, (uint16_t *) bits + offset);
1448 uint32_t a, r, g, b;
1450 a = ((pixel & 0xf000) | ((pixel & 0xf000) >> 4)) << 16;
1451 r = ((pixel & 0x0f00) | ((pixel & 0x0f00) >> 4)) << 12;
1452 g = ((pixel & 0x00f0) | ((pixel & 0x00f0) >> 4)) << 8;
1453 b = ((pixel & 0x000f) | ((pixel & 0x000f) << 4));
1455 return (a | r | g | b);
1459 fetch_pixel_x4r4g4b4 (bits_image_t *image,
1463 uint32_t *bits = image->bits + line * image->rowstride;
1464 uint32_t pixel = READ (image, (uint16_t *) bits + offset);
1467 r = ((pixel & 0x0f00) | ((pixel & 0x0f00) >> 4)) << 12;
1468 g = ((pixel & 0x00f0) | ((pixel & 0x00f0) >> 4)) << 8;
1469 b = ((pixel & 0x000f) | ((pixel & 0x000f) << 4));
1471 return (0xff000000 | r | g | b);
1475 fetch_pixel_a4b4g4r4 (bits_image_t *image,
1479 uint32_t *bits = image->bits + line * image->rowstride;
1480 uint32_t pixel = READ (image, (uint16_t *) bits + offset);
1481 uint32_t a, r, g, b;
1483 a = ((pixel & 0xf000) | ((pixel & 0xf000) >> 4)) << 16;
1484 b = ((pixel & 0x0f00) | ((pixel & 0x0f00) >> 4)) >> 4;
1485 g = ((pixel & 0x00f0) | ((pixel & 0x00f0) >> 4)) << 8;
1486 r = ((pixel & 0x000f) | ((pixel & 0x000f) << 4)) << 16;
1488 return (a | r | g | b);
1492 fetch_pixel_x4b4g4r4 (bits_image_t *image,
1496 uint32_t *bits = image->bits + line * image->rowstride;
1497 uint32_t pixel = READ (image, (uint16_t *) bits + offset);
1500 b = ((pixel & 0x0f00) | ((pixel & 0x0f00) >> 4)) >> 4;
1501 g = ((pixel & 0x00f0) | ((pixel & 0x00f0) >> 4)) << 8;
1502 r = ((pixel & 0x000f) | ((pixel & 0x000f) << 4)) << 16;
1504 return (0xff000000 | r | g | b);
1508 fetch_pixel_a8 (bits_image_t *image,
1512 uint32_t *bits = image->bits + line * image->rowstride;
1513 uint32_t pixel = READ (image, (uint8_t *) bits + offset);
1519 fetch_pixel_r3g3b2 (bits_image_t *image,
1523 uint32_t *bits = image->bits + line * image->rowstride;
1524 uint32_t pixel = READ (image, (uint8_t *) bits + offset);
1527 r = ((pixel & 0xe0) |
1528 ((pixel & 0xe0) >> 3) |
1529 ((pixel & 0xc0) >> 6)) << 16;
1531 g = ((pixel & 0x1c) |
1532 ((pixel & 0x18) >> 3) |
1533 ((pixel & 0x1c) << 3)) << 8;
1535 b = (((pixel & 0x03) ) |
1536 ((pixel & 0x03) << 2) |
1537 ((pixel & 0x03) << 4) |
1538 ((pixel & 0x03) << 6));
1540 return (0xff000000 | r | g | b);
1544 fetch_pixel_b2g3r3 (bits_image_t *image,
1548 uint32_t *bits = image->bits + line * image->rowstride;
1549 uint32_t pixel = READ (image, (uint8_t *) bits + offset);
1552 b = ((pixel & 0xc0) |
1553 ((pixel & 0xc0) >> 2) |
1554 ((pixel & 0xc0) >> 4) |
1555 ((pixel & 0xc0) >> 6));
1557 g = ((pixel & 0x38) |
1558 ((pixel & 0x38) >> 3) |
1559 ((pixel & 0x30) << 2)) << 8;
1561 r = ((pixel & 0x07) |
1562 ((pixel & 0x07) << 3) |
1563 ((pixel & 0x06) << 6)) << 16;
1565 return (0xff000000 | r | g | b);
1569 fetch_pixel_a2r2g2b2 (bits_image_t *image,
1573 uint32_t *bits = image->bits + line * image->rowstride;
1574 uint32_t pixel = READ (image, (uint8_t *) bits + offset);
1575 uint32_t a, r, g, b;
1577 a = ((pixel & 0xc0) * 0x55) << 18;
1578 r = ((pixel & 0x30) * 0x55) << 12;
1579 g = ((pixel & 0x0c) * 0x55) << 6;
1580 b = ((pixel & 0x03) * 0x55);
1582 return a | r | g | b;
1586 fetch_pixel_a2b2g2r2 (bits_image_t *image,
1590 uint32_t *bits = image->bits + line * image->rowstride;
1591 uint32_t pixel = READ (image, (uint8_t *) bits + offset);
1592 uint32_t a, r, g, b;
1594 a = ((pixel & 0xc0) * 0x55) << 18;
1595 b = ((pixel & 0x30) * 0x55) >> 6;
1596 g = ((pixel & 0x0c) * 0x55) << 6;
1597 r = ((pixel & 0x03) * 0x55) << 16;
1599 return a | r | g | b;
1603 fetch_pixel_c8 (bits_image_t *image,
1607 uint32_t *bits = image->bits + line * image->rowstride;
1608 uint32_t pixel = READ (image, (uint8_t *) bits + offset);
1609 const pixman_indexed_t * indexed = image->indexed;
1611 return indexed->rgba[pixel];
1615 fetch_pixel_x4a4 (bits_image_t *image,
1619 uint32_t *bits = image->bits + line * image->rowstride;
1620 uint32_t pixel = READ (image, (uint8_t *) bits + offset);
1622 return ((pixel & 0xf) | ((pixel & 0xf) << 4)) << 24;
1626 fetch_pixel_a4 (bits_image_t *image,
1630 uint32_t *bits = image->bits + line * image->rowstride;
1631 uint32_t pixel = FETCH_4 (image, bits, offset);
1633 pixel |= pixel << 4;
1638 fetch_pixel_r1g2b1 (bits_image_t *image,
1642 uint32_t *bits = image->bits + line * image->rowstride;
1643 uint32_t pixel = FETCH_4 (image, bits, offset);
1646 r = ((pixel & 0x8) * 0xff) << 13;
1647 g = ((pixel & 0x6) * 0x55) << 7;
1648 b = ((pixel & 0x1) * 0xff);
1650 return 0xff000000 | r | g | b;
1654 fetch_pixel_b1g2r1 (bits_image_t *image,
1658 uint32_t *bits = image->bits + line * image->rowstride;
1659 uint32_t pixel = FETCH_4 (image, bits, offset);
1662 b = ((pixel & 0x8) * 0xff) >> 3;
1663 g = ((pixel & 0x6) * 0x55) << 7;
1664 r = ((pixel & 0x1) * 0xff) << 16;
1666 return 0xff000000 | r | g | b;
1670 fetch_pixel_a1r1g1b1 (bits_image_t *image,
1674 uint32_t *bits = image->bits + line * image->rowstride;
1675 uint32_t pixel = FETCH_4 (image, bits, offset);
1676 uint32_t a, r, g, b;
1678 a = ((pixel & 0x8) * 0xff) << 21;
1679 r = ((pixel & 0x4) * 0xff) << 14;
1680 g = ((pixel & 0x2) * 0xff) << 7;
1681 b = ((pixel & 0x1) * 0xff);
1683 return a | r | g | b;
1687 fetch_pixel_a1b1g1r1 (bits_image_t *image,
1691 uint32_t *bits = image->bits + line * image->rowstride;
1692 uint32_t pixel = FETCH_4 (image, bits, offset);
1693 uint32_t a, r, g, b;
1695 a = ((pixel & 0x8) * 0xff) << 21;
1696 r = ((pixel & 0x4) * 0xff) >> 3;
1697 g = ((pixel & 0x2) * 0xff) << 7;
1698 b = ((pixel & 0x1) * 0xff) << 16;
1700 return a | r | g | b;
1704 fetch_pixel_c4 (bits_image_t *image,
1708 uint32_t *bits = image->bits + line * image->rowstride;
1709 uint32_t pixel = FETCH_4 (image, bits, offset);
1710 const pixman_indexed_t * indexed = image->indexed;
1712 return indexed->rgba[pixel];
1716 fetch_pixel_a1 (bits_image_t *image,
1720 uint32_t *bits = image->bits + line * image->rowstride;
1721 uint32_t pixel = READ (image, bits + (offset >> 5));
1724 #ifdef WORDS_BIGENDIAN
1725 a = pixel >> (0x1f - (offset & 0x1f));
1727 a = pixel >> (offset & 0x1f);
1738 fetch_pixel_g1 (bits_image_t *image,
1742 uint32_t *bits = image->bits + line * image->rowstride;
1743 uint32_t pixel = READ (image, bits + (offset >> 5));
1744 const pixman_indexed_t * indexed = image->indexed;
1747 #ifdef WORDS_BIGENDIAN
1748 a = pixel >> (0x1f - (offset & 0x1f));
1750 a = pixel >> (offset & 0x1f);
1754 return indexed->rgba[a];
1758 fetch_pixel_yuy2 (bits_image_t *image,
1762 const uint32_t *bits = image->bits + image->rowstride * line;
1767 y = ((uint8_t *) bits)[offset << 1] - 16;
1768 u = ((uint8_t *) bits)[((offset << 1) & - 4) + 1] - 128;
1769 v = ((uint8_t *) bits)[((offset << 1) & - 4) + 3] - 128;
1771 /* R = 1.164(Y - 16) + 1.596(V - 128) */
1772 r = 0x012b27 * y + 0x019a2e * v;
1774 /* G = 1.164(Y - 16) - 0.813(V - 128) - 0.391(U - 128) */
1775 g = 0x012b27 * y - 0x00d0f2 * v - 0x00647e * u;
1777 /* B = 1.164(Y - 16) + 2.018(U - 128) */
1778 b = 0x012b27 * y + 0x0206a2 * u;
1781 (r >= 0 ? r < 0x1000000 ? r & 0xff0000 : 0xff0000 : 0) |
1782 (g >= 0 ? g < 0x1000000 ? (g >> 8) & 0x00ff00 : 0x00ff00 : 0) |
1783 (b >= 0 ? b < 0x1000000 ? (b >> 16) & 0x0000ff : 0x0000ff : 0);
1787 fetch_pixel_yv12 (bits_image_t *image,
1792 int16_t y = YV12_Y (line)[offset] - 16;
1793 int16_t u = YV12_U (line)[offset >> 1] - 128;
1794 int16_t v = YV12_V (line)[offset >> 1] - 128;
1797 /* R = 1.164(Y - 16) + 1.596(V - 128) */
1798 r = 0x012b27 * y + 0x019a2e * v;
1800 /* G = 1.164(Y - 16) - 0.813(V - 128) - 0.391(U - 128) */
1801 g = 0x012b27 * y - 0x00d0f2 * v - 0x00647e * u;
1803 /* B = 1.164(Y - 16) + 2.018(U - 128) */
1804 b = 0x012b27 * y + 0x0206a2 * u;
1807 (r >= 0 ? r < 0x1000000 ? r & 0xff0000 : 0xff0000 : 0) |
1808 (g >= 0 ? g < 0x1000000 ? (g >> 8) & 0x00ff00 : 0x00ff00 : 0) |
1809 (b >= 0 ? b < 0x1000000 ? (b >> 16) & 0x0000ff : 0x0000ff : 0);
1812 /*********************************** Store ************************************/
1814 #define SPLIT_A(v) \
1815 uint32_t a = ((v) >> 24), \
1816 r = ((v) >> 16) & 0xff, \
1817 g = ((v) >> 8) & 0xff, \
1821 uint32_t r = ((v) >> 16) & 0xff, \
1822 g = ((v) >> 8) & 0xff, \
1826 store_scanline_a2r10g10b10 (bits_image_t * image,
1832 uint32_t *bits = image->bits + image->rowstride * y;
1833 uint32_t *pixel = bits + x;
1834 uint64_t *values = (uint64_t *)v;
1837 for (i = 0; i < width; ++i)
1839 WRITE (image, pixel++,
1840 ((values[i] >> 32) & 0xc0000000) |
1841 ((values[i] >> 18) & 0x3ff00000) |
1842 ((values[i] >> 12) & 0xffc00) |
1843 ((values[i] >> 6) & 0x3ff));
1848 store_scanline_x2r10g10b10 (bits_image_t * image,
1854 uint32_t *bits = image->bits + image->rowstride * y;
1855 uint64_t *values = (uint64_t *)v;
1856 uint32_t *pixel = bits + x;
1859 for (i = 0; i < width; ++i)
1861 WRITE (image, pixel++,
1862 ((values[i] >> 18) & 0x3ff00000) |
1863 ((values[i] >> 12) & 0xffc00) |
1864 ((values[i] >> 6) & 0x3ff));
1869 store_scanline_a2b10g10r10 (bits_image_t * image,
1875 uint32_t *bits = image->bits + image->rowstride * y;
1876 uint32_t *pixel = bits + x;
1877 uint64_t *values = (uint64_t *)v;
1880 for (i = 0; i < width; ++i)
1882 WRITE (image, pixel++,
1883 ((values[i] >> 32) & 0xc0000000) |
1884 ((values[i] >> 38) & 0x3ff) |
1885 ((values[i] >> 12) & 0xffc00) |
1886 ((values[i] << 14) & 0x3ff00000));
1891 store_scanline_x2b10g10r10 (bits_image_t * image,
1897 uint32_t *bits = image->bits + image->rowstride * y;
1898 uint64_t *values = (uint64_t *)v;
1899 uint32_t *pixel = bits + x;
1902 for (i = 0; i < width; ++i)
1904 WRITE (image, pixel++,
1905 ((values[i] >> 38) & 0x3ff) |
1906 ((values[i] >> 12) & 0xffc00) |
1907 ((values[i] << 14) & 0x3ff00000));
1912 store_scanline_a8r8g8b8 (bits_image_t * image,
1916 const uint32_t *values)
1918 uint32_t *bits = image->bits + image->rowstride * y;
1920 MEMCPY_WRAPPED (image, ((uint32_t *)bits) + x, values,
1921 width * sizeof(uint32_t));
1925 store_scanline_x8r8g8b8 (bits_image_t * image,
1929 const uint32_t *values)
1931 uint32_t *bits = image->bits + image->rowstride * y;
1932 uint32_t *pixel = (uint32_t *)bits + x;
1935 for (i = 0; i < width; ++i)
1936 WRITE (image, pixel++, values[i] & 0xffffff);
1940 store_scanline_a8b8g8r8 (bits_image_t * image,
1944 const uint32_t *values)
1946 uint32_t *bits = image->bits + image->rowstride * y;
1947 uint32_t *pixel = (uint32_t *)bits + x;
1950 for (i = 0; i < width; ++i)
1952 WRITE (image, pixel++,
1953 (values[i] & 0xff00ff00) |
1954 ((values[i] >> 16) & 0xff) |
1955 ((values[i] & 0xff) << 16));
1960 store_scanline_x8b8g8r8 (bits_image_t * image,
1964 const uint32_t *values)
1966 uint32_t *bits = image->bits + image->rowstride * y;
1967 uint32_t *pixel = (uint32_t *)bits + x;
1970 for (i = 0; i < width; ++i)
1972 WRITE (image, pixel++,
1973 (values[i] & 0x0000ff00) |
1974 ((values[i] >> 16) & 0xff) |
1975 ((values[i] & 0xff) << 16));
1980 store_scanline_b8g8r8a8 (bits_image_t * image,
1984 const uint32_t *values)
1986 uint32_t *bits = image->bits + image->rowstride * y;
1987 uint32_t *pixel = (uint32_t *)bits + x;
1990 for (i = 0; i < width; ++i)
1992 WRITE (image, pixel++,
1993 ((values[i] >> 24) & 0x000000ff) |
1994 ((values[i] >> 8) & 0x0000ff00) |
1995 ((values[i] << 8) & 0x00ff0000) |
1996 ((values[i] << 24) & 0xff000000));
2001 store_scanline_b8g8r8x8 (bits_image_t * image,
2005 const uint32_t *values)
2007 uint32_t *bits = image->bits + image->rowstride * y;
2008 uint32_t *pixel = (uint32_t *)bits + x;
2011 for (i = 0; i < width; ++i)
2013 WRITE (image, pixel++,
2014 ((values[i] >> 8) & 0x0000ff00) |
2015 ((values[i] << 8) & 0x00ff0000) |
2016 ((values[i] << 24) & 0xff000000));
2021 store_scanline_r8g8b8 (bits_image_t * image,
2025 const uint32_t *values)
2027 uint32_t *bits = image->bits + image->rowstride * y;
2028 uint8_t *pixel = ((uint8_t *) bits) + 3 * x;
2031 for (i = 0; i < width; ++i)
2033 uint32_t val = values[i];
2035 #ifdef WORDS_BIGENDIAN
2036 WRITE (image, pixel++, (val & 0x00ff0000) >> 16);
2037 WRITE (image, pixel++, (val & 0x0000ff00) >> 8);
2038 WRITE (image, pixel++, (val & 0x000000ff) >> 0);
2040 WRITE (image, pixel++, (val & 0x000000ff) >> 0);
2041 WRITE (image, pixel++, (val & 0x0000ff00) >> 8);
2042 WRITE (image, pixel++, (val & 0x00ff0000) >> 16);
2048 store_scanline_b8g8r8 (bits_image_t * image,
2052 const uint32_t *values)
2054 uint32_t *bits = image->bits + image->rowstride * y;
2055 uint8_t *pixel = ((uint8_t *) bits) + 3 * x;
2058 for (i = 0; i < width; ++i)
2060 uint32_t val = values[i];
2062 #ifdef WORDS_BIGENDIAN
2063 WRITE (image, pixel++, (val & 0x000000ff) >> 0);
2064 WRITE (image, pixel++, (val & 0x0000ff00) >> 8);
2065 WRITE (image, pixel++, (val & 0x00ff0000) >> 16);
2067 WRITE (image, pixel++, (val & 0x00ff0000) >> 16);
2068 WRITE (image, pixel++, (val & 0x0000ff00) >> 8);
2069 WRITE (image, pixel++, (val & 0x000000ff) >> 0);
2075 store_scanline_r5g6b5 (bits_image_t * image,
2079 const uint32_t *values)
2081 uint32_t *bits = image->bits + image->rowstride * y;
2082 uint16_t *pixel = ((uint16_t *) bits) + x;
2085 for (i = 0; i < width; ++i)
2087 uint32_t s = values[i];
2089 WRITE (image, pixel++,
2090 ((s >> 3) & 0x001f) |
2091 ((s >> 5) & 0x07e0) |
2092 ((s >> 8) & 0xf800));
2097 store_scanline_b5g6r5 (bits_image_t * image,
2101 const uint32_t *values)
2103 uint32_t *bits = image->bits + image->rowstride * y;
2104 uint16_t *pixel = ((uint16_t *) bits) + x;
2107 for (i = 0; i < width; ++i)
2111 WRITE (image, pixel++,
2112 ((b << 8) & 0xf800) |
2113 ((g << 3) & 0x07e0) |
2119 store_scanline_a1r5g5b5 (bits_image_t * image,
2123 const uint32_t *values)
2125 uint32_t *bits = image->bits + image->rowstride * y;
2126 uint16_t *pixel = ((uint16_t *) bits) + x;
2129 for (i = 0; i < width; ++i)
2131 SPLIT_A (values[i]);
2133 WRITE (image, pixel++,
2134 ((a << 8) & 0x8000) |
2135 ((r << 7) & 0x7c00) |
2136 ((g << 2) & 0x03e0) |
2142 store_scanline_x1r5g5b5 (bits_image_t * image,
2146 const uint32_t *values)
2148 uint32_t *bits = image->bits + image->rowstride * y;
2149 uint16_t *pixel = ((uint16_t *) bits) + x;
2152 for (i = 0; i < width; ++i)
2156 WRITE (image, pixel++,
2157 ((r << 7) & 0x7c00) |
2158 ((g << 2) & 0x03e0) |
2164 store_scanline_a1b5g5r5 (bits_image_t * image,
2168 const uint32_t *values)
2170 uint32_t *bits = image->bits + image->rowstride * y;
2171 uint16_t *pixel = ((uint16_t *) bits) + x;
2174 for (i = 0; i < width; ++i)
2176 SPLIT_A (values[i]);
2178 WRITE (image, pixel++,
2179 ((a << 8) & 0x8000) |
2180 ((b << 7) & 0x7c00) |
2181 ((g << 2) & 0x03e0) |
2187 store_scanline_x1b5g5r5 (bits_image_t * image,
2191 const uint32_t *values)
2193 uint32_t *bits = image->bits + image->rowstride * y;
2194 uint16_t *pixel = ((uint16_t *) bits) + x;
2197 for (i = 0; i < width; ++i)
2201 WRITE (image, pixel++, ((b << 7) & 0x7c00) |
2202 ((g << 2) & 0x03e0) |
2208 store_scanline_a4r4g4b4 (bits_image_t * image,
2212 const uint32_t *values)
2214 uint32_t *bits = image->bits + image->rowstride * y;
2215 uint16_t *pixel = ((uint16_t *) bits) + x;
2218 for (i = 0; i < width; ++i)
2220 SPLIT_A (values[i]);
2222 WRITE (image, pixel++,
2223 ((a << 8) & 0xf000) |
2224 ((r << 4) & 0x0f00) |
2231 store_scanline_x4r4g4b4 (bits_image_t * image,
2235 const uint32_t *values)
2237 uint32_t *bits = image->bits + image->rowstride * y;
2238 uint16_t *pixel = ((uint16_t *) bits) + x;
2241 for (i = 0; i < width; ++i)
2245 WRITE (image, pixel++,
2246 ((r << 4) & 0x0f00) |
2253 store_scanline_a4b4g4r4 (bits_image_t * image,
2257 const uint32_t *values)
2259 uint32_t *bits = image->bits + image->rowstride * y;
2260 uint16_t *pixel = ((uint16_t *) bits) + x;
2263 for (i = 0; i < width; ++i)
2265 SPLIT_A (values[i]);
2266 WRITE (image, pixel++, ((a << 8) & 0xf000) |
2267 ((b << 4) & 0x0f00) |
2274 store_scanline_x4b4g4r4 (bits_image_t * image,
2278 const uint32_t *values)
2280 uint32_t *bits = image->bits + image->rowstride * y;
2281 uint16_t *pixel = ((uint16_t *) bits) + x;
2284 for (i = 0; i < width; ++i)
2288 WRITE (image, pixel++,
2289 ((b << 4) & 0x0f00) |
2296 store_scanline_a8 (bits_image_t * image,
2300 const uint32_t *values)
2302 uint32_t *bits = image->bits + image->rowstride * y;
2303 uint8_t *pixel = ((uint8_t *) bits) + x;
2306 for (i = 0; i < width; ++i)
2308 WRITE (image, pixel++, values[i] >> 24);
2313 store_scanline_r3g3b2 (bits_image_t * image,
2317 const uint32_t *values)
2319 uint32_t *bits = image->bits + image->rowstride * y;
2320 uint8_t *pixel = ((uint8_t *) bits) + x;
2323 for (i = 0; i < width; ++i)
2327 WRITE (image, pixel++,
2335 store_scanline_b2g3r3 (bits_image_t * image,
2339 const uint32_t *values)
2341 uint32_t *bits = image->bits + image->rowstride * y;
2342 uint8_t *pixel = ((uint8_t *) bits) + x;
2345 for (i = 0; i < width; ++i)
2349 WRITE (image, pixel++,
2357 store_scanline_a2r2g2b2 (bits_image_t * image,
2361 const uint32_t *values)
2363 uint32_t *bits = image->bits + image->rowstride * y;
2364 uint8_t *pixel = ((uint8_t *) bits) + x;
2367 for (i = 0; i < width; ++i)
2369 SPLIT_A (values[i]);
2371 WRITE (image, pixel++,
2380 store_scanline_a2b2g2r2 (bits_image_t * image,
2384 const uint32_t *values)
2386 uint32_t *bits = image->bits + image->rowstride * y;
2387 uint8_t *pixel = ((uint8_t *) bits) + x;
2390 for (i = 0; i < width; ++i)
2392 SPLIT_A (values[i]);
2403 store_scanline_c8 (bits_image_t * image,
2407 const uint32_t *values)
2409 uint32_t *bits = image->bits + image->rowstride * y;
2410 uint8_t *pixel = ((uint8_t *) bits) + x;
2411 const pixman_indexed_t *indexed = image->indexed;
2414 for (i = 0; i < width; ++i)
2415 WRITE (image, pixel++, RGB24_TO_ENTRY (indexed,values[i]));
2419 store_scanline_x4a4 (bits_image_t * image,
2423 const uint32_t *values)
2425 uint32_t *bits = image->bits + image->rowstride * y;
2426 uint8_t *pixel = ((uint8_t *) bits) + x;
2429 for (i = 0; i < width; ++i)
2430 WRITE (image, pixel++, values[i] >> 28);
2433 #define STORE_8(img,l,o,v) (WRITE (img, (uint8_t *)(l) + ((o) >> 3), (v)))
2434 #ifdef WORDS_BIGENDIAN
2435 #define STORE_4(img,l,o,v) \
2436 STORE_8 (img,l,o,((o) & 4 ? \
2437 (FETCH_8 (img,l,o) & 0xf0) | (v) : \
2438 (FETCH_8 (img,l,o) & 0x0f) | ((v) << 4)))
2440 #define STORE_4(img,l,o,v) \
2441 STORE_8 (img,l,o,((o) & 4 ? \
2442 (FETCH_8 (img,l,o) & 0x0f) | ((v) << 4) : \
2443 (FETCH_8 (img,l,o) & 0xf0) | (v)))
2447 store_scanline_a4 (bits_image_t * image,
2451 const uint32_t *values)
2453 uint32_t *bits = image->bits + image->rowstride * y;
2456 for (i = 0; i < width; ++i)
2457 STORE_4 (image, bits, i + x, values[i] >> 28);
2461 store_scanline_r1g2b1 (bits_image_t * image,
2465 const uint32_t *values)
2467 uint32_t *bits = image->bits + image->rowstride * y;
2470 for (i = 0; i < width; ++i)
2475 pixel = (((r >> 4) & 0x8) |
2478 STORE_4 (image, bits, i + x, pixel);
2483 store_scanline_b1g2r1 (bits_image_t * image,
2487 const uint32_t *values)
2489 uint32_t *bits = image->bits + image->rowstride * y;
2492 for (i = 0; i < width; ++i)
2497 pixel = (((b >> 4) & 0x8) |
2500 STORE_4 (image, bits, i + x, pixel);
2505 store_scanline_a1r1g1b1 (bits_image_t * image,
2509 const uint32_t *values)
2511 uint32_t *bits = image->bits + image->rowstride * y;
2514 for (i = 0; i < width; ++i)
2518 SPLIT_A (values[i]);
2519 pixel = (((a >> 4) & 0x8) |
2523 STORE_4 (image, bits, i + x, pixel);
2528 store_scanline_a1b1g1r1 (bits_image_t * image,
2532 const uint32_t *values)
2534 uint32_t *bits = image->bits + image->rowstride * y;
2537 for (i = 0; i < width; ++i)
2541 SPLIT_A (values[i]);
2542 pixel = (((a >> 4) & 0x8) |
2546 STORE_4 (image, bits, i + x, pixel);
2551 store_scanline_c4 (bits_image_t * image,
2555 const uint32_t *values)
2557 uint32_t *bits = image->bits + image->rowstride * y;
2558 const pixman_indexed_t *indexed = image->indexed;
2561 for (i = 0; i < width; ++i)
2565 pixel = RGB24_TO_ENTRY (indexed, values[i]);
2566 STORE_4 (image, bits, i + x, pixel);
2571 store_scanline_a1 (bits_image_t * image,
2575 const uint32_t *values)
2577 uint32_t *bits = image->bits + image->rowstride * y;
2580 for (i = 0; i < width; ++i)
2582 uint32_t *pixel = ((uint32_t *) bits) + ((i + x) >> 5);
2585 #ifdef WORDS_BIGENDIAN
2586 mask = 1 << (0x1f - ((i + x) & 0x1f));
2588 mask = 1 << ((i + x) & 0x1f);
2590 v = values[i] & 0x80000000 ? mask : 0;
2592 WRITE (image, pixel, (READ (image, pixel) & ~mask) | v);
2597 store_scanline_g1 (bits_image_t * image,
2601 const uint32_t *values)
2603 uint32_t *bits = image->bits + image->rowstride * y;
2604 const pixman_indexed_t *indexed = image->indexed;
2607 for (i = 0; i < width; ++i)
2609 uint32_t *pixel = ((uint32_t *) bits) + ((i + x) >> 5);
2612 #ifdef WORDS_BIGENDIAN
2613 mask = 1 << (0x1f - ((i + x) & 0x1f));
2615 mask = 1 << ((i + x) & 0x1f);
2617 v = RGB24_TO_ENTRY_Y (indexed, values[i]) ? mask : 0;
2619 WRITE (image, pixel, (READ (image, pixel) & ~mask) | v);
2624 * Contracts a 64bpp image to 32bpp and then stores it using a regular 32-bit
2625 * store proc. Despite the type, this function expects a uint64_t buffer.
2628 store_scanline_generic_64 (bits_image_t * image,
2632 const uint32_t *values)
2634 uint32_t *argb8_pixels;
2636 assert (image->common.type == BITS);
2638 argb8_pixels = pixman_malloc_ab (width, sizeof(uint32_t));
2642 /* Contract the scanline. We could do this in place if values weren't
2645 pixman_contract (argb8_pixels, (uint64_t *)values, width);
2647 image->store_scanline_raw_32 (image, x, y, width, argb8_pixels);
2649 free (argb8_pixels);
2652 /* Despite the type, this function expects both buffer
2653 * and mask to be uint64_t
2656 fetch_scanline_generic_64 (pixman_image_t *image,
2661 const uint32_t *mask,
2664 /* Fetch the pixels into the first half of buffer and then expand them in
2667 image->bits.fetch_scanline_raw_32 (image, x, y, width, buffer, NULL, 0);
2669 pixman_expand ((uint64_t *)buffer, buffer, image->bits.format, width);
2672 /* Despite the type, this function expects a uint64_t *buffer */
2674 fetch_pixel_generic_64 (bits_image_t *image,
2678 uint32_t pixel32 = image->fetch_pixel_raw_32 (image, offset, line);
2681 pixman_expand ((uint64_t *)&result, &pixel32, image->format, 1);
2687 * XXX: The transformed fetch path only works at 32-bpp so far. When all
2688 * paths have wide versions, this can be removed.
2690 * WARNING: This function loses precision!
2693 fetch_pixel_generic_lossy_32 (bits_image_t *image,
2697 uint64_t pixel64 = image->fetch_pixel_raw_64 (image, offset, line);
2700 pixman_contract (&result, &pixel64, 1);
2707 pixman_format_code_t format;
2708 fetch_scanline_t fetch_scanline_raw_32;
2709 fetch_scanline_t fetch_scanline_raw_64;
2710 fetch_pixel_32_t fetch_pixel_raw_32;
2711 fetch_pixel_64_t fetch_pixel_raw_64;
2712 store_scanline_t store_scanline_raw_32;
2713 store_scanline_t store_scanline_raw_64;
2716 #define FORMAT_INFO(format) \
2718 PIXMAN_ ## format, \
2719 fetch_scanline_ ## format, \
2720 fetch_scanline_generic_64, \
2721 fetch_pixel_ ## format, fetch_pixel_generic_64, \
2722 store_scanline_ ## format, store_scanline_generic_64 \
2725 static const format_info_t accessors[] =
2727 /* 32 bpp formats */
2728 FORMAT_INFO (a8r8g8b8),
2729 FORMAT_INFO (x8r8g8b8),
2730 FORMAT_INFO (a8b8g8r8),
2731 FORMAT_INFO (x8b8g8r8),
2732 FORMAT_INFO (b8g8r8a8),
2733 FORMAT_INFO (b8g8r8x8),
2736 FORMAT_INFO (r8g8b8),
2737 FORMAT_INFO (b8g8r8),
2740 FORMAT_INFO (r5g6b5),
2741 FORMAT_INFO (b5g6r5),
2743 FORMAT_INFO (a1r5g5b5),
2744 FORMAT_INFO (x1r5g5b5),
2745 FORMAT_INFO (a1b5g5r5),
2746 FORMAT_INFO (x1b5g5r5),
2747 FORMAT_INFO (a4r4g4b4),
2748 FORMAT_INFO (x4r4g4b4),
2749 FORMAT_INFO (a4b4g4r4),
2750 FORMAT_INFO (x4b4g4r4),
2754 FORMAT_INFO (r3g3b2),
2755 FORMAT_INFO (b2g3r3),
2756 FORMAT_INFO (a2r2g2b2),
2757 FORMAT_INFO (a2b2g2r2),
2761 #define fetch_scanline_g8 fetch_scanline_c8
2762 #define fetch_pixel_g8 fetch_pixel_c8
2763 #define store_scanline_g8 store_scanline_c8
2766 #define fetch_scanline_x4c4 fetch_scanline_c8
2767 #define fetch_pixel_x4c4 fetch_pixel_c8
2768 #define store_scanline_x4c4 store_scanline_c8
2771 #define fetch_scanline_x4g4 fetch_scanline_c8
2772 #define fetch_pixel_x4g4 fetch_pixel_c8
2773 #define store_scanline_x4g4 store_scanline_c8
2780 FORMAT_INFO (r1g2b1),
2781 FORMAT_INFO (b1g2r1),
2782 FORMAT_INFO (a1r1g1b1),
2783 FORMAT_INFO (a1b1g1r1),
2787 #define fetch_scanline_g4 fetch_scanline_c4
2788 #define fetch_pixel_g4 fetch_pixel_c4
2789 #define store_scanline_g4 store_scanline_c4
2798 { PIXMAN_a2r10g10b10,
2799 NULL, fetch_scanline_a2r10g10b10,
2800 fetch_pixel_generic_lossy_32, fetch_pixel_a2r10g10b10,
2801 NULL, store_scanline_a2r10g10b10 },
2803 { PIXMAN_x2r10g10b10,
2804 NULL, fetch_scanline_x2r10g10b10,
2805 fetch_pixel_generic_lossy_32, fetch_pixel_x2r10g10b10,
2806 NULL, store_scanline_x2r10g10b10 },
2808 { PIXMAN_a2b10g10r10,
2809 NULL, fetch_scanline_a2b10g10r10,
2810 fetch_pixel_generic_lossy_32, fetch_pixel_a2b10g10r10,
2811 NULL, store_scanline_a2b10g10r10 },
2813 { PIXMAN_x2b10g10r10,
2814 NULL, fetch_scanline_x2b10g10r10,
2815 fetch_pixel_generic_lossy_32, fetch_pixel_x2b10g10r10,
2816 NULL, store_scanline_x2b10g10r10 },
2820 fetch_scanline_yuy2, fetch_scanline_generic_64,
2821 fetch_pixel_yuy2, fetch_pixel_generic_64,
2825 fetch_scanline_yv12, fetch_scanline_generic_64,
2826 fetch_pixel_yv12, fetch_pixel_generic_64,
2833 setup_accessors (bits_image_t *image)
2835 const format_info_t *info = accessors;
2837 while (info->format != PIXMAN_null)
2839 if (info->format == image->format)
2841 image->fetch_scanline_raw_32 = info->fetch_scanline_raw_32;
2842 image->fetch_scanline_raw_64 = info->fetch_scanline_raw_64;
2843 image->fetch_pixel_raw_32 = info->fetch_pixel_raw_32;
2844 image->fetch_pixel_raw_64 = info->fetch_pixel_raw_64;
2845 image->store_scanline_raw_32 = info->store_scanline_raw_32;
2846 image->store_scanline_raw_64 = info->store_scanline_raw_64;
2855 #ifndef PIXMAN_FB_ACCESSORS
2857 _pixman_bits_image_setup_raw_accessors_accessors (bits_image_t *image);
2860 _pixman_bits_image_setup_raw_accessors (bits_image_t *image)
2862 if (image->read_func || image->write_func)
2863 _pixman_bits_image_setup_raw_accessors_accessors (image);
2865 setup_accessors (image);
2871 _pixman_bits_image_setup_raw_accessors_accessors (bits_image_t *image)
2873 setup_accessors (image);