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) >> 4;
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) >> 3))))
853 #ifdef WORDS_BIGENDIAN
854 #define FETCH_4(img,l,o) \
855 (((4 * (o)) & 4) ? (FETCH_8 (img,l, 4 * (o)) & 0xf) : (FETCH_8 (img,l,(4 * (o))) >> 4))
857 #define FETCH_4(img,l,o) \
858 (((4 * (o)) & 4) ? (FETCH_8 (img, l, 4 * (o)) >> 4) : (FETCH_8 (img, l, (4 * (o))) & 0xf))
862 fetch_scanline_a4 (pixman_image_t *image,
867 const uint32_t *mask,
870 const uint32_t *bits = image->bits.bits + y * image->bits.rowstride;
873 for (i = 0; i < width; ++i)
875 uint32_t p = FETCH_4 (image, bits, i + x);
884 fetch_scanline_r1g2b1 (pixman_image_t *image,
889 const uint32_t *mask,
892 const uint32_t *bits = image->bits.bits + y * image->bits.rowstride;
895 for (i = 0; i < width; ++i)
897 uint32_t p = FETCH_4 (image, bits, i + x);
900 r = ((p & 0x8) * 0xff) << 13;
901 g = ((p & 0x6) * 0x55) << 7;
902 b = ((p & 0x1) * 0xff);
904 *buffer++ = 0xff000000 | r | g | b;
909 fetch_scanline_b1g2r1 (pixman_image_t *image,
914 const uint32_t *mask,
917 const uint32_t *bits = image->bits.bits + y * image->bits.rowstride;
920 for (i = 0; i < width; ++i)
922 uint32_t p = FETCH_4 (image, bits, i + x);
925 b = ((p & 0x8) * 0xff) >> 3;
926 g = ((p & 0x6) * 0x55) << 7;
927 r = ((p & 0x1) * 0xff) << 16;
929 *buffer++ = 0xff000000 | r | g | b;
934 fetch_scanline_a1r1g1b1 (pixman_image_t *image,
939 const uint32_t *mask,
943 const uint32_t *bits = image->bits.bits + y * image->bits.rowstride;
946 for (i = 0; i < width; ++i)
948 uint32_t p = FETCH_4 (image, bits, i + x);
950 a = ((p & 0x8) * 0xff) << 21;
951 r = ((p & 0x4) * 0xff) << 14;
952 g = ((p & 0x2) * 0xff) << 7;
953 b = ((p & 0x1) * 0xff);
955 *buffer++ = a | r | g | b;
960 fetch_scanline_a1b1g1r1 (pixman_image_t *image,
965 const uint32_t *mask,
968 const uint32_t *bits = image->bits.bits + y * image->bits.rowstride;
971 for (i = 0; i < width; ++i)
973 uint32_t p = FETCH_4 (image, bits, i + x);
976 a = ((p & 0x8) * 0xff) << 21;
977 r = ((p & 0x4) * 0xff) >> 3;
978 g = ((p & 0x2) * 0xff) << 7;
979 b = ((p & 0x1) * 0xff) << 16;
981 *buffer++ = a | r | g | b;
986 fetch_scanline_c4 (pixman_image_t *image,
991 const uint32_t *mask,
994 const uint32_t *bits = image->bits.bits + y * image->bits.rowstride;
995 const pixman_indexed_t * indexed = image->bits.indexed;
998 for (i = 0; i < width; ++i)
1000 uint32_t p = FETCH_4 (image, bits, i + x);
1002 *buffer++ = indexed->rgba[p];
1007 fetch_scanline_a1 (pixman_image_t *image,
1012 const uint32_t *mask,
1015 const uint32_t *bits = image->bits.bits + y * image->bits.rowstride;
1018 for (i = 0; i < width; ++i)
1020 uint32_t p = READ (image, bits + ((i + x) >> 5));
1023 #ifdef WORDS_BIGENDIAN
1024 a = p >> (0x1f - ((i + x) & 0x1f));
1026 a = p >> ((i + x) & 0x1f);
1033 *buffer++ = a << 24;
1038 fetch_scanline_g1 (pixman_image_t *image,
1043 const uint32_t *mask,
1046 const uint32_t *bits = image->bits.bits + y * image->bits.rowstride;
1047 const pixman_indexed_t * indexed = image->bits.indexed;
1050 for (i = 0; i < width; ++i)
1052 uint32_t p = READ (image, bits + ((i + x) >> 5));
1055 #ifdef WORDS_BIGENDIAN
1056 a = p >> (0x1f - ((i + x) & 0x1f));
1058 a = p >> ((i + x) & 0x1f);
1062 *buffer++ = indexed->rgba[a];
1067 fetch_scanline_yuy2 (pixman_image_t *image,
1072 const uint32_t *mask,
1075 const uint32_t *bits = image->bits.bits + image->bits.rowstride * line;
1078 for (i = 0; i < width; i++)
1083 y = ((uint8_t *) bits)[(x + i) << 1] - 16;
1084 u = ((uint8_t *) bits)[(((x + i) << 1) & - 4) + 1] - 128;
1085 v = ((uint8_t *) bits)[(((x + i) << 1) & - 4) + 3] - 128;
1087 /* R = 1.164(Y - 16) + 1.596(V - 128) */
1088 r = 0x012b27 * y + 0x019a2e * v;
1089 /* G = 1.164(Y - 16) - 0.813(V - 128) - 0.391(U - 128) */
1090 g = 0x012b27 * y - 0x00d0f2 * v - 0x00647e * u;
1091 /* B = 1.164(Y - 16) + 2.018(U - 128) */
1092 b = 0x012b27 * y + 0x0206a2 * u;
1094 *buffer++ = 0xff000000 |
1095 (r >= 0 ? r < 0x1000000 ? r & 0xff0000 : 0xff0000 : 0) |
1096 (g >= 0 ? g < 0x1000000 ? (g >> 8) & 0x00ff00 : 0x00ff00 : 0) |
1097 (b >= 0 ? b < 0x1000000 ? (b >> 16) & 0x0000ff : 0x0000ff : 0);
1102 fetch_scanline_yv12 (pixman_image_t *image,
1107 const uint32_t *mask,
1111 uint8_t *y_line = YV12_Y (line);
1112 uint8_t *u_line = YV12_U (line);
1113 uint8_t *v_line = YV12_V (line);
1116 for (i = 0; i < width; i++)
1121 y = y_line[x + i] - 16;
1122 u = u_line[(x + i) >> 1] - 128;
1123 v = v_line[(x + i) >> 1] - 128;
1125 /* R = 1.164(Y - 16) + 1.596(V - 128) */
1126 r = 0x012b27 * y + 0x019a2e * v;
1127 /* G = 1.164(Y - 16) - 0.813(V - 128) - 0.391(U - 128) */
1128 g = 0x012b27 * y - 0x00d0f2 * v - 0x00647e * u;
1129 /* B = 1.164(Y - 16) + 2.018(U - 128) */
1130 b = 0x012b27 * y + 0x0206a2 * u;
1132 *buffer++ = 0xff000000 |
1133 (r >= 0 ? r < 0x1000000 ? r & 0xff0000 : 0xff0000 : 0) |
1134 (g >= 0 ? g < 0x1000000 ? (g >> 8) & 0x00ff00 : 0x00ff00 : 0) |
1135 (b >= 0 ? b < 0x1000000 ? (b >> 16) & 0x0000ff : 0x0000ff : 0);
1139 /**************************** Pixel wise fetching *****************************/
1141 /* Despite the type, expects a uint64_t buffer */
1143 fetch_pixel_a2r10g10b10 (bits_image_t *image,
1147 uint32_t *bits = image->bits + line * image->rowstride;
1148 uint32_t p = READ (image, bits + offset);
1149 uint64_t a = p >> 30;
1150 uint64_t r = (p >> 20) & 0x3ff;
1151 uint64_t g = (p >> 10) & 0x3ff;
1152 uint64_t b = p & 0x3ff;
1154 r = r << 6 | r >> 4;
1155 g = g << 6 | g >> 4;
1156 b = b << 6 | b >> 4;
1163 return a << 48 | r << 32 | g << 16 | b;
1166 /* Despite the type, this function expects a uint64_t buffer */
1168 fetch_pixel_x2r10g10b10 (bits_image_t *image,
1172 uint32_t *bits = image->bits + line * image->rowstride;
1173 uint32_t p = READ (image, bits + offset);
1174 uint64_t r = (p >> 20) & 0x3ff;
1175 uint64_t g = (p >> 10) & 0x3ff;
1176 uint64_t b = p & 0x3ff;
1178 r = r << 6 | r >> 4;
1179 g = g << 6 | g >> 4;
1180 b = b << 6 | b >> 4;
1182 return 0xffffULL << 48 | r << 32 | g << 16 | b;
1185 /* Despite the type, expects a uint64_t buffer */
1187 fetch_pixel_a2b10g10r10 (bits_image_t *image,
1191 uint32_t *bits = image->bits + line * image->rowstride;
1192 uint32_t p = READ (image, bits + offset);
1193 uint64_t a = p >> 30;
1194 uint64_t b = (p >> 20) & 0x3ff;
1195 uint64_t g = (p >> 10) & 0x3ff;
1196 uint64_t r = p & 0x3ff;
1198 r = r << 6 | r >> 4;
1199 g = g << 6 | g >> 4;
1200 b = b << 6 | b >> 4;
1207 return a << 48 | r << 32 | g << 16 | b;
1210 /* Despite the type, this function expects a uint64_t buffer */
1212 fetch_pixel_x2b10g10r10 (bits_image_t *image,
1216 uint32_t *bits = image->bits + line * image->rowstride;
1217 uint32_t p = READ (image, bits + offset);
1218 uint64_t b = (p >> 20) & 0x3ff;
1219 uint64_t g = (p >> 10) & 0x3ff;
1220 uint64_t r = p & 0x3ff;
1222 r = r << 6 | r >> 4;
1223 g = g << 6 | g >> 4;
1224 b = b << 6 | b >> 4;
1226 return 0xffffULL << 48 | r << 32 | g << 16 | b;
1230 fetch_pixel_a8r8g8b8 (bits_image_t *image,
1234 uint32_t *bits = image->bits + line * image->rowstride;
1235 return READ (image, (uint32_t *)bits + offset);
1239 fetch_pixel_x8r8g8b8 (bits_image_t *image,
1243 uint32_t *bits = image->bits + line * image->rowstride;
1245 return READ (image, (uint32_t *)bits + offset) | 0xff000000;
1249 fetch_pixel_a8b8g8r8 (bits_image_t *image,
1253 uint32_t *bits = image->bits + line * image->rowstride;
1254 uint32_t pixel = READ (image, (uint32_t *)bits + offset);
1256 return ((pixel & 0xff000000) |
1257 ((pixel >> 16) & 0xff) |
1258 (pixel & 0x0000ff00) |
1259 ((pixel & 0xff) << 16));
1263 fetch_pixel_x8b8g8r8 (bits_image_t *image,
1267 uint32_t *bits = image->bits + line * image->rowstride;
1268 uint32_t pixel = READ (image, (uint32_t *)bits + offset);
1270 return ((0xff000000) |
1271 ((pixel >> 16) & 0xff) |
1272 (pixel & 0x0000ff00) |
1273 ((pixel & 0xff) << 16));
1277 fetch_pixel_b8g8r8a8 (bits_image_t *image,
1281 uint32_t *bits = image->bits + line * image->rowstride;
1282 uint32_t pixel = READ (image, (uint32_t *)bits + offset);
1284 return ((pixel & 0xff000000) >> 24 |
1285 (pixel & 0x00ff0000) >> 8 |
1286 (pixel & 0x0000ff00) << 8 |
1287 (pixel & 0x000000ff) << 24);
1291 fetch_pixel_b8g8r8x8 (bits_image_t *image,
1295 uint32_t *bits = image->bits + line * image->rowstride;
1296 uint32_t pixel = READ (image, (uint32_t *)bits + offset);
1298 return ((0xff000000) |
1299 (pixel & 0xff000000) >> 24 |
1300 (pixel & 0x00ff0000) >> 8 |
1301 (pixel & 0x0000ff00) << 8);
1305 fetch_pixel_r8g8b8 (bits_image_t *image,
1309 uint32_t *bits = image->bits + line * image->rowstride;
1310 uint8_t *pixel = ((uint8_t *) bits) + (offset * 3);
1312 #ifdef WORDS_BIGENDIAN
1313 return (0xff000000 |
1314 (READ (image, pixel + 0) << 16) |
1315 (READ (image, pixel + 1) << 8) |
1316 (READ (image, pixel + 2)));
1318 return (0xff000000 |
1319 (READ (image, pixel + 2) << 16) |
1320 (READ (image, pixel + 1) << 8) |
1321 (READ (image, pixel + 0)));
1326 fetch_pixel_b8g8r8 (bits_image_t *image,
1330 uint32_t *bits = image->bits + line * image->rowstride;
1331 uint8_t *pixel = ((uint8_t *) bits) + (offset * 3);
1332 #ifdef WORDS_BIGENDIAN
1333 return (0xff000000 |
1334 (READ (image, pixel + 2) << 16) |
1335 (READ (image, pixel + 1) << 8) |
1336 (READ (image, pixel + 0)));
1338 return (0xff000000 |
1339 (READ (image, pixel + 0) << 16) |
1340 (READ (image, pixel + 1) << 8) |
1341 (READ (image, pixel + 2)));
1346 fetch_pixel_r5g6b5 (bits_image_t *image,
1350 uint32_t *bits = image->bits + line * image->rowstride;
1351 uint32_t pixel = READ (image, (uint16_t *) bits + offset);
1354 r = ((pixel & 0xf800) | ((pixel & 0xe000) >> 5)) << 8;
1355 g = ((pixel & 0x07e0) | ((pixel & 0x0600) >> 6)) << 5;
1356 b = ((pixel & 0x001c) | ((pixel & 0x001f) << 5)) >> 2;
1358 return (0xff000000 | r | g | b);
1362 fetch_pixel_b5g6r5 (bits_image_t *image,
1367 uint32_t *bits = image->bits + line * image->rowstride;
1368 uint32_t pixel = READ (image, (uint16_t *) bits + offset);
1370 b = ((pixel & 0xf800) | ((pixel & 0xe000) >> 5)) >> 8;
1371 g = ((pixel & 0x07e0) | ((pixel & 0x0600) >> 6)) << 5;
1372 r = ((pixel & 0x001c) | ((pixel & 0x001f) << 5)) << 14;
1374 return (0xff000000 | r | g | b);
1378 fetch_pixel_a1r5g5b5 (bits_image_t *image,
1382 uint32_t *bits = image->bits + line * image->rowstride;
1383 uint32_t pixel = READ (image, (uint16_t *) bits + offset);
1384 uint32_t a, r, g, b;
1386 a = (uint32_t) ((uint8_t) (0 - ((pixel & 0x8000) >> 15))) << 24;
1387 r = ((pixel & 0x7c00) | ((pixel & 0x7000) >> 5)) << 9;
1388 g = ((pixel & 0x03e0) | ((pixel & 0x0380) >> 5)) << 6;
1389 b = ((pixel & 0x001c) | ((pixel & 0x001f) << 5)) >> 2;
1391 return (a | r | g | b);
1395 fetch_pixel_x1r5g5b5 (bits_image_t *image,
1399 uint32_t *bits = image->bits + line * image->rowstride;
1400 uint32_t pixel = READ (image, (uint16_t *) bits + offset);
1403 r = ((pixel & 0x7c00) | ((pixel & 0x7000) >> 5)) << 9;
1404 g = ((pixel & 0x03e0) | ((pixel & 0x0380) >> 5)) << 6;
1405 b = ((pixel & 0x001c) | ((pixel & 0x001f) << 5)) >> 2;
1407 return (0xff000000 | r | g | b);
1411 fetch_pixel_a1b5g5r5 (bits_image_t *image,
1415 uint32_t *bits = image->bits + line * image->rowstride;
1416 uint32_t pixel = READ (image, (uint16_t *) bits + offset);
1417 uint32_t a, r, g, b;
1419 a = (uint32_t) ((uint8_t) (0 - ((pixel & 0x8000) >> 15))) << 24;
1420 b = ((pixel & 0x7c00) | ((pixel & 0x7000) >> 5)) >> 7;
1421 g = ((pixel & 0x03e0) | ((pixel & 0x0380) >> 5)) << 6;
1422 r = ((pixel & 0x001c) | ((pixel & 0x001f) << 5)) << 14;
1424 return (a | r | g | b);
1428 fetch_pixel_x1b5g5r5 (bits_image_t *image,
1432 uint32_t *bits = image->bits + line * image->rowstride;
1433 uint32_t pixel = READ (image, (uint16_t *) bits + offset);
1436 b = ((pixel & 0x7c00) | ((pixel & 0x7000) >> 5)) >> 7;
1437 g = ((pixel & 0x03e0) | ((pixel & 0x0380) >> 5)) << 6;
1438 r = ((pixel & 0x001c) | ((pixel & 0x001f) << 5)) << 14;
1440 return (0xff000000 | r | g | b);
1444 fetch_pixel_a4r4g4b4 (bits_image_t *image,
1448 uint32_t *bits = image->bits + line * image->rowstride;
1449 uint32_t pixel = READ (image, (uint16_t *) bits + offset);
1450 uint32_t a, r, g, b;
1452 a = ((pixel & 0xf000) | ((pixel & 0xf000) >> 4)) << 16;
1453 r = ((pixel & 0x0f00) | ((pixel & 0x0f00) >> 4)) << 12;
1454 g = ((pixel & 0x00f0) | ((pixel & 0x00f0) >> 4)) << 8;
1455 b = ((pixel & 0x000f) | ((pixel & 0x000f) << 4));
1457 return (a | r | g | b);
1461 fetch_pixel_x4r4g4b4 (bits_image_t *image,
1465 uint32_t *bits = image->bits + line * image->rowstride;
1466 uint32_t pixel = READ (image, (uint16_t *) bits + offset);
1469 r = ((pixel & 0x0f00) | ((pixel & 0x0f00) >> 4)) << 12;
1470 g = ((pixel & 0x00f0) | ((pixel & 0x00f0) >> 4)) << 8;
1471 b = ((pixel & 0x000f) | ((pixel & 0x000f) << 4));
1473 return (0xff000000 | r | g | b);
1477 fetch_pixel_a4b4g4r4 (bits_image_t *image,
1481 uint32_t *bits = image->bits + line * image->rowstride;
1482 uint32_t pixel = READ (image, (uint16_t *) bits + offset);
1483 uint32_t a, r, g, b;
1485 a = ((pixel & 0xf000) | ((pixel & 0xf000) >> 4)) << 16;
1486 b = ((pixel & 0x0f00) | ((pixel & 0x0f00) >> 4)) >> 4;
1487 g = ((pixel & 0x00f0) | ((pixel & 0x00f0) >> 4)) << 8;
1488 r = ((pixel & 0x000f) | ((pixel & 0x000f) << 4)) << 16;
1490 return (a | r | g | b);
1494 fetch_pixel_x4b4g4r4 (bits_image_t *image,
1498 uint32_t *bits = image->bits + line * image->rowstride;
1499 uint32_t pixel = READ (image, (uint16_t *) bits + offset);
1502 b = ((pixel & 0x0f00) | ((pixel & 0x0f00) >> 4)) >> 4;
1503 g = ((pixel & 0x00f0) | ((pixel & 0x00f0) >> 4)) << 8;
1504 r = ((pixel & 0x000f) | ((pixel & 0x000f) << 4)) << 16;
1506 return (0xff000000 | r | g | b);
1510 fetch_pixel_a8 (bits_image_t *image,
1514 uint32_t *bits = image->bits + line * image->rowstride;
1515 uint32_t pixel = READ (image, (uint8_t *) bits + offset);
1521 fetch_pixel_r3g3b2 (bits_image_t *image,
1525 uint32_t *bits = image->bits + line * image->rowstride;
1526 uint32_t pixel = READ (image, (uint8_t *) bits + offset);
1529 r = ((pixel & 0xe0) |
1530 ((pixel & 0xe0) >> 3) |
1531 ((pixel & 0xc0) >> 6)) << 16;
1533 g = ((pixel & 0x1c) |
1534 ((pixel & 0x18) >> 3) |
1535 ((pixel & 0x1c) << 3)) << 8;
1537 b = (((pixel & 0x03) ) |
1538 ((pixel & 0x03) << 2) |
1539 ((pixel & 0x03) << 4) |
1540 ((pixel & 0x03) << 6));
1542 return (0xff000000 | r | g | b);
1546 fetch_pixel_b2g3r3 (bits_image_t *image,
1550 uint32_t *bits = image->bits + line * image->rowstride;
1551 uint32_t pixel = READ (image, (uint8_t *) bits + offset);
1554 b = ((pixel & 0xc0) |
1555 ((pixel & 0xc0) >> 2) |
1556 ((pixel & 0xc0) >> 4) |
1557 ((pixel & 0xc0) >> 6));
1559 g = ((pixel & 0x38) |
1560 ((pixel & 0x38) >> 3) |
1561 ((pixel & 0x30) << 2)) << 8;
1563 r = ((pixel & 0x07) |
1564 ((pixel & 0x07) << 3) |
1565 ((pixel & 0x06) << 6)) << 16;
1567 return (0xff000000 | r | g | b);
1571 fetch_pixel_a2r2g2b2 (bits_image_t *image,
1575 uint32_t *bits = image->bits + line * image->rowstride;
1576 uint32_t pixel = READ (image, (uint8_t *) bits + offset);
1577 uint32_t a, r, g, b;
1579 a = ((pixel & 0xc0) * 0x55) << 18;
1580 r = ((pixel & 0x30) * 0x55) << 12;
1581 g = ((pixel & 0x0c) * 0x55) << 6;
1582 b = ((pixel & 0x03) * 0x55);
1584 return a | r | g | b;
1588 fetch_pixel_a2b2g2r2 (bits_image_t *image,
1592 uint32_t *bits = image->bits + line * image->rowstride;
1593 uint32_t pixel = READ (image, (uint8_t *) bits + offset);
1594 uint32_t a, r, g, b;
1596 a = ((pixel & 0xc0) * 0x55) << 18;
1597 b = ((pixel & 0x30) * 0x55) >> 4;
1598 g = ((pixel & 0x0c) * 0x55) << 6;
1599 r = ((pixel & 0x03) * 0x55) << 16;
1601 return a | r | g | b;
1605 fetch_pixel_c8 (bits_image_t *image,
1609 uint32_t *bits = image->bits + line * image->rowstride;
1610 uint32_t pixel = READ (image, (uint8_t *) bits + offset);
1611 const pixman_indexed_t * indexed = image->indexed;
1613 return indexed->rgba[pixel];
1617 fetch_pixel_x4a4 (bits_image_t *image,
1621 uint32_t *bits = image->bits + line * image->rowstride;
1622 uint32_t pixel = READ (image, (uint8_t *) bits + offset);
1624 return ((pixel & 0xf) | ((pixel & 0xf) << 4)) << 24;
1628 fetch_pixel_a4 (bits_image_t *image,
1632 uint32_t *bits = image->bits + line * image->rowstride;
1633 uint32_t pixel = FETCH_4 (image, bits, offset);
1635 pixel |= pixel << 4;
1640 fetch_pixel_r1g2b1 (bits_image_t *image,
1644 uint32_t *bits = image->bits + line * image->rowstride;
1645 uint32_t pixel = FETCH_4 (image, bits, offset);
1648 r = ((pixel & 0x8) * 0xff) << 13;
1649 g = ((pixel & 0x6) * 0x55) << 7;
1650 b = ((pixel & 0x1) * 0xff);
1652 return 0xff000000 | r | g | b;
1656 fetch_pixel_b1g2r1 (bits_image_t *image,
1660 uint32_t *bits = image->bits + line * image->rowstride;
1661 uint32_t pixel = FETCH_4 (image, bits, offset);
1664 b = ((pixel & 0x8) * 0xff) >> 3;
1665 g = ((pixel & 0x6) * 0x55) << 7;
1666 r = ((pixel & 0x1) * 0xff) << 16;
1668 return 0xff000000 | r | g | b;
1672 fetch_pixel_a1r1g1b1 (bits_image_t *image,
1676 uint32_t *bits = image->bits + line * image->rowstride;
1677 uint32_t pixel = FETCH_4 (image, bits, offset);
1678 uint32_t a, r, g, b;
1680 a = ((pixel & 0x8) * 0xff) << 21;
1681 r = ((pixel & 0x4) * 0xff) << 14;
1682 g = ((pixel & 0x2) * 0xff) << 7;
1683 b = ((pixel & 0x1) * 0xff);
1685 return a | r | g | b;
1689 fetch_pixel_a1b1g1r1 (bits_image_t *image,
1693 uint32_t *bits = image->bits + line * image->rowstride;
1694 uint32_t pixel = FETCH_4 (image, bits, offset);
1695 uint32_t a, r, g, b;
1697 a = ((pixel & 0x8) * 0xff) << 21;
1698 r = ((pixel & 0x4) * 0xff) >> 3;
1699 g = ((pixel & 0x2) * 0xff) << 7;
1700 b = ((pixel & 0x1) * 0xff) << 16;
1702 return a | r | g | b;
1706 fetch_pixel_c4 (bits_image_t *image,
1710 uint32_t *bits = image->bits + line * image->rowstride;
1711 uint32_t pixel = FETCH_4 (image, bits, offset);
1712 const pixman_indexed_t * indexed = image->indexed;
1714 return indexed->rgba[pixel];
1718 fetch_pixel_a1 (bits_image_t *image,
1722 uint32_t *bits = image->bits + line * image->rowstride;
1723 uint32_t pixel = READ (image, bits + (offset >> 5));
1726 #ifdef WORDS_BIGENDIAN
1727 a = pixel >> (0x1f - (offset & 0x1f));
1729 a = pixel >> (offset & 0x1f);
1740 fetch_pixel_g1 (bits_image_t *image,
1744 uint32_t *bits = image->bits + line * image->rowstride;
1745 uint32_t pixel = READ (image, bits + (offset >> 5));
1746 const pixman_indexed_t * indexed = image->indexed;
1749 #ifdef WORDS_BIGENDIAN
1750 a = pixel >> (0x1f - (offset & 0x1f));
1752 a = pixel >> (offset & 0x1f);
1756 return indexed->rgba[a];
1760 fetch_pixel_yuy2 (bits_image_t *image,
1764 const uint32_t *bits = image->bits + image->rowstride * line;
1769 y = ((uint8_t *) bits)[offset << 1] - 16;
1770 u = ((uint8_t *) bits)[((offset << 1) & - 4) + 1] - 128;
1771 v = ((uint8_t *) bits)[((offset << 1) & - 4) + 3] - 128;
1773 /* R = 1.164(Y - 16) + 1.596(V - 128) */
1774 r = 0x012b27 * y + 0x019a2e * v;
1776 /* G = 1.164(Y - 16) - 0.813(V - 128) - 0.391(U - 128) */
1777 g = 0x012b27 * y - 0x00d0f2 * v - 0x00647e * u;
1779 /* B = 1.164(Y - 16) + 2.018(U - 128) */
1780 b = 0x012b27 * y + 0x0206a2 * u;
1783 (r >= 0 ? r < 0x1000000 ? r & 0xff0000 : 0xff0000 : 0) |
1784 (g >= 0 ? g < 0x1000000 ? (g >> 8) & 0x00ff00 : 0x00ff00 : 0) |
1785 (b >= 0 ? b < 0x1000000 ? (b >> 16) & 0x0000ff : 0x0000ff : 0);
1789 fetch_pixel_yv12 (bits_image_t *image,
1794 int16_t y = YV12_Y (line)[offset] - 16;
1795 int16_t u = YV12_U (line)[offset >> 1] - 128;
1796 int16_t v = YV12_V (line)[offset >> 1] - 128;
1799 /* R = 1.164(Y - 16) + 1.596(V - 128) */
1800 r = 0x012b27 * y + 0x019a2e * v;
1802 /* G = 1.164(Y - 16) - 0.813(V - 128) - 0.391(U - 128) */
1803 g = 0x012b27 * y - 0x00d0f2 * v - 0x00647e * u;
1805 /* B = 1.164(Y - 16) + 2.018(U - 128) */
1806 b = 0x012b27 * y + 0x0206a2 * u;
1809 (r >= 0 ? r < 0x1000000 ? r & 0xff0000 : 0xff0000 : 0) |
1810 (g >= 0 ? g < 0x1000000 ? (g >> 8) & 0x00ff00 : 0x00ff00 : 0) |
1811 (b >= 0 ? b < 0x1000000 ? (b >> 16) & 0x0000ff : 0x0000ff : 0);
1814 /*********************************** Store ************************************/
1816 #define SPLIT_A(v) \
1817 uint32_t a = ((v) >> 24), \
1818 r = ((v) >> 16) & 0xff, \
1819 g = ((v) >> 8) & 0xff, \
1823 uint32_t r = ((v) >> 16) & 0xff, \
1824 g = ((v) >> 8) & 0xff, \
1828 store_scanline_a2r10g10b10 (bits_image_t * image,
1834 uint32_t *bits = image->bits + image->rowstride * y;
1835 uint32_t *pixel = bits + x;
1836 uint64_t *values = (uint64_t *)v;
1839 for (i = 0; i < width; ++i)
1841 WRITE (image, pixel++,
1842 ((values[i] >> 32) & 0xc0000000) |
1843 ((values[i] >> 18) & 0x3ff00000) |
1844 ((values[i] >> 12) & 0xffc00) |
1845 ((values[i] >> 6) & 0x3ff));
1850 store_scanline_x2r10g10b10 (bits_image_t * image,
1856 uint32_t *bits = image->bits + image->rowstride * y;
1857 uint64_t *values = (uint64_t *)v;
1858 uint32_t *pixel = bits + x;
1861 for (i = 0; i < width; ++i)
1863 WRITE (image, pixel++,
1864 ((values[i] >> 18) & 0x3ff00000) |
1865 ((values[i] >> 12) & 0xffc00) |
1866 ((values[i] >> 6) & 0x3ff));
1871 store_scanline_a2b10g10r10 (bits_image_t * image,
1877 uint32_t *bits = image->bits + image->rowstride * y;
1878 uint32_t *pixel = bits + x;
1879 uint64_t *values = (uint64_t *)v;
1882 for (i = 0; i < width; ++i)
1884 WRITE (image, pixel++,
1885 ((values[i] >> 32) & 0xc0000000) |
1886 ((values[i] >> 38) & 0x3ff) |
1887 ((values[i] >> 12) & 0xffc00) |
1888 ((values[i] << 14) & 0x3ff00000));
1893 store_scanline_x2b10g10r10 (bits_image_t * image,
1899 uint32_t *bits = image->bits + image->rowstride * y;
1900 uint64_t *values = (uint64_t *)v;
1901 uint32_t *pixel = bits + x;
1904 for (i = 0; i < width; ++i)
1906 WRITE (image, pixel++,
1907 ((values[i] >> 38) & 0x3ff) |
1908 ((values[i] >> 12) & 0xffc00) |
1909 ((values[i] << 14) & 0x3ff00000));
1914 store_scanline_a8r8g8b8 (bits_image_t * image,
1918 const uint32_t *values)
1920 uint32_t *bits = image->bits + image->rowstride * y;
1922 MEMCPY_WRAPPED (image, ((uint32_t *)bits) + x, values,
1923 width * sizeof(uint32_t));
1927 store_scanline_x8r8g8b8 (bits_image_t * image,
1931 const uint32_t *values)
1933 uint32_t *bits = image->bits + image->rowstride * y;
1934 uint32_t *pixel = (uint32_t *)bits + x;
1937 for (i = 0; i < width; ++i)
1938 WRITE (image, pixel++, values[i] & 0xffffff);
1942 store_scanline_a8b8g8r8 (bits_image_t * image,
1946 const uint32_t *values)
1948 uint32_t *bits = image->bits + image->rowstride * y;
1949 uint32_t *pixel = (uint32_t *)bits + x;
1952 for (i = 0; i < width; ++i)
1954 WRITE (image, pixel++,
1955 (values[i] & 0xff00ff00) |
1956 ((values[i] >> 16) & 0xff) |
1957 ((values[i] & 0xff) << 16));
1962 store_scanline_x8b8g8r8 (bits_image_t * image,
1966 const uint32_t *values)
1968 uint32_t *bits = image->bits + image->rowstride * y;
1969 uint32_t *pixel = (uint32_t *)bits + x;
1972 for (i = 0; i < width; ++i)
1974 WRITE (image, pixel++,
1975 (values[i] & 0x0000ff00) |
1976 ((values[i] >> 16) & 0xff) |
1977 ((values[i] & 0xff) << 16));
1982 store_scanline_b8g8r8a8 (bits_image_t * image,
1986 const uint32_t *values)
1988 uint32_t *bits = image->bits + image->rowstride * y;
1989 uint32_t *pixel = (uint32_t *)bits + x;
1992 for (i = 0; i < width; ++i)
1994 WRITE (image, pixel++,
1995 ((values[i] >> 24) & 0x000000ff) |
1996 ((values[i] >> 8) & 0x0000ff00) |
1997 ((values[i] << 8) & 0x00ff0000) |
1998 ((values[i] << 24) & 0xff000000));
2003 store_scanline_b8g8r8x8 (bits_image_t * image,
2007 const uint32_t *values)
2009 uint32_t *bits = image->bits + image->rowstride * y;
2010 uint32_t *pixel = (uint32_t *)bits + x;
2013 for (i = 0; i < width; ++i)
2015 WRITE (image, pixel++,
2016 ((values[i] >> 8) & 0x0000ff00) |
2017 ((values[i] << 8) & 0x00ff0000) |
2018 ((values[i] << 24) & 0xff000000));
2023 store_scanline_r8g8b8 (bits_image_t * image,
2027 const uint32_t *values)
2029 uint32_t *bits = image->bits + image->rowstride * y;
2030 uint8_t *pixel = ((uint8_t *) bits) + 3 * x;
2033 for (i = 0; i < width; ++i)
2035 uint32_t val = values[i];
2037 #ifdef WORDS_BIGENDIAN
2038 WRITE (image, pixel++, (val & 0x00ff0000) >> 16);
2039 WRITE (image, pixel++, (val & 0x0000ff00) >> 8);
2040 WRITE (image, pixel++, (val & 0x000000ff) >> 0);
2042 WRITE (image, pixel++, (val & 0x000000ff) >> 0);
2043 WRITE (image, pixel++, (val & 0x0000ff00) >> 8);
2044 WRITE (image, pixel++, (val & 0x00ff0000) >> 16);
2050 store_scanline_b8g8r8 (bits_image_t * image,
2054 const uint32_t *values)
2056 uint32_t *bits = image->bits + image->rowstride * y;
2057 uint8_t *pixel = ((uint8_t *) bits) + 3 * x;
2060 for (i = 0; i < width; ++i)
2062 uint32_t val = values[i];
2064 #ifdef WORDS_BIGENDIAN
2065 WRITE (image, pixel++, (val & 0x000000ff) >> 0);
2066 WRITE (image, pixel++, (val & 0x0000ff00) >> 8);
2067 WRITE (image, pixel++, (val & 0x00ff0000) >> 16);
2069 WRITE (image, pixel++, (val & 0x00ff0000) >> 16);
2070 WRITE (image, pixel++, (val & 0x0000ff00) >> 8);
2071 WRITE (image, pixel++, (val & 0x000000ff) >> 0);
2077 store_scanline_r5g6b5 (bits_image_t * image,
2081 const uint32_t *values)
2083 uint32_t *bits = image->bits + image->rowstride * y;
2084 uint16_t *pixel = ((uint16_t *) bits) + x;
2087 for (i = 0; i < width; ++i)
2089 uint32_t s = values[i];
2091 WRITE (image, pixel++,
2092 ((s >> 3) & 0x001f) |
2093 ((s >> 5) & 0x07e0) |
2094 ((s >> 8) & 0xf800));
2099 store_scanline_b5g6r5 (bits_image_t * image,
2103 const uint32_t *values)
2105 uint32_t *bits = image->bits + image->rowstride * y;
2106 uint16_t *pixel = ((uint16_t *) bits) + x;
2109 for (i = 0; i < width; ++i)
2113 WRITE (image, pixel++,
2114 ((b << 8) & 0xf800) |
2115 ((g << 3) & 0x07e0) |
2121 store_scanline_a1r5g5b5 (bits_image_t * image,
2125 const uint32_t *values)
2127 uint32_t *bits = image->bits + image->rowstride * y;
2128 uint16_t *pixel = ((uint16_t *) bits) + x;
2131 for (i = 0; i < width; ++i)
2133 SPLIT_A (values[i]);
2135 WRITE (image, pixel++,
2136 ((a << 8) & 0x8000) |
2137 ((r << 7) & 0x7c00) |
2138 ((g << 2) & 0x03e0) |
2144 store_scanline_x1r5g5b5 (bits_image_t * image,
2148 const uint32_t *values)
2150 uint32_t *bits = image->bits + image->rowstride * y;
2151 uint16_t *pixel = ((uint16_t *) bits) + x;
2154 for (i = 0; i < width; ++i)
2158 WRITE (image, pixel++,
2159 ((r << 7) & 0x7c00) |
2160 ((g << 2) & 0x03e0) |
2166 store_scanline_a1b5g5r5 (bits_image_t * image,
2170 const uint32_t *values)
2172 uint32_t *bits = image->bits + image->rowstride * y;
2173 uint16_t *pixel = ((uint16_t *) bits) + x;
2176 for (i = 0; i < width; ++i)
2178 SPLIT_A (values[i]);
2180 WRITE (image, pixel++,
2181 ((a << 8) & 0x8000) |
2182 ((b << 7) & 0x7c00) |
2183 ((g << 2) & 0x03e0) |
2189 store_scanline_x1b5g5r5 (bits_image_t * image,
2193 const uint32_t *values)
2195 uint32_t *bits = image->bits + image->rowstride * y;
2196 uint16_t *pixel = ((uint16_t *) bits) + x;
2199 for (i = 0; i < width; ++i)
2203 WRITE (image, pixel++, ((b << 7) & 0x7c00) |
2204 ((g << 2) & 0x03e0) |
2210 store_scanline_a4r4g4b4 (bits_image_t * image,
2214 const uint32_t *values)
2216 uint32_t *bits = image->bits + image->rowstride * y;
2217 uint16_t *pixel = ((uint16_t *) bits) + x;
2220 for (i = 0; i < width; ++i)
2222 SPLIT_A (values[i]);
2224 WRITE (image, pixel++,
2225 ((a << 8) & 0xf000) |
2226 ((r << 4) & 0x0f00) |
2233 store_scanline_x4r4g4b4 (bits_image_t * image,
2237 const uint32_t *values)
2239 uint32_t *bits = image->bits + image->rowstride * y;
2240 uint16_t *pixel = ((uint16_t *) bits) + x;
2243 for (i = 0; i < width; ++i)
2247 WRITE (image, pixel++,
2248 ((r << 4) & 0x0f00) |
2255 store_scanline_a4b4g4r4 (bits_image_t * image,
2259 const uint32_t *values)
2261 uint32_t *bits = image->bits + image->rowstride * y;
2262 uint16_t *pixel = ((uint16_t *) bits) + x;
2265 for (i = 0; i < width; ++i)
2267 SPLIT_A (values[i]);
2268 WRITE (image, pixel++, ((a << 8) & 0xf000) |
2269 ((b << 4) & 0x0f00) |
2276 store_scanline_x4b4g4r4 (bits_image_t * image,
2280 const uint32_t *values)
2282 uint32_t *bits = image->bits + image->rowstride * y;
2283 uint16_t *pixel = ((uint16_t *) bits) + x;
2286 for (i = 0; i < width; ++i)
2290 WRITE (image, pixel++,
2291 ((b << 4) & 0x0f00) |
2298 store_scanline_a8 (bits_image_t * image,
2302 const uint32_t *values)
2304 uint32_t *bits = image->bits + image->rowstride * y;
2305 uint8_t *pixel = ((uint8_t *) bits) + x;
2308 for (i = 0; i < width; ++i)
2310 WRITE (image, pixel++, values[i] >> 24);
2315 store_scanline_r3g3b2 (bits_image_t * image,
2319 const uint32_t *values)
2321 uint32_t *bits = image->bits + image->rowstride * y;
2322 uint8_t *pixel = ((uint8_t *) bits) + x;
2325 for (i = 0; i < width; ++i)
2329 WRITE (image, pixel++,
2337 store_scanline_b2g3r3 (bits_image_t * image,
2341 const uint32_t *values)
2343 uint32_t *bits = image->bits + image->rowstride * y;
2344 uint8_t *pixel = ((uint8_t *) bits) + x;
2347 for (i = 0; i < width; ++i)
2351 WRITE (image, pixel++,
2359 store_scanline_a2r2g2b2 (bits_image_t * image,
2363 const uint32_t *values)
2365 uint32_t *bits = image->bits + image->rowstride * y;
2366 uint8_t *pixel = ((uint8_t *) bits) + x;
2369 for (i = 0; i < width; ++i)
2371 SPLIT_A (values[i]);
2373 WRITE (image, pixel++,
2382 store_scanline_a2b2g2r2 (bits_image_t * image,
2386 const uint32_t *values)
2388 uint32_t *bits = image->bits + image->rowstride * y;
2389 uint8_t *pixel = ((uint8_t *) bits) + x;
2392 for (i = 0; i < width; ++i)
2394 SPLIT_A (values[i]);
2405 store_scanline_c8 (bits_image_t * image,
2409 const uint32_t *values)
2411 uint32_t *bits = image->bits + image->rowstride * y;
2412 uint8_t *pixel = ((uint8_t *) bits) + x;
2413 const pixman_indexed_t *indexed = image->indexed;
2416 for (i = 0; i < width; ++i)
2417 WRITE (image, pixel++, RGB24_TO_ENTRY (indexed,values[i]));
2421 store_scanline_x4a4 (bits_image_t * image,
2425 const uint32_t *values)
2427 uint32_t *bits = image->bits + image->rowstride * y;
2428 uint8_t *pixel = ((uint8_t *) bits) + x;
2431 for (i = 0; i < width; ++i)
2432 WRITE (image, pixel++, values[i] >> 28);
2435 #define STORE_8(img,l,o,v) (WRITE (img, (uint8_t *)(l) + ((o) >> 3), (v)))
2436 #ifdef WORDS_BIGENDIAN
2438 #define STORE_4(img,l,o,v) \
2442 STORE_8 (img, l, bo, (bo & 4 ? \
2443 (FETCH_8 (img, l, bo) & 0xf0) | (v) : \
2444 (FETCH_8 (img, l, bo) & 0x0f) | ((v) << 4))); \
2448 #define STORE_4(img,l,o,v) \
2452 STORE_8 (img, l, bo, (bo & 4 ? \
2453 (FETCH_8 (img, l, bo) & 0x0f) | ((v) << 4) : \
2454 (FETCH_8 (img, l, bo) & 0xf0) | (v))); \
2459 store_scanline_a4 (bits_image_t * image,
2463 const uint32_t *values)
2465 uint32_t *bits = image->bits + image->rowstride * y;
2468 for (i = 0; i < width; ++i)
2469 STORE_4 (image, bits, i + x, values[i] >> 28);
2473 store_scanline_r1g2b1 (bits_image_t * image,
2477 const uint32_t *values)
2479 uint32_t *bits = image->bits + image->rowstride * y;
2482 for (i = 0; i < width; ++i)
2487 pixel = (((r >> 4) & 0x8) |
2490 STORE_4 (image, bits, i + x, pixel);
2495 store_scanline_b1g2r1 (bits_image_t * image,
2499 const uint32_t *values)
2501 uint32_t *bits = image->bits + image->rowstride * y;
2504 for (i = 0; i < width; ++i)
2509 pixel = (((b >> 4) & 0x8) |
2512 STORE_4 (image, bits, i + x, pixel);
2517 store_scanline_a1r1g1b1 (bits_image_t * image,
2521 const uint32_t *values)
2523 uint32_t *bits = image->bits + image->rowstride * y;
2526 for (i = 0; i < width; ++i)
2530 SPLIT_A (values[i]);
2531 pixel = (((a >> 4) & 0x8) |
2536 STORE_4 (image, bits, i + x, pixel);
2541 store_scanline_a1b1g1r1 (bits_image_t * image,
2545 const uint32_t *values)
2547 uint32_t *bits = image->bits + image->rowstride * y;
2550 for (i = 0; i < width; ++i)
2554 SPLIT_A (values[i]);
2555 pixel = (((a >> 4) & 0x8) |
2560 STORE_4 (image, bits, i + x, pixel);
2565 store_scanline_c4 (bits_image_t * image,
2569 const uint32_t *values)
2571 uint32_t *bits = image->bits + image->rowstride * y;
2572 const pixman_indexed_t *indexed = image->indexed;
2575 for (i = 0; i < width; ++i)
2579 pixel = RGB24_TO_ENTRY (indexed, values[i]);
2580 STORE_4 (image, bits, i + x, pixel);
2585 store_scanline_a1 (bits_image_t * image,
2589 const uint32_t *values)
2591 uint32_t *bits = image->bits + image->rowstride * y;
2594 for (i = 0; i < width; ++i)
2596 uint32_t *pixel = ((uint32_t *) bits) + ((i + x) >> 5);
2599 #ifdef WORDS_BIGENDIAN
2600 mask = 1 << (0x1f - ((i + x) & 0x1f));
2602 mask = 1 << ((i + x) & 0x1f);
2604 v = values[i] & 0x80000000 ? mask : 0;
2606 WRITE (image, pixel, (READ (image, pixel) & ~mask) | v);
2611 store_scanline_g1 (bits_image_t * image,
2615 const uint32_t *values)
2617 uint32_t *bits = image->bits + image->rowstride * y;
2618 const pixman_indexed_t *indexed = image->indexed;
2621 for (i = 0; i < width; ++i)
2623 uint32_t *pixel = ((uint32_t *) bits) + ((i + x) >> 5);
2626 #ifdef WORDS_BIGENDIAN
2627 mask = 1 << (0x1f - ((i + x) & 0x1f));
2629 mask = 1 << ((i + x) & 0x1f);
2631 v = RGB24_TO_ENTRY_Y (indexed, values[i]) ? mask : 0;
2633 WRITE (image, pixel, (READ (image, pixel) & ~mask) | v);
2638 * Contracts a 64bpp image to 32bpp and then stores it using a regular 32-bit
2639 * store proc. Despite the type, this function expects a uint64_t buffer.
2642 store_scanline_generic_64 (bits_image_t * image,
2646 const uint32_t *values)
2648 uint32_t *argb8_pixels;
2650 assert (image->common.type == BITS);
2652 argb8_pixels = pixman_malloc_ab (width, sizeof(uint32_t));
2656 /* Contract the scanline. We could do this in place if values weren't
2659 pixman_contract (argb8_pixels, (uint64_t *)values, width);
2661 image->store_scanline_raw_32 (image, x, y, width, argb8_pixels);
2663 free (argb8_pixels);
2666 /* Despite the type, this function expects both buffer
2667 * and mask to be uint64_t
2670 fetch_scanline_generic_64 (pixman_image_t *image,
2675 const uint32_t *mask,
2678 /* Fetch the pixels into the first half of buffer and then expand them in
2681 image->bits.fetch_scanline_raw_32 (image, x, y, width, buffer, NULL, 0);
2683 pixman_expand ((uint64_t *)buffer, buffer, image->bits.format, width);
2686 /* Despite the type, this function expects a uint64_t *buffer */
2688 fetch_pixel_generic_64 (bits_image_t *image,
2692 uint32_t pixel32 = image->fetch_pixel_raw_32 (image, offset, line);
2695 pixman_expand ((uint64_t *)&result, &pixel32, image->format, 1);
2701 * XXX: The transformed fetch path only works at 32-bpp so far. When all
2702 * paths have wide versions, this can be removed.
2704 * WARNING: This function loses precision!
2707 fetch_pixel_generic_lossy_32 (bits_image_t *image,
2711 uint64_t pixel64 = image->fetch_pixel_raw_64 (image, offset, line);
2714 pixman_contract (&result, &pixel64, 1);
2721 pixman_format_code_t format;
2722 fetch_scanline_t fetch_scanline_raw_32;
2723 fetch_scanline_t fetch_scanline_raw_64;
2724 fetch_pixel_32_t fetch_pixel_raw_32;
2725 fetch_pixel_64_t fetch_pixel_raw_64;
2726 store_scanline_t store_scanline_raw_32;
2727 store_scanline_t store_scanline_raw_64;
2730 #define FORMAT_INFO(format) \
2732 PIXMAN_ ## format, \
2733 fetch_scanline_ ## format, \
2734 fetch_scanline_generic_64, \
2735 fetch_pixel_ ## format, fetch_pixel_generic_64, \
2736 store_scanline_ ## format, store_scanline_generic_64 \
2739 static const format_info_t accessors[] =
2741 /* 32 bpp formats */
2742 FORMAT_INFO (a8r8g8b8),
2743 FORMAT_INFO (x8r8g8b8),
2744 FORMAT_INFO (a8b8g8r8),
2745 FORMAT_INFO (x8b8g8r8),
2746 FORMAT_INFO (b8g8r8a8),
2747 FORMAT_INFO (b8g8r8x8),
2750 FORMAT_INFO (r8g8b8),
2751 FORMAT_INFO (b8g8r8),
2754 FORMAT_INFO (r5g6b5),
2755 FORMAT_INFO (b5g6r5),
2757 FORMAT_INFO (a1r5g5b5),
2758 FORMAT_INFO (x1r5g5b5),
2759 FORMAT_INFO (a1b5g5r5),
2760 FORMAT_INFO (x1b5g5r5),
2761 FORMAT_INFO (a4r4g4b4),
2762 FORMAT_INFO (x4r4g4b4),
2763 FORMAT_INFO (a4b4g4r4),
2764 FORMAT_INFO (x4b4g4r4),
2768 FORMAT_INFO (r3g3b2),
2769 FORMAT_INFO (b2g3r3),
2770 FORMAT_INFO (a2r2g2b2),
2771 FORMAT_INFO (a2b2g2r2),
2775 #define fetch_scanline_g8 fetch_scanline_c8
2776 #define fetch_pixel_g8 fetch_pixel_c8
2777 #define store_scanline_g8 store_scanline_c8
2780 #define fetch_scanline_x4c4 fetch_scanline_c8
2781 #define fetch_pixel_x4c4 fetch_pixel_c8
2782 #define store_scanline_x4c4 store_scanline_c8
2785 #define fetch_scanline_x4g4 fetch_scanline_c8
2786 #define fetch_pixel_x4g4 fetch_pixel_c8
2787 #define store_scanline_x4g4 store_scanline_c8
2794 FORMAT_INFO (r1g2b1),
2795 FORMAT_INFO (b1g2r1),
2796 FORMAT_INFO (a1r1g1b1),
2797 FORMAT_INFO (a1b1g1r1),
2801 #define fetch_scanline_g4 fetch_scanline_c4
2802 #define fetch_pixel_g4 fetch_pixel_c4
2803 #define store_scanline_g4 store_scanline_c4
2812 { PIXMAN_a2r10g10b10,
2813 NULL, fetch_scanline_a2r10g10b10,
2814 fetch_pixel_generic_lossy_32, fetch_pixel_a2r10g10b10,
2815 NULL, store_scanline_a2r10g10b10 },
2817 { PIXMAN_x2r10g10b10,
2818 NULL, fetch_scanline_x2r10g10b10,
2819 fetch_pixel_generic_lossy_32, fetch_pixel_x2r10g10b10,
2820 NULL, store_scanline_x2r10g10b10 },
2822 { PIXMAN_a2b10g10r10,
2823 NULL, fetch_scanline_a2b10g10r10,
2824 fetch_pixel_generic_lossy_32, fetch_pixel_a2b10g10r10,
2825 NULL, store_scanline_a2b10g10r10 },
2827 { PIXMAN_x2b10g10r10,
2828 NULL, fetch_scanline_x2b10g10r10,
2829 fetch_pixel_generic_lossy_32, fetch_pixel_x2b10g10r10,
2830 NULL, store_scanline_x2b10g10r10 },
2834 fetch_scanline_yuy2, fetch_scanline_generic_64,
2835 fetch_pixel_yuy2, fetch_pixel_generic_64,
2839 fetch_scanline_yv12, fetch_scanline_generic_64,
2840 fetch_pixel_yv12, fetch_pixel_generic_64,
2847 setup_accessors (bits_image_t *image)
2849 const format_info_t *info = accessors;
2851 while (info->format != PIXMAN_null)
2853 if (info->format == image->format)
2855 image->fetch_scanline_raw_32 = info->fetch_scanline_raw_32;
2856 image->fetch_scanline_raw_64 = info->fetch_scanline_raw_64;
2857 image->fetch_pixel_raw_32 = info->fetch_pixel_raw_32;
2858 image->fetch_pixel_raw_64 = info->fetch_pixel_raw_64;
2859 image->store_scanline_raw_32 = info->store_scanline_raw_32;
2860 image->store_scanline_raw_64 = info->store_scanline_raw_64;
2869 #ifndef PIXMAN_FB_ACCESSORS
2871 _pixman_bits_image_setup_raw_accessors_accessors (bits_image_t *image);
2874 _pixman_bits_image_setup_raw_accessors (bits_image_t *image)
2876 if (image->read_func || image->write_func)
2877 _pixman_bits_image_setup_raw_accessors_accessors (image);
2879 setup_accessors (image);
2885 _pixman_bits_image_setup_raw_accessors_accessors (bits_image_t *image)
2887 setup_accessors (image);