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)))
91 static force_inline void
92 get_shifts (pixman_format_code_t format,
98 switch (PIXMAN_FORMAT_TYPE (format))
107 case PIXMAN_TYPE_ARGB:
109 *g = *b + PIXMAN_FORMAT_B (format);
110 *r = *g + PIXMAN_FORMAT_G (format);
111 *a = *r + PIXMAN_FORMAT_R (format);
114 case PIXMAN_TYPE_ABGR:
116 *g = *r + PIXMAN_FORMAT_R (format);
117 *b = *g + PIXMAN_FORMAT_G (format);
118 *a = *b + PIXMAN_FORMAT_B (format);
121 case PIXMAN_TYPE_BGRA:
122 /* With BGRA formats we start counting at the high end of the pixel */
123 *b = PIXMAN_FORMAT_BPP (format) - PIXMAN_FORMAT_B (format);
124 *g = *b - PIXMAN_FORMAT_B (format);
125 *r = *g - PIXMAN_FORMAT_G (format);
126 *a = *r - PIXMAN_FORMAT_R (format);
129 case PIXMAN_TYPE_RGBA:
130 /* With BGRA formats we start counting at the high end of the pixel */
131 *r = PIXMAN_FORMAT_BPP (format) - PIXMAN_FORMAT_R (format);
132 *g = *r - PIXMAN_FORMAT_R (format);
133 *b = *g - PIXMAN_FORMAT_G (format);
134 *a = *b - PIXMAN_FORMAT_B (format);
143 static force_inline uint32_t
144 convert_channel (uint32_t pixel, uint32_t def_value,
145 int n_from_bits, int from_shift,
146 int n_to_bits, int to_shift)
150 if (n_from_bits && n_to_bits)
151 v = unorm_to_unorm (pixel >> from_shift, n_from_bits, n_to_bits);
157 return (v & ((1 << n_to_bits) - 1)) << to_shift;
160 static force_inline uint32_t
161 convert_pixel (pixman_format_code_t from, pixman_format_code_t to, uint32_t pixel)
163 int a_from_shift, r_from_shift, g_from_shift, b_from_shift;
164 int a_to_shift, r_to_shift, g_to_shift, b_to_shift;
167 get_shifts (from, &a_from_shift, &r_from_shift, &g_from_shift, &b_from_shift);
168 get_shifts (to, &a_to_shift, &r_to_shift, &g_to_shift, &b_to_shift);
170 a = convert_channel (pixel, ~0,
171 PIXMAN_FORMAT_A (from), a_from_shift,
172 PIXMAN_FORMAT_A (to), a_to_shift);
174 r = convert_channel (pixel, 0,
175 PIXMAN_FORMAT_R (from), r_from_shift,
176 PIXMAN_FORMAT_R (to), r_to_shift);
178 g = convert_channel (pixel, 0,
179 PIXMAN_FORMAT_G (from), g_from_shift,
180 PIXMAN_FORMAT_G (to), g_to_shift);
182 b = convert_channel (pixel, 0,
183 PIXMAN_FORMAT_B (from), b_from_shift,
184 PIXMAN_FORMAT_B (to), b_to_shift);
186 return a | r | g | b;
189 static force_inline uint32_t
190 convert_pixel_from_a8r8g8b8 (pixman_format_code_t format, uint32_t pixel)
192 return convert_pixel (PIXMAN_a8r8g8b8, format, pixel);
195 static force_inline uint32_t
196 convert_pixel_to_a8r8g8b8 (pixman_format_code_t format, uint32_t pixel)
198 return convert_pixel (format, PIXMAN_a8r8g8b8, pixel);
201 static force_inline uint32_t
202 fetch_and_convert_pixel (pixman_image_t * image,
203 const uint8_t * bits,
204 pixman_format_code_t format)
208 switch (PIXMAN_FORMAT_BPP (format))
211 pixel = READ (image, (uint32_t *)bits);
215 pixel = 0xffff00ff; /* As ugly as possible to detect the bug */
219 return convert_pixel_to_a8r8g8b8 (format, pixel);
222 static force_inline void
223 convert_and_store_pixel (bits_image_t * image,
225 pixman_format_code_t format,
228 uint32_t converted = convert_pixel_from_a8r8g8b8 (format, pixel);
230 switch (PIXMAN_FORMAT_BPP (format))
233 WRITE (image, (uint32_t *)dest, converted);
242 #define MAKE_ACCESSORS(format) \
244 fetch_scanline_ ## format (pixman_image_t *image, \
249 const uint32_t *mask) \
251 int byte_pp = PIXMAN_FORMAT_BPP (PIXMAN_ ## format) / 8; \
253 (uint8_t *)(image->bits.bits + y * image->bits.rowstride); \
256 bits += byte_pp * x; \
257 end = bits + width * byte_pp; \
262 fetch_and_convert_pixel (image, bits, PIXMAN_ ## format); \
269 store_scanline_ ## format (bits_image_t * image, \
273 const uint32_t *values) \
275 int byte_pp = PIXMAN_FORMAT_BPP (PIXMAN_ ## format) / 8; \
277 (uint8_t *)(image->bits + y * image->rowstride); \
278 const uint32_t *end; \
280 dest += byte_pp * x; \
281 end = values + width; \
283 while (values < end) \
285 convert_and_store_pixel ( \
286 image, dest, PIXMAN_ ## format, *values); \
294 fetch_pixel_ ## format (bits_image_t *image, \
299 (uint8_t *)(image->bits + line * image->rowstride); \
300 int byte_pp = PIXMAN_FORMAT_BPP (PIXMAN_ ## format) / 8; \
302 bits += offset * byte_pp; \
304 return fetch_and_convert_pixel ((pixman_image_t *)image, \
305 bits, PIXMAN_ ## format); \
308 static const void *const __dummy__ ## format
310 MAKE_ACCESSORS(a8r8g8b8);
311 MAKE_ACCESSORS(x8r8g8b8);
312 MAKE_ACCESSORS(a8b8g8r8);
313 MAKE_ACCESSORS(x8b8g8r8);
314 MAKE_ACCESSORS(x14r6g6b6);
315 MAKE_ACCESSORS(b8g8r8a8);
316 MAKE_ACCESSORS(b8g8r8x8);
317 MAKE_ACCESSORS(r8g8b8x8);
318 MAKE_ACCESSORS(r8g8b8a8);
320 /********************************** Fetch ************************************/
322 /* Expects a uint64_t buffer */
324 fetch_scanline_a2r10g10b10 (pixman_image_t *image,
329 const uint32_t *mask)
331 const uint32_t *bits = image->bits.bits + y * image->bits.rowstride;
332 const uint32_t *pixel = 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 a = p >> 30;
340 uint64_t r = (p >> 20) & 0x3ff;
341 uint64_t g = (p >> 10) & 0x3ff;
342 uint64_t b = p & 0x3ff;
353 *buffer++ = a << 48 | r << 32 | g << 16 | b;
357 /* Expects a uint64_t buffer */
359 fetch_scanline_x2r10g10b10 (pixman_image_t *image,
364 const uint32_t *mask)
366 const uint32_t *bits = image->bits.bits + y * image->bits.rowstride;
367 const uint32_t *pixel = (uint32_t *)bits + x;
368 const uint32_t *end = pixel + width;
369 uint64_t *buffer = (uint64_t *)b;
373 uint32_t p = READ (image, pixel++);
374 uint64_t r = (p >> 20) & 0x3ff;
375 uint64_t g = (p >> 10) & 0x3ff;
376 uint64_t b = p & 0x3ff;
382 *buffer++ = 0xffffULL << 48 | r << 32 | g << 16 | b;
386 /* Expects a uint64_t buffer */
388 fetch_scanline_a2b10g10r10 (pixman_image_t *image,
393 const uint32_t *mask)
395 const uint32_t *bits = image->bits.bits + y * image->bits.rowstride;
396 const uint32_t *pixel = bits + x;
397 const uint32_t *end = pixel + width;
398 uint64_t *buffer = (uint64_t *)b;
402 uint32_t p = READ (image, pixel++);
403 uint64_t a = p >> 30;
404 uint64_t b = (p >> 20) & 0x3ff;
405 uint64_t g = (p >> 10) & 0x3ff;
406 uint64_t r = p & 0x3ff;
417 *buffer++ = a << 48 | r << 32 | g << 16 | b;
421 /* Expects a uint64_t buffer */
423 fetch_scanline_x2b10g10r10 (pixman_image_t *image,
428 const uint32_t *mask)
430 const uint32_t *bits = image->bits.bits + y * image->bits.rowstride;
431 const uint32_t *pixel = (uint32_t *)bits + x;
432 const uint32_t *end = pixel + width;
433 uint64_t *buffer = (uint64_t *)b;
437 uint32_t p = READ (image, pixel++);
438 uint64_t b = (p >> 20) & 0x3ff;
439 uint64_t g = (p >> 10) & 0x3ff;
440 uint64_t r = p & 0x3ff;
446 *buffer++ = 0xffffULL << 48 | r << 32 | g << 16 | b;
451 fetch_scanline_r8g8b8 (pixman_image_t *image,
456 const uint32_t *mask)
458 const uint32_t *bits = image->bits.bits + y * image->bits.rowstride;
459 const uint8_t *pixel = (const uint8_t *)bits + 3 * x;
460 const uint8_t *end = pixel + 3 * width;
464 uint32_t b = 0xff000000;
466 #ifdef WORDS_BIGENDIAN
467 b |= (READ (image, pixel++) << 16);
468 b |= (READ (image, pixel++) << 8);
469 b |= (READ (image, pixel++));
471 b |= (READ (image, pixel++));
472 b |= (READ (image, pixel++) << 8);
473 b |= (READ (image, pixel++) << 16);
481 fetch_scanline_b8g8r8 (pixman_image_t *image,
486 const uint32_t *mask)
488 const uint32_t *bits = image->bits.bits + y * image->bits.rowstride;
489 const uint8_t *pixel = (const uint8_t *)bits + 3 * x;
490 const uint8_t *end = pixel + 3 * width;
494 uint32_t b = 0xff000000;
495 #ifdef WORDS_BIGENDIAN
496 b |= (READ (image, pixel++));
497 b |= (READ (image, pixel++) << 8);
498 b |= (READ (image, pixel++) << 16);
500 b |= (READ (image, pixel++) << 16);
501 b |= (READ (image, pixel++) << 8);
502 b |= (READ (image, pixel++));
509 fetch_scanline_r5g6b5 (pixman_image_t *image,
514 const uint32_t *mask)
516 const uint32_t *bits = image->bits.bits + y * image->bits.rowstride;
517 const uint16_t *pixel = (const uint16_t *)bits + x;
518 const uint16_t *end = pixel + width;
522 uint32_t p = READ (image, pixel++);
523 uint32_t r = (((p) << 3) & 0xf8) |
524 (((p) << 5) & 0xfc00) |
525 (((p) << 8) & 0xf80000);
527 r |= (r >> 5) & 0x70007;
528 r |= (r >> 6) & 0x300;
530 *buffer++ = 0xff000000 | r;
535 fetch_scanline_b5g6r5 (pixman_image_t *image,
540 const uint32_t *mask)
542 const uint32_t *bits = image->bits.bits + y * image->bits.rowstride;
543 const uint16_t *pixel = (const uint16_t *)bits + x;
544 const uint16_t *end = pixel + width;
548 uint32_t p = READ (image, pixel++);
551 b = ((p & 0xf800) | ((p & 0xe000) >> 5)) >> 8;
552 g = ((p & 0x07e0) | ((p & 0x0600) >> 6)) << 5;
553 r = ((p & 0x001c) | ((p & 0x001f) << 5)) << 14;
555 *buffer++ = 0xff000000 | r | g | b;
560 fetch_scanline_a1r5g5b5 (pixman_image_t *image,
565 const uint32_t *mask)
567 const uint32_t *bits = image->bits.bits + y * image->bits.rowstride;
568 const uint16_t *pixel = (const uint16_t *)bits + x;
569 const uint16_t *end = pixel + width;
573 uint32_t p = READ (image, pixel++);
576 a = (uint32_t) ((uint8_t) (0 - ((p & 0x8000) >> 15))) << 24;
577 r = ((p & 0x7c00) | ((p & 0x7000) >> 5)) << 9;
578 g = ((p & 0x03e0) | ((p & 0x0380) >> 5)) << 6;
579 b = ((p & 0x001c) | ((p & 0x001f) << 5)) >> 2;
581 *buffer++ = a | r | g | b;
586 fetch_scanline_x1r5g5b5 (pixman_image_t *image,
591 const uint32_t *mask)
593 const uint32_t *bits = image->bits.bits + y * image->bits.rowstride;
594 const uint16_t *pixel = (const uint16_t *)bits + x;
595 const uint16_t *end = pixel + width;
599 uint32_t p = READ (image, pixel++);
602 r = ((p & 0x7c00) | ((p & 0x7000) >> 5)) << 9;
603 g = ((p & 0x03e0) | ((p & 0x0380) >> 5)) << 6;
604 b = ((p & 0x001c) | ((p & 0x001f) << 5)) >> 2;
606 *buffer++ = 0xff000000 | r | g | b;
611 fetch_scanline_a1b5g5r5 (pixman_image_t *image,
616 const uint32_t *mask)
618 const uint32_t *bits = image->bits.bits + y * image->bits.rowstride;
619 const uint16_t *pixel = (const uint16_t *)bits + x;
620 const uint16_t *end = pixel + width;
625 uint32_t p = READ (image, pixel++);
627 a = (uint32_t) ((uint8_t) (0 - ((p & 0x8000) >> 15))) << 24;
628 b = ((p & 0x7c00) | ((p & 0x7000) >> 5)) >> 7;
629 g = ((p & 0x03e0) | ((p & 0x0380) >> 5)) << 6;
630 r = ((p & 0x001c) | ((p & 0x001f) << 5)) << 14;
632 *buffer++ = a | r | g | b;
637 fetch_scanline_x1b5g5r5 (pixman_image_t *image,
642 const uint32_t *mask)
644 const uint32_t *bits = image->bits.bits + y * image->bits.rowstride;
645 const uint16_t *pixel = (const uint16_t *)bits + x;
646 const uint16_t *end = pixel + width;
650 uint32_t p = READ (image, pixel++);
653 b = ((p & 0x7c00) | ((p & 0x7000) >> 5)) >> 7;
654 g = ((p & 0x03e0) | ((p & 0x0380) >> 5)) << 6;
655 r = ((p & 0x001c) | ((p & 0x001f) << 5)) << 14;
657 *buffer++ = 0xff000000 | r | g | b;
662 fetch_scanline_a4r4g4b4 (pixman_image_t *image,
667 const uint32_t *mask)
669 const uint32_t *bits = image->bits.bits + y * image->bits.rowstride;
670 const uint16_t *pixel = (const uint16_t *)bits + x;
671 const uint16_t *end = pixel + width;
675 uint32_t p = READ (image, pixel++);
678 a = ((p & 0xf000) | ((p & 0xf000) >> 4)) << 16;
679 r = ((p & 0x0f00) | ((p & 0x0f00) >> 4)) << 12;
680 g = ((p & 0x00f0) | ((p & 0x00f0) >> 4)) << 8;
681 b = ((p & 0x000f) | ((p & 0x000f) << 4));
683 *buffer++ = a | r | g | b;
688 fetch_scanline_x4r4g4b4 (pixman_image_t *image,
693 const uint32_t *mask)
695 const uint32_t *bits = image->bits.bits + y * image->bits.rowstride;
696 const uint16_t *pixel = (const uint16_t *)bits + x;
697 const uint16_t *end = pixel + width;
701 uint32_t p = READ (image, pixel++);
704 r = ((p & 0x0f00) | ((p & 0x0f00) >> 4)) << 12;
705 g = ((p & 0x00f0) | ((p & 0x00f0) >> 4)) << 8;
706 b = ((p & 0x000f) | ((p & 0x000f) << 4));
708 *buffer++ = 0xff000000 | r | g | b;
713 fetch_scanline_a4b4g4r4 (pixman_image_t *image,
718 const uint32_t *mask)
720 const uint32_t *bits = image->bits.bits + y * image->bits.rowstride;
721 const uint16_t *pixel = (const uint16_t *)bits + x;
722 const uint16_t *end = pixel + width;
726 uint32_t p = READ (image, pixel++);
729 a = ((p & 0xf000) | ((p & 0xf000) >> 4)) << 16;
730 b = ((p & 0x0f00) | ((p & 0x0f00) >> 4)) >> 4;
731 g = ((p & 0x00f0) | ((p & 0x00f0) >> 4)) << 8;
732 r = ((p & 0x000f) | ((p & 0x000f) << 4)) << 16;
734 *buffer++ = a | r | g | b;
739 fetch_scanline_x4b4g4r4 (pixman_image_t *image,
744 const uint32_t *mask)
746 const uint32_t *bits = image->bits.bits + y * image->bits.rowstride;
747 const uint16_t *pixel = (const uint16_t *)bits + x;
748 const uint16_t *end = pixel + width;
752 uint32_t p = READ (image, pixel++);
755 b = ((p & 0x0f00) | ((p & 0x0f00) >> 4)) >> 4;
756 g = ((p & 0x00f0) | ((p & 0x00f0) >> 4)) << 8;
757 r = ((p & 0x000f) | ((p & 0x000f) << 4)) << 16;
759 *buffer++ = 0xff000000 | r | g | b;
764 fetch_scanline_a8 (pixman_image_t *image,
769 const uint32_t *mask)
771 const uint32_t *bits = image->bits.bits + y * image->bits.rowstride;
772 const uint8_t *pixel = (const uint8_t *)bits + x;
773 const uint8_t *end = pixel + width;
776 *buffer++ = READ (image, pixel++) << 24;
780 fetch_scanline_r3g3b2 (pixman_image_t *image,
785 const uint32_t *mask)
787 const uint32_t *bits = image->bits.bits + y * image->bits.rowstride;
788 const uint8_t *pixel = (const uint8_t *)bits + x;
789 const uint8_t *end = pixel + width;
793 uint32_t p = READ (image, pixel++);
796 r = ((p & 0xe0) | ((p & 0xe0) >> 3) | ((p & 0xc0) >> 6)) << 16;
797 g = ((p & 0x1c) | ((p & 0x18) >> 3) | ((p & 0x1c) << 3)) << 8;
803 *buffer++ = 0xff000000 | r | g | b;
808 fetch_scanline_b2g3r3 (pixman_image_t *image,
813 const uint32_t *mask)
815 const uint32_t *bits = image->bits.bits + y * image->bits.rowstride;
816 const uint8_t *pixel = (const uint8_t *)bits + x;
817 const uint8_t *end = pixel + width;
821 uint32_t p = READ (image, pixel++);
829 g = (p & 0x38) << 10;
839 *buffer++ = 0xff000000 | r | g | b;
844 fetch_scanline_a2r2g2b2 (pixman_image_t *image,
849 const uint32_t *mask)
851 const uint32_t *bits = image->bits.bits + y * image->bits.rowstride;
852 const uint8_t *pixel = (const uint8_t *)bits + x;
853 const uint8_t *end = pixel + width;
857 uint32_t p = READ (image, pixel++);
860 a = ((p & 0xc0) * 0x55) << 18;
861 r = ((p & 0x30) * 0x55) << 12;
862 g = ((p & 0x0c) * 0x55) << 6;
863 b = ((p & 0x03) * 0x55);
865 *buffer++ = a | r | g | b;
870 fetch_scanline_a2b2g2r2 (pixman_image_t *image,
875 const uint32_t *mask)
877 const uint32_t *bits = image->bits.bits + y * image->bits.rowstride;
878 const uint8_t *pixel = (const uint8_t *)bits + x;
879 const uint8_t *end = pixel + width;
883 uint32_t p = READ (image, pixel++);
886 a = ((p & 0xc0) * 0x55) << 18;
887 b = ((p & 0x30) * 0x55) >> 4;
888 g = ((p & 0x0c) * 0x55) << 6;
889 r = ((p & 0x03) * 0x55) << 16;
891 *buffer++ = a | r | g | b;
896 fetch_scanline_c8 (pixman_image_t *image,
901 const uint32_t *mask)
903 const uint32_t *bits = image->bits.bits + y * image->bits.rowstride;
904 const pixman_indexed_t * indexed = image->bits.indexed;
905 const uint8_t *pixel = (const uint8_t *)bits + x;
906 const uint8_t *end = pixel + width;
910 uint32_t p = READ (image, pixel++);
912 *buffer++ = indexed->rgba[p];
917 fetch_scanline_x4a4 (pixman_image_t *image,
922 const uint32_t *mask)
924 const uint32_t *bits = image->bits.bits + y * image->bits.rowstride;
925 const uint8_t *pixel = (const uint8_t *)bits + x;
926 const uint8_t *end = pixel + width;
930 uint8_t p = READ (image, pixel++) & 0xf;
932 *buffer++ = (p | (p << 4)) << 24;
936 #define FETCH_8(img,l,o) (READ (img, (((uint8_t *)(l)) + ((o) >> 3))))
937 #ifdef WORDS_BIGENDIAN
938 #define FETCH_4(img,l,o) \
939 (((4 * (o)) & 4) ? (FETCH_8 (img,l, 4 * (o)) & 0xf) : (FETCH_8 (img,l,(4 * (o))) >> 4))
941 #define FETCH_4(img,l,o) \
942 (((4 * (o)) & 4) ? (FETCH_8 (img, l, 4 * (o)) >> 4) : (FETCH_8 (img, l, (4 * (o))) & 0xf))
946 fetch_scanline_a4 (pixman_image_t *image,
951 const uint32_t *mask)
953 const uint32_t *bits = image->bits.bits + y * image->bits.rowstride;
956 for (i = 0; i < width; ++i)
958 uint32_t p = FETCH_4 (image, bits, i + x);
967 fetch_scanline_r1g2b1 (pixman_image_t *image,
972 const uint32_t *mask)
974 const uint32_t *bits = image->bits.bits + y * image->bits.rowstride;
977 for (i = 0; i < width; ++i)
979 uint32_t p = FETCH_4 (image, bits, i + x);
982 r = ((p & 0x8) * 0xff) << 13;
983 g = ((p & 0x6) * 0x55) << 7;
984 b = ((p & 0x1) * 0xff);
986 *buffer++ = 0xff000000 | r | g | b;
991 fetch_scanline_b1g2r1 (pixman_image_t *image,
996 const uint32_t *mask)
998 const uint32_t *bits = image->bits.bits + y * image->bits.rowstride;
1001 for (i = 0; i < width; ++i)
1003 uint32_t p = FETCH_4 (image, bits, i + x);
1006 b = ((p & 0x8) * 0xff) >> 3;
1007 g = ((p & 0x6) * 0x55) << 7;
1008 r = ((p & 0x1) * 0xff) << 16;
1010 *buffer++ = 0xff000000 | r | g | b;
1015 fetch_scanline_a1r1g1b1 (pixman_image_t *image,
1020 const uint32_t *mask)
1022 uint32_t a, r, g, b;
1023 const uint32_t *bits = image->bits.bits + y * image->bits.rowstride;
1026 for (i = 0; i < width; ++i)
1028 uint32_t p = FETCH_4 (image, bits, i + x);
1030 a = ((p & 0x8) * 0xff) << 21;
1031 r = ((p & 0x4) * 0xff) << 14;
1032 g = ((p & 0x2) * 0xff) << 7;
1033 b = ((p & 0x1) * 0xff);
1035 *buffer++ = a | r | g | b;
1040 fetch_scanline_a1b1g1r1 (pixman_image_t *image,
1045 const uint32_t *mask)
1047 const uint32_t *bits = image->bits.bits + y * image->bits.rowstride;
1050 for (i = 0; i < width; ++i)
1052 uint32_t p = FETCH_4 (image, bits, i + x);
1053 uint32_t a, r, g, b;
1055 a = ((p & 0x8) * 0xff) << 21;
1056 b = ((p & 0x4) * 0xff) >> 2;
1057 g = ((p & 0x2) * 0xff) << 7;
1058 r = ((p & 0x1) * 0xff) << 16;
1060 *buffer++ = a | r | g | b;
1065 fetch_scanline_c4 (pixman_image_t *image,
1070 const uint32_t *mask)
1072 const uint32_t *bits = image->bits.bits + y * image->bits.rowstride;
1073 const pixman_indexed_t * indexed = image->bits.indexed;
1076 for (i = 0; i < width; ++i)
1078 uint32_t p = FETCH_4 (image, bits, i + x);
1080 *buffer++ = indexed->rgba[p];
1085 fetch_scanline_a1 (pixman_image_t *image,
1090 const uint32_t *mask)
1092 const uint32_t *bits = image->bits.bits + y * image->bits.rowstride;
1095 for (i = 0; i < width; ++i)
1097 uint32_t p = READ (image, bits + ((i + x) >> 5));
1100 #ifdef WORDS_BIGENDIAN
1101 a = p >> (0x1f - ((i + x) & 0x1f));
1103 a = p >> ((i + x) & 0x1f);
1110 *buffer++ = a << 24;
1115 fetch_scanline_g1 (pixman_image_t *image,
1120 const uint32_t *mask)
1122 const uint32_t *bits = image->bits.bits + y * image->bits.rowstride;
1123 const pixman_indexed_t * indexed = image->bits.indexed;
1126 for (i = 0; i < width; ++i)
1128 uint32_t p = READ (image, bits + ((i + x) >> 5));
1131 #ifdef WORDS_BIGENDIAN
1132 a = p >> (0x1f - ((i + x) & 0x1f));
1134 a = p >> ((i + x) & 0x1f);
1138 *buffer++ = indexed->rgba[a];
1143 fetch_scanline_yuy2 (pixman_image_t *image,
1148 const uint32_t *mask)
1150 const uint32_t *bits = image->bits.bits + image->bits.rowstride * line;
1153 for (i = 0; i < width; i++)
1158 y = ((uint8_t *) bits)[(x + i) << 1] - 16;
1159 u = ((uint8_t *) bits)[(((x + i) << 1) & - 4) + 1] - 128;
1160 v = ((uint8_t *) bits)[(((x + i) << 1) & - 4) + 3] - 128;
1162 /* R = 1.164(Y - 16) + 1.596(V - 128) */
1163 r = 0x012b27 * y + 0x019a2e * v;
1164 /* G = 1.164(Y - 16) - 0.813(V - 128) - 0.391(U - 128) */
1165 g = 0x012b27 * y - 0x00d0f2 * v - 0x00647e * u;
1166 /* B = 1.164(Y - 16) + 2.018(U - 128) */
1167 b = 0x012b27 * y + 0x0206a2 * u;
1169 *buffer++ = 0xff000000 |
1170 (r >= 0 ? r < 0x1000000 ? r & 0xff0000 : 0xff0000 : 0) |
1171 (g >= 0 ? g < 0x1000000 ? (g >> 8) & 0x00ff00 : 0x00ff00 : 0) |
1172 (b >= 0 ? b < 0x1000000 ? (b >> 16) & 0x0000ff : 0x0000ff : 0);
1177 fetch_scanline_yv12 (pixman_image_t *image,
1182 const uint32_t *mask)
1185 uint8_t *y_line = YV12_Y (line);
1186 uint8_t *u_line = YV12_U (line);
1187 uint8_t *v_line = YV12_V (line);
1190 for (i = 0; i < width; i++)
1195 y = y_line[x + i] - 16;
1196 u = u_line[(x + i) >> 1] - 128;
1197 v = v_line[(x + i) >> 1] - 128;
1199 /* R = 1.164(Y - 16) + 1.596(V - 128) */
1200 r = 0x012b27 * y + 0x019a2e * v;
1201 /* G = 1.164(Y - 16) - 0.813(V - 128) - 0.391(U - 128) */
1202 g = 0x012b27 * y - 0x00d0f2 * v - 0x00647e * u;
1203 /* B = 1.164(Y - 16) + 2.018(U - 128) */
1204 b = 0x012b27 * y + 0x0206a2 * u;
1206 *buffer++ = 0xff000000 |
1207 (r >= 0 ? r < 0x1000000 ? r & 0xff0000 : 0xff0000 : 0) |
1208 (g >= 0 ? g < 0x1000000 ? (g >> 8) & 0x00ff00 : 0x00ff00 : 0) |
1209 (b >= 0 ? b < 0x1000000 ? (b >> 16) & 0x0000ff : 0x0000ff : 0);
1213 /**************************** Pixel wise fetching *****************************/
1215 /* Despite the type, expects a uint64_t buffer */
1217 fetch_pixel_a2r10g10b10 (bits_image_t *image,
1221 uint32_t *bits = image->bits + line * image->rowstride;
1222 uint32_t p = READ (image, bits + offset);
1223 uint64_t a = p >> 30;
1224 uint64_t r = (p >> 20) & 0x3ff;
1225 uint64_t g = (p >> 10) & 0x3ff;
1226 uint64_t b = p & 0x3ff;
1228 r = r << 6 | r >> 4;
1229 g = g << 6 | g >> 4;
1230 b = b << 6 | b >> 4;
1237 return a << 48 | r << 32 | g << 16 | b;
1240 /* Despite the type, this function expects a uint64_t buffer */
1242 fetch_pixel_x2r10g10b10 (bits_image_t *image,
1246 uint32_t *bits = image->bits + line * image->rowstride;
1247 uint32_t p = READ (image, bits + offset);
1248 uint64_t r = (p >> 20) & 0x3ff;
1249 uint64_t g = (p >> 10) & 0x3ff;
1250 uint64_t b = p & 0x3ff;
1252 r = r << 6 | r >> 4;
1253 g = g << 6 | g >> 4;
1254 b = b << 6 | b >> 4;
1256 return 0xffffULL << 48 | r << 32 | g << 16 | b;
1259 /* Despite the type, expects a uint64_t buffer */
1261 fetch_pixel_a2b10g10r10 (bits_image_t *image,
1265 uint32_t *bits = image->bits + line * image->rowstride;
1266 uint32_t p = READ (image, bits + offset);
1267 uint64_t a = p >> 30;
1268 uint64_t b = (p >> 20) & 0x3ff;
1269 uint64_t g = (p >> 10) & 0x3ff;
1270 uint64_t r = p & 0x3ff;
1272 r = r << 6 | r >> 4;
1273 g = g << 6 | g >> 4;
1274 b = b << 6 | b >> 4;
1281 return a << 48 | r << 32 | g << 16 | b;
1284 /* Despite the type, this function expects a uint64_t buffer */
1286 fetch_pixel_x2b10g10r10 (bits_image_t *image,
1290 uint32_t *bits = image->bits + line * image->rowstride;
1291 uint32_t p = READ (image, bits + offset);
1292 uint64_t b = (p >> 20) & 0x3ff;
1293 uint64_t g = (p >> 10) & 0x3ff;
1294 uint64_t r = p & 0x3ff;
1296 r = r << 6 | r >> 4;
1297 g = g << 6 | g >> 4;
1298 b = b << 6 | b >> 4;
1300 return 0xffffULL << 48 | r << 32 | g << 16 | b;
1304 fetch_pixel_r8g8b8 (bits_image_t *image,
1308 uint32_t *bits = image->bits + line * image->rowstride;
1309 uint8_t *pixel = ((uint8_t *) bits) + (offset * 3);
1311 #ifdef WORDS_BIGENDIAN
1312 return (0xff000000 |
1313 (READ (image, pixel + 0) << 16) |
1314 (READ (image, pixel + 1) << 8) |
1315 (READ (image, pixel + 2)));
1317 return (0xff000000 |
1318 (READ (image, pixel + 2) << 16) |
1319 (READ (image, pixel + 1) << 8) |
1320 (READ (image, pixel + 0)));
1325 fetch_pixel_b8g8r8 (bits_image_t *image,
1329 uint32_t *bits = image->bits + line * image->rowstride;
1330 uint8_t *pixel = ((uint8_t *) bits) + (offset * 3);
1331 #ifdef WORDS_BIGENDIAN
1332 return (0xff000000 |
1333 (READ (image, pixel + 2) << 16) |
1334 (READ (image, pixel + 1) << 8) |
1335 (READ (image, pixel + 0)));
1337 return (0xff000000 |
1338 (READ (image, pixel + 0) << 16) |
1339 (READ (image, pixel + 1) << 8) |
1340 (READ (image, pixel + 2)));
1345 fetch_pixel_r5g6b5 (bits_image_t *image,
1349 uint32_t *bits = image->bits + line * image->rowstride;
1350 uint32_t pixel = READ (image, (uint16_t *) bits + offset);
1353 r = ((pixel & 0xf800) | ((pixel & 0xe000) >> 5)) << 8;
1354 g = ((pixel & 0x07e0) | ((pixel & 0x0600) >> 6)) << 5;
1355 b = ((pixel & 0x001c) | ((pixel & 0x001f) << 5)) >> 2;
1357 return (0xff000000 | r | g | b);
1361 fetch_pixel_b5g6r5 (bits_image_t *image,
1366 uint32_t *bits = image->bits + line * image->rowstride;
1367 uint32_t pixel = READ (image, (uint16_t *) bits + offset);
1369 b = ((pixel & 0xf800) | ((pixel & 0xe000) >> 5)) >> 8;
1370 g = ((pixel & 0x07e0) | ((pixel & 0x0600) >> 6)) << 5;
1371 r = ((pixel & 0x001c) | ((pixel & 0x001f) << 5)) << 14;
1373 return (0xff000000 | r | g | b);
1377 fetch_pixel_a1r5g5b5 (bits_image_t *image,
1381 uint32_t *bits = image->bits + line * image->rowstride;
1382 uint32_t pixel = READ (image, (uint16_t *) bits + offset);
1383 uint32_t a, r, g, b;
1385 a = (uint32_t) ((uint8_t) (0 - ((pixel & 0x8000) >> 15))) << 24;
1386 r = ((pixel & 0x7c00) | ((pixel & 0x7000) >> 5)) << 9;
1387 g = ((pixel & 0x03e0) | ((pixel & 0x0380) >> 5)) << 6;
1388 b = ((pixel & 0x001c) | ((pixel & 0x001f) << 5)) >> 2;
1390 return (a | r | g | b);
1394 fetch_pixel_x1r5g5b5 (bits_image_t *image,
1398 uint32_t *bits = image->bits + line * image->rowstride;
1399 uint32_t pixel = READ (image, (uint16_t *) bits + offset);
1402 r = ((pixel & 0x7c00) | ((pixel & 0x7000) >> 5)) << 9;
1403 g = ((pixel & 0x03e0) | ((pixel & 0x0380) >> 5)) << 6;
1404 b = ((pixel & 0x001c) | ((pixel & 0x001f) << 5)) >> 2;
1406 return (0xff000000 | r | g | b);
1410 fetch_pixel_a1b5g5r5 (bits_image_t *image,
1414 uint32_t *bits = image->bits + line * image->rowstride;
1415 uint32_t pixel = READ (image, (uint16_t *) bits + offset);
1416 uint32_t a, r, g, b;
1418 a = (uint32_t) ((uint8_t) (0 - ((pixel & 0x8000) >> 15))) << 24;
1419 b = ((pixel & 0x7c00) | ((pixel & 0x7000) >> 5)) >> 7;
1420 g = ((pixel & 0x03e0) | ((pixel & 0x0380) >> 5)) << 6;
1421 r = ((pixel & 0x001c) | ((pixel & 0x001f) << 5)) << 14;
1423 return (a | r | g | b);
1427 fetch_pixel_x1b5g5r5 (bits_image_t *image,
1431 uint32_t *bits = image->bits + line * image->rowstride;
1432 uint32_t pixel = READ (image, (uint16_t *) bits + offset);
1435 b = ((pixel & 0x7c00) | ((pixel & 0x7000) >> 5)) >> 7;
1436 g = ((pixel & 0x03e0) | ((pixel & 0x0380) >> 5)) << 6;
1437 r = ((pixel & 0x001c) | ((pixel & 0x001f) << 5)) << 14;
1439 return (0xff000000 | r | g | b);
1443 fetch_pixel_a4r4g4b4 (bits_image_t *image,
1447 uint32_t *bits = image->bits + line * image->rowstride;
1448 uint32_t pixel = READ (image, (uint16_t *) bits + offset);
1449 uint32_t a, r, g, b;
1451 a = ((pixel & 0xf000) | ((pixel & 0xf000) >> 4)) << 16;
1452 r = ((pixel & 0x0f00) | ((pixel & 0x0f00) >> 4)) << 12;
1453 g = ((pixel & 0x00f0) | ((pixel & 0x00f0) >> 4)) << 8;
1454 b = ((pixel & 0x000f) | ((pixel & 0x000f) << 4));
1456 return (a | r | g | b);
1460 fetch_pixel_x4r4g4b4 (bits_image_t *image,
1464 uint32_t *bits = image->bits + line * image->rowstride;
1465 uint32_t pixel = READ (image, (uint16_t *) bits + offset);
1468 r = ((pixel & 0x0f00) | ((pixel & 0x0f00) >> 4)) << 12;
1469 g = ((pixel & 0x00f0) | ((pixel & 0x00f0) >> 4)) << 8;
1470 b = ((pixel & 0x000f) | ((pixel & 0x000f) << 4));
1472 return (0xff000000 | r | g | b);
1476 fetch_pixel_a4b4g4r4 (bits_image_t *image,
1480 uint32_t *bits = image->bits + line * image->rowstride;
1481 uint32_t pixel = READ (image, (uint16_t *) bits + offset);
1482 uint32_t a, r, g, b;
1484 a = ((pixel & 0xf000) | ((pixel & 0xf000) >> 4)) << 16;
1485 b = ((pixel & 0x0f00) | ((pixel & 0x0f00) >> 4)) >> 4;
1486 g = ((pixel & 0x00f0) | ((pixel & 0x00f0) >> 4)) << 8;
1487 r = ((pixel & 0x000f) | ((pixel & 0x000f) << 4)) << 16;
1489 return (a | r | g | b);
1493 fetch_pixel_x4b4g4r4 (bits_image_t *image,
1497 uint32_t *bits = image->bits + line * image->rowstride;
1498 uint32_t pixel = READ (image, (uint16_t *) bits + offset);
1501 b = ((pixel & 0x0f00) | ((pixel & 0x0f00) >> 4)) >> 4;
1502 g = ((pixel & 0x00f0) | ((pixel & 0x00f0) >> 4)) << 8;
1503 r = ((pixel & 0x000f) | ((pixel & 0x000f) << 4)) << 16;
1505 return (0xff000000 | r | g | b);
1509 fetch_pixel_a8 (bits_image_t *image,
1513 uint32_t *bits = image->bits + line * image->rowstride;
1514 uint32_t pixel = READ (image, (uint8_t *) bits + offset);
1520 fetch_pixel_r3g3b2 (bits_image_t *image,
1524 uint32_t *bits = image->bits + line * image->rowstride;
1525 uint32_t pixel = READ (image, (uint8_t *) bits + offset);
1528 r = ((pixel & 0xe0) |
1529 ((pixel & 0xe0) >> 3) |
1530 ((pixel & 0xc0) >> 6)) << 16;
1532 g = ((pixel & 0x1c) |
1533 ((pixel & 0x18) >> 3) |
1534 ((pixel & 0x1c) << 3)) << 8;
1536 b = (((pixel & 0x03) ) |
1537 ((pixel & 0x03) << 2) |
1538 ((pixel & 0x03) << 4) |
1539 ((pixel & 0x03) << 6));
1541 return (0xff000000 | r | g | b);
1545 fetch_pixel_b2g3r3 (bits_image_t *image,
1549 uint32_t *bits = image->bits + line * image->rowstride;
1550 uint32_t p = READ (image, (uint8_t *) bits + offset);
1558 g = (p & 0x38) << 10;
1563 r = (p & 0x7) << 21;
1568 return 0xff000000 | r | g | b;
1572 fetch_pixel_a2r2g2b2 (bits_image_t *image,
1576 uint32_t *bits = image->bits + line * image->rowstride;
1577 uint32_t pixel = READ (image, (uint8_t *) bits + offset);
1578 uint32_t a, r, g, b;
1580 a = ((pixel & 0xc0) * 0x55) << 18;
1581 r = ((pixel & 0x30) * 0x55) << 12;
1582 g = ((pixel & 0x0c) * 0x55) << 6;
1583 b = ((pixel & 0x03) * 0x55);
1585 return a | r | g | b;
1589 fetch_pixel_a2b2g2r2 (bits_image_t *image,
1593 uint32_t *bits = image->bits + line * image->rowstride;
1594 uint32_t pixel = READ (image, (uint8_t *) bits + offset);
1595 uint32_t a, r, g, b;
1597 a = ((pixel & 0xc0) * 0x55) << 18;
1598 b = ((pixel & 0x30) * 0x55) >> 4;
1599 g = ((pixel & 0x0c) * 0x55) << 6;
1600 r = ((pixel & 0x03) * 0x55) << 16;
1602 return a | r | g | b;
1606 fetch_pixel_c8 (bits_image_t *image,
1610 uint32_t *bits = image->bits + line * image->rowstride;
1611 uint32_t pixel = READ (image, (uint8_t *) bits + offset);
1612 const pixman_indexed_t * indexed = image->indexed;
1614 return indexed->rgba[pixel];
1618 fetch_pixel_x4a4 (bits_image_t *image,
1622 uint32_t *bits = image->bits + line * image->rowstride;
1623 uint32_t pixel = READ (image, (uint8_t *) bits + offset);
1625 return ((pixel & 0xf) | ((pixel & 0xf) << 4)) << 24;
1629 fetch_pixel_a4 (bits_image_t *image,
1633 uint32_t *bits = image->bits + line * image->rowstride;
1634 uint32_t pixel = FETCH_4 (image, bits, offset);
1636 pixel |= pixel << 4;
1641 fetch_pixel_r1g2b1 (bits_image_t *image,
1645 uint32_t *bits = image->bits + line * image->rowstride;
1646 uint32_t pixel = FETCH_4 (image, bits, offset);
1649 r = ((pixel & 0x8) * 0xff) << 13;
1650 g = ((pixel & 0x6) * 0x55) << 7;
1651 b = ((pixel & 0x1) * 0xff);
1653 return 0xff000000 | r | g | b;
1657 fetch_pixel_b1g2r1 (bits_image_t *image,
1661 uint32_t *bits = image->bits + line * image->rowstride;
1662 uint32_t pixel = FETCH_4 (image, bits, offset);
1665 b = ((pixel & 0x8) * 0xff) >> 3;
1666 g = ((pixel & 0x6) * 0x55) << 7;
1667 r = ((pixel & 0x1) * 0xff) << 16;
1669 return 0xff000000 | r | g | b;
1673 fetch_pixel_a1r1g1b1 (bits_image_t *image,
1677 uint32_t *bits = image->bits + line * image->rowstride;
1678 uint32_t pixel = FETCH_4 (image, bits, offset);
1679 uint32_t a, r, g, b;
1681 a = ((pixel & 0x8) * 0xff) << 21;
1682 r = ((pixel & 0x4) * 0xff) << 14;
1683 g = ((pixel & 0x2) * 0xff) << 7;
1684 b = ((pixel & 0x1) * 0xff);
1686 return a | r | g | b;
1690 fetch_pixel_a1b1g1r1 (bits_image_t *image,
1694 uint32_t *bits = image->bits + line * image->rowstride;
1695 uint32_t pixel = FETCH_4 (image, bits, offset);
1696 uint32_t a, r, g, b;
1698 a = ((pixel & 0x8) * 0xff) << 21;
1699 b = ((pixel & 0x4) * 0xff) >> 2;
1700 g = ((pixel & 0x2) * 0xff) << 7;
1701 r = ((pixel & 0x1) * 0xff) << 16;
1703 return a | r | g | b;
1707 fetch_pixel_c4 (bits_image_t *image,
1711 uint32_t *bits = image->bits + line * image->rowstride;
1712 uint32_t pixel = FETCH_4 (image, bits, offset);
1713 const pixman_indexed_t * indexed = image->indexed;
1715 return indexed->rgba[pixel];
1719 fetch_pixel_a1 (bits_image_t *image,
1723 uint32_t *bits = image->bits + line * image->rowstride;
1724 uint32_t pixel = READ (image, bits + (offset >> 5));
1727 #ifdef WORDS_BIGENDIAN
1728 a = pixel >> (0x1f - (offset & 0x1f));
1730 a = pixel >> (offset & 0x1f);
1741 fetch_pixel_g1 (bits_image_t *image,
1745 uint32_t *bits = image->bits + line * image->rowstride;
1746 uint32_t pixel = READ (image, bits + (offset >> 5));
1747 const pixman_indexed_t * indexed = image->indexed;
1750 #ifdef WORDS_BIGENDIAN
1751 a = pixel >> (0x1f - (offset & 0x1f));
1753 a = pixel >> (offset & 0x1f);
1757 return indexed->rgba[a];
1761 fetch_pixel_yuy2 (bits_image_t *image,
1765 const uint32_t *bits = image->bits + image->rowstride * line;
1770 y = ((uint8_t *) bits)[offset << 1] - 16;
1771 u = ((uint8_t *) bits)[((offset << 1) & - 4) + 1] - 128;
1772 v = ((uint8_t *) bits)[((offset << 1) & - 4) + 3] - 128;
1774 /* R = 1.164(Y - 16) + 1.596(V - 128) */
1775 r = 0x012b27 * y + 0x019a2e * v;
1777 /* G = 1.164(Y - 16) - 0.813(V - 128) - 0.391(U - 128) */
1778 g = 0x012b27 * y - 0x00d0f2 * v - 0x00647e * u;
1780 /* B = 1.164(Y - 16) + 2.018(U - 128) */
1781 b = 0x012b27 * y + 0x0206a2 * u;
1784 (r >= 0 ? r < 0x1000000 ? r & 0xff0000 : 0xff0000 : 0) |
1785 (g >= 0 ? g < 0x1000000 ? (g >> 8) & 0x00ff00 : 0x00ff00 : 0) |
1786 (b >= 0 ? b < 0x1000000 ? (b >> 16) & 0x0000ff : 0x0000ff : 0);
1790 fetch_pixel_yv12 (bits_image_t *image,
1795 int16_t y = YV12_Y (line)[offset] - 16;
1796 int16_t u = YV12_U (line)[offset >> 1] - 128;
1797 int16_t v = YV12_V (line)[offset >> 1] - 128;
1800 /* R = 1.164(Y - 16) + 1.596(V - 128) */
1801 r = 0x012b27 * y + 0x019a2e * v;
1803 /* G = 1.164(Y - 16) - 0.813(V - 128) - 0.391(U - 128) */
1804 g = 0x012b27 * y - 0x00d0f2 * v - 0x00647e * u;
1806 /* B = 1.164(Y - 16) + 2.018(U - 128) */
1807 b = 0x012b27 * y + 0x0206a2 * u;
1810 (r >= 0 ? r < 0x1000000 ? r & 0xff0000 : 0xff0000 : 0) |
1811 (g >= 0 ? g < 0x1000000 ? (g >> 8) & 0x00ff00 : 0x00ff00 : 0) |
1812 (b >= 0 ? b < 0x1000000 ? (b >> 16) & 0x0000ff : 0x0000ff : 0);
1815 /*********************************** Store ************************************/
1817 #define SPLIT_A(v) \
1818 uint32_t a = ((v) >> 24), \
1819 r = ((v) >> 16) & 0xff, \
1820 g = ((v) >> 8) & 0xff, \
1824 uint32_t r = ((v) >> 16) & 0xff, \
1825 g = ((v) >> 8) & 0xff, \
1829 store_scanline_a2r10g10b10 (bits_image_t * image,
1835 uint32_t *bits = image->bits + image->rowstride * y;
1836 uint32_t *pixel = bits + x;
1837 uint64_t *values = (uint64_t *)v;
1840 for (i = 0; i < width; ++i)
1842 WRITE (image, pixel++,
1843 ((values[i] >> 32) & 0xc0000000) |
1844 ((values[i] >> 18) & 0x3ff00000) |
1845 ((values[i] >> 12) & 0xffc00) |
1846 ((values[i] >> 6) & 0x3ff));
1851 store_scanline_x2r10g10b10 (bits_image_t * image,
1857 uint32_t *bits = image->bits + image->rowstride * y;
1858 uint64_t *values = (uint64_t *)v;
1859 uint32_t *pixel = bits + x;
1862 for (i = 0; i < width; ++i)
1864 WRITE (image, pixel++,
1865 ((values[i] >> 18) & 0x3ff00000) |
1866 ((values[i] >> 12) & 0xffc00) |
1867 ((values[i] >> 6) & 0x3ff));
1872 store_scanline_a2b10g10r10 (bits_image_t * image,
1878 uint32_t *bits = image->bits + image->rowstride * y;
1879 uint32_t *pixel = bits + x;
1880 uint64_t *values = (uint64_t *)v;
1883 for (i = 0; i < width; ++i)
1885 WRITE (image, pixel++,
1886 ((values[i] >> 32) & 0xc0000000) |
1887 ((values[i] >> 38) & 0x3ff) |
1888 ((values[i] >> 12) & 0xffc00) |
1889 ((values[i] << 14) & 0x3ff00000));
1894 store_scanline_x2b10g10r10 (bits_image_t * image,
1900 uint32_t *bits = image->bits + image->rowstride * y;
1901 uint64_t *values = (uint64_t *)v;
1902 uint32_t *pixel = bits + x;
1905 for (i = 0; i < width; ++i)
1907 WRITE (image, pixel++,
1908 ((values[i] >> 38) & 0x3ff) |
1909 ((values[i] >> 12) & 0xffc00) |
1910 ((values[i] << 14) & 0x3ff00000));
1915 store_scanline_r8g8b8 (bits_image_t * image,
1919 const uint32_t *values)
1921 uint32_t *bits = image->bits + image->rowstride * y;
1922 uint8_t *pixel = ((uint8_t *) bits) + 3 * x;
1925 for (i = 0; i < width; ++i)
1927 uint32_t val = values[i];
1929 #ifdef WORDS_BIGENDIAN
1930 WRITE (image, pixel++, (val & 0x00ff0000) >> 16);
1931 WRITE (image, pixel++, (val & 0x0000ff00) >> 8);
1932 WRITE (image, pixel++, (val & 0x000000ff) >> 0);
1934 WRITE (image, pixel++, (val & 0x000000ff) >> 0);
1935 WRITE (image, pixel++, (val & 0x0000ff00) >> 8);
1936 WRITE (image, pixel++, (val & 0x00ff0000) >> 16);
1942 store_scanline_b8g8r8 (bits_image_t * image,
1946 const uint32_t *values)
1948 uint32_t *bits = image->bits + image->rowstride * y;
1949 uint8_t *pixel = ((uint8_t *) bits) + 3 * x;
1952 for (i = 0; i < width; ++i)
1954 uint32_t val = values[i];
1956 #ifdef WORDS_BIGENDIAN
1957 WRITE (image, pixel++, (val & 0x000000ff) >> 0);
1958 WRITE (image, pixel++, (val & 0x0000ff00) >> 8);
1959 WRITE (image, pixel++, (val & 0x00ff0000) >> 16);
1961 WRITE (image, pixel++, (val & 0x00ff0000) >> 16);
1962 WRITE (image, pixel++, (val & 0x0000ff00) >> 8);
1963 WRITE (image, pixel++, (val & 0x000000ff) >> 0);
1969 store_scanline_r5g6b5 (bits_image_t * image,
1973 const uint32_t *values)
1975 uint32_t *bits = image->bits + image->rowstride * y;
1976 uint16_t *pixel = ((uint16_t *) bits) + x;
1979 for (i = 0; i < width; ++i)
1981 uint32_t s = values[i];
1983 WRITE (image, pixel++,
1984 ((s >> 3) & 0x001f) |
1985 ((s >> 5) & 0x07e0) |
1986 ((s >> 8) & 0xf800));
1991 store_scanline_b5g6r5 (bits_image_t * image,
1995 const uint32_t *values)
1997 uint32_t *bits = image->bits + image->rowstride * y;
1998 uint16_t *pixel = ((uint16_t *) bits) + x;
2001 for (i = 0; i < width; ++i)
2005 WRITE (image, pixel++,
2006 ((b << 8) & 0xf800) |
2007 ((g << 3) & 0x07e0) |
2013 store_scanline_a1r5g5b5 (bits_image_t * image,
2017 const uint32_t *values)
2019 uint32_t *bits = image->bits + image->rowstride * y;
2020 uint16_t *pixel = ((uint16_t *) bits) + x;
2023 for (i = 0; i < width; ++i)
2025 SPLIT_A (values[i]);
2027 WRITE (image, pixel++,
2028 ((a << 8) & 0x8000) |
2029 ((r << 7) & 0x7c00) |
2030 ((g << 2) & 0x03e0) |
2036 store_scanline_x1r5g5b5 (bits_image_t * image,
2040 const uint32_t *values)
2042 uint32_t *bits = image->bits + image->rowstride * y;
2043 uint16_t *pixel = ((uint16_t *) bits) + x;
2046 for (i = 0; i < width; ++i)
2050 WRITE (image, pixel++,
2051 ((r << 7) & 0x7c00) |
2052 ((g << 2) & 0x03e0) |
2058 store_scanline_a1b5g5r5 (bits_image_t * image,
2062 const uint32_t *values)
2064 uint32_t *bits = image->bits + image->rowstride * y;
2065 uint16_t *pixel = ((uint16_t *) bits) + x;
2068 for (i = 0; i < width; ++i)
2070 SPLIT_A (values[i]);
2072 WRITE (image, pixel++,
2073 ((a << 8) & 0x8000) |
2074 ((b << 7) & 0x7c00) |
2075 ((g << 2) & 0x03e0) |
2081 store_scanline_x1b5g5r5 (bits_image_t * image,
2085 const uint32_t *values)
2087 uint32_t *bits = image->bits + image->rowstride * y;
2088 uint16_t *pixel = ((uint16_t *) bits) + x;
2091 for (i = 0; i < width; ++i)
2095 WRITE (image, pixel++, ((b << 7) & 0x7c00) |
2096 ((g << 2) & 0x03e0) |
2102 store_scanline_a4r4g4b4 (bits_image_t * image,
2106 const uint32_t *values)
2108 uint32_t *bits = image->bits + image->rowstride * y;
2109 uint16_t *pixel = ((uint16_t *) bits) + x;
2112 for (i = 0; i < width; ++i)
2114 SPLIT_A (values[i]);
2116 WRITE (image, pixel++,
2117 ((a << 8) & 0xf000) |
2118 ((r << 4) & 0x0f00) |
2125 store_scanline_x4r4g4b4 (bits_image_t * image,
2129 const uint32_t *values)
2131 uint32_t *bits = image->bits + image->rowstride * y;
2132 uint16_t *pixel = ((uint16_t *) bits) + x;
2135 for (i = 0; i < width; ++i)
2139 WRITE (image, pixel++,
2140 ((r << 4) & 0x0f00) |
2147 store_scanline_a4b4g4r4 (bits_image_t * image,
2151 const uint32_t *values)
2153 uint32_t *bits = image->bits + image->rowstride * y;
2154 uint16_t *pixel = ((uint16_t *) bits) + x;
2157 for (i = 0; i < width; ++i)
2159 SPLIT_A (values[i]);
2160 WRITE (image, pixel++, ((a << 8) & 0xf000) |
2161 ((b << 4) & 0x0f00) |
2168 store_scanline_x4b4g4r4 (bits_image_t * image,
2172 const uint32_t *values)
2174 uint32_t *bits = image->bits + image->rowstride * y;
2175 uint16_t *pixel = ((uint16_t *) bits) + x;
2178 for (i = 0; i < width; ++i)
2182 WRITE (image, pixel++,
2183 ((b << 4) & 0x0f00) |
2190 store_scanline_a8 (bits_image_t * image,
2194 const uint32_t *values)
2196 uint32_t *bits = image->bits + image->rowstride * y;
2197 uint8_t *pixel = ((uint8_t *) bits) + x;
2200 for (i = 0; i < width; ++i)
2202 WRITE (image, pixel++, values[i] >> 24);
2207 store_scanline_r3g3b2 (bits_image_t * image,
2211 const uint32_t *values)
2213 uint32_t *bits = image->bits + image->rowstride * y;
2214 uint8_t *pixel = ((uint8_t *) bits) + x;
2217 for (i = 0; i < width; ++i)
2221 WRITE (image, pixel++,
2229 store_scanline_b2g3r3 (bits_image_t * image,
2233 const uint32_t *values)
2235 uint32_t *bits = image->bits + image->rowstride * y;
2236 uint8_t *pixel = ((uint8_t *) bits) + x;
2239 for (i = 0; i < width; ++i)
2243 WRITE (image, pixel++,
2251 store_scanline_a2r2g2b2 (bits_image_t * image,
2255 const uint32_t *values)
2257 uint32_t *bits = image->bits + image->rowstride * y;
2258 uint8_t *pixel = ((uint8_t *) bits) + x;
2261 for (i = 0; i < width; ++i)
2263 SPLIT_A (values[i]);
2265 WRITE (image, pixel++,
2274 store_scanline_a2b2g2r2 (bits_image_t * image,
2278 const uint32_t *values)
2280 uint32_t *bits = image->bits + image->rowstride * y;
2281 uint8_t *pixel = ((uint8_t *) bits) + x;
2284 for (i = 0; i < width; ++i)
2286 SPLIT_A (values[i]);
2288 WRITE (image, pixel++,
2297 store_scanline_c8 (bits_image_t * image,
2301 const uint32_t *values)
2303 uint32_t *bits = image->bits + image->rowstride * y;
2304 uint8_t *pixel = ((uint8_t *) bits) + x;
2305 const pixman_indexed_t *indexed = image->indexed;
2308 for (i = 0; i < width; ++i)
2309 WRITE (image, pixel++, RGB24_TO_ENTRY (indexed,values[i]));
2313 store_scanline_g8 (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;
2321 const pixman_indexed_t *indexed = image->indexed;
2324 for (i = 0; i < width; ++i)
2325 WRITE (image, pixel++, RGB24_TO_ENTRY_Y (indexed,values[i]));
2329 store_scanline_x4a4 (bits_image_t * image,
2333 const uint32_t *values)
2335 uint32_t *bits = image->bits + image->rowstride * y;
2336 uint8_t *pixel = ((uint8_t *) bits) + x;
2339 for (i = 0; i < width; ++i)
2340 WRITE (image, pixel++, values[i] >> 28);
2343 #define STORE_8(img,l,o,v) (WRITE (img, (uint8_t *)(l) + ((o) >> 3), (v)))
2344 #ifdef WORDS_BIGENDIAN
2346 #define STORE_4(img,l,o,v) \
2350 int v4 = (v) & 0x0f; \
2352 STORE_8 (img, l, bo, ( \
2354 (FETCH_8 (img, l, bo) & 0xf0) | (v4) : \
2355 (FETCH_8 (img, l, bo) & 0x0f) | (v4 << 4))); \
2359 #define STORE_4(img,l,o,v) \
2363 int v4 = (v) & 0x0f; \
2365 STORE_8 (img, l, bo, ( \
2367 (FETCH_8 (img, l, bo) & 0x0f) | (v4 << 4) : \
2368 (FETCH_8 (img, l, bo) & 0xf0) | (v4))); \
2373 store_scanline_a4 (bits_image_t * image,
2377 const uint32_t *values)
2379 uint32_t *bits = image->bits + image->rowstride * y;
2382 for (i = 0; i < width; ++i)
2383 STORE_4 (image, bits, i + x, values[i] >> 28);
2387 store_scanline_r1g2b1 (bits_image_t * image,
2391 const uint32_t *values)
2393 uint32_t *bits = image->bits + image->rowstride * y;
2396 for (i = 0; i < width; ++i)
2401 pixel = (((r >> 4) & 0x8) |
2404 STORE_4 (image, bits, i + x, pixel);
2409 store_scanline_b1g2r1 (bits_image_t * image,
2413 const uint32_t *values)
2415 uint32_t *bits = image->bits + image->rowstride * y;
2418 for (i = 0; i < width; ++i)
2423 pixel = (((b >> 4) & 0x8) |
2426 STORE_4 (image, bits, i + x, pixel);
2431 store_scanline_a1r1g1b1 (bits_image_t * image,
2435 const uint32_t *values)
2437 uint32_t *bits = image->bits + image->rowstride * y;
2440 for (i = 0; i < width; ++i)
2444 SPLIT_A (values[i]);
2445 pixel = (((a >> 4) & 0x8) |
2450 STORE_4 (image, bits, i + x, pixel);
2455 store_scanline_a1b1g1r1 (bits_image_t * image,
2459 const uint32_t *values)
2461 uint32_t *bits = image->bits + image->rowstride * y;
2464 for (i = 0; i < width; ++i)
2468 SPLIT_A (values[i]);
2469 pixel = (((a >> 4) & 0x8) |
2474 STORE_4 (image, bits, i + x, pixel);
2479 store_scanline_c4 (bits_image_t * image,
2483 const uint32_t *values)
2485 uint32_t *bits = image->bits + image->rowstride * y;
2486 const pixman_indexed_t *indexed = image->indexed;
2489 for (i = 0; i < width; ++i)
2493 pixel = RGB24_TO_ENTRY (indexed, values[i]);
2494 STORE_4 (image, bits, i + x, pixel);
2499 store_scanline_g4 (bits_image_t * image,
2503 const uint32_t *values)
2505 uint32_t *bits = image->bits + image->rowstride * y;
2506 const pixman_indexed_t *indexed = image->indexed;
2509 for (i = 0; i < width; ++i)
2513 pixel = RGB24_TO_ENTRY_Y (indexed, values[i]);
2514 STORE_4 (image, bits, i + x, pixel);
2519 store_scanline_a1 (bits_image_t * image,
2523 const uint32_t *values)
2525 uint32_t *bits = image->bits + image->rowstride * y;
2528 for (i = 0; i < width; ++i)
2530 uint32_t *pixel = ((uint32_t *) bits) + ((i + x) >> 5);
2533 #ifdef WORDS_BIGENDIAN
2534 mask = 1 << (0x1f - ((i + x) & 0x1f));
2536 mask = 1 << ((i + x) & 0x1f);
2538 v = values[i] & 0x80000000 ? mask : 0;
2540 WRITE (image, pixel, (READ (image, pixel) & ~mask) | v);
2545 store_scanline_g1 (bits_image_t * image,
2549 const uint32_t *values)
2551 uint32_t *bits = image->bits + image->rowstride * y;
2552 const pixman_indexed_t *indexed = image->indexed;
2555 for (i = 0; i < width; ++i)
2557 uint32_t *pixel = ((uint32_t *) bits) + ((i + x) >> 5);
2560 #ifdef WORDS_BIGENDIAN
2561 mask = 1 << (0x1f - ((i + x) & 0x1f));
2563 mask = 1 << ((i + x) & 0x1f);
2565 v = RGB24_TO_ENTRY_Y (indexed, values[i]) & 0x1 ? mask : 0;
2567 WRITE (image, pixel, (READ (image, pixel) & ~mask) | v);
2572 * Contracts a 64bpp image to 32bpp and then stores it using a regular 32-bit
2573 * store proc. Despite the type, this function expects a uint64_t buffer.
2576 store_scanline_generic_64 (bits_image_t * image,
2580 const uint32_t *values)
2582 uint32_t *argb8_pixels;
2584 assert (image->common.type == BITS);
2586 argb8_pixels = pixman_malloc_ab (width, sizeof(uint32_t));
2590 /* Contract the scanline. We could do this in place if values weren't
2593 pixman_contract (argb8_pixels, (uint64_t *)values, width);
2595 image->store_scanline_32 (image, x, y, width, argb8_pixels);
2597 free (argb8_pixels);
2600 /* Despite the type, this function expects both buffer
2601 * and mask to be uint64_t
2604 fetch_scanline_generic_64 (pixman_image_t *image,
2609 const uint32_t *mask)
2611 pixman_format_code_t format;
2613 /* Fetch the pixels into the first half of buffer and then expand them in
2616 image->bits.fetch_scanline_32 (image, x, y, width, buffer, NULL);
2618 format = image->bits.format;
2619 if (PIXMAN_FORMAT_TYPE (format) == PIXMAN_TYPE_COLOR ||
2620 PIXMAN_FORMAT_TYPE (format) == PIXMAN_TYPE_GRAY)
2622 /* Indexed formats are mapped to a8r8g8b8 with full
2623 * precision, so when expanding we shouldn't correct
2624 * for the width of the channels
2627 format = PIXMAN_a8r8g8b8;
2630 pixman_expand ((uint64_t *)buffer, buffer, format, width);
2633 /* Despite the type, this function expects a uint64_t *buffer */
2635 fetch_pixel_generic_64 (bits_image_t *image,
2639 uint32_t pixel32 = image->fetch_pixel_32 (image, offset, line);
2641 pixman_format_code_t format;
2643 format = image->format;
2644 if (PIXMAN_FORMAT_TYPE (format) == PIXMAN_TYPE_COLOR ||
2645 PIXMAN_FORMAT_TYPE (format) == PIXMAN_TYPE_GRAY)
2647 /* Indexed formats are mapped to a8r8g8b8 with full
2648 * precision, so when expanding we shouldn't correct
2649 * for the width of the channels
2652 format = PIXMAN_a8r8g8b8;
2655 pixman_expand ((uint64_t *)&result, &pixel32, format, 1);
2661 * XXX: The transformed fetch path only works at 32-bpp so far. When all
2662 * paths have wide versions, this can be removed.
2664 * WARNING: This function loses precision!
2667 fetch_pixel_generic_lossy_32 (bits_image_t *image,
2671 uint64_t pixel64 = image->fetch_pixel_64 (image, offset, line);
2674 pixman_contract (&result, &pixel64, 1);
2681 pixman_format_code_t format;
2682 fetch_scanline_t fetch_scanline_32;
2683 fetch_scanline_t fetch_scanline_64;
2684 fetch_pixel_32_t fetch_pixel_32;
2685 fetch_pixel_64_t fetch_pixel_64;
2686 store_scanline_t store_scanline_32;
2687 store_scanline_t store_scanline_64;
2690 #define FORMAT_INFO(format) \
2692 PIXMAN_ ## format, \
2693 fetch_scanline_ ## format, \
2694 fetch_scanline_generic_64, \
2695 fetch_pixel_ ## format, fetch_pixel_generic_64, \
2696 store_scanline_ ## format, store_scanline_generic_64 \
2699 static const format_info_t accessors[] =
2701 /* 32 bpp formats */
2702 FORMAT_INFO (a8r8g8b8),
2703 FORMAT_INFO (x8r8g8b8),
2704 FORMAT_INFO (a8b8g8r8),
2705 FORMAT_INFO (x8b8g8r8),
2706 FORMAT_INFO (b8g8r8a8),
2707 FORMAT_INFO (b8g8r8x8),
2708 FORMAT_INFO (r8g8b8a8),
2709 FORMAT_INFO (r8g8b8x8),
2710 FORMAT_INFO (x14r6g6b6),
2713 FORMAT_INFO (r8g8b8),
2714 FORMAT_INFO (b8g8r8),
2717 FORMAT_INFO (r5g6b5),
2718 FORMAT_INFO (b5g6r5),
2720 FORMAT_INFO (a1r5g5b5),
2721 FORMAT_INFO (x1r5g5b5),
2722 FORMAT_INFO (a1b5g5r5),
2723 FORMAT_INFO (x1b5g5r5),
2724 FORMAT_INFO (a4r4g4b4),
2725 FORMAT_INFO (x4r4g4b4),
2726 FORMAT_INFO (a4b4g4r4),
2727 FORMAT_INFO (x4b4g4r4),
2731 FORMAT_INFO (r3g3b2),
2732 FORMAT_INFO (b2g3r3),
2733 FORMAT_INFO (a2r2g2b2),
2734 FORMAT_INFO (a2b2g2r2),
2738 #define fetch_scanline_g8 fetch_scanline_c8
2739 #define fetch_pixel_g8 fetch_pixel_c8
2742 #define fetch_scanline_x4c4 fetch_scanline_c8
2743 #define fetch_pixel_x4c4 fetch_pixel_c8
2744 #define store_scanline_x4c4 store_scanline_c8
2747 #define fetch_scanline_x4g4 fetch_scanline_c8
2748 #define fetch_pixel_x4g4 fetch_pixel_c8
2749 #define store_scanline_x4g4 store_scanline_g8
2756 FORMAT_INFO (r1g2b1),
2757 FORMAT_INFO (b1g2r1),
2758 FORMAT_INFO (a1r1g1b1),
2759 FORMAT_INFO (a1b1g1r1),
2763 #define fetch_scanline_g4 fetch_scanline_c4
2764 #define fetch_pixel_g4 fetch_pixel_c4
2773 { PIXMAN_a2r10g10b10,
2774 NULL, fetch_scanline_a2r10g10b10,
2775 fetch_pixel_generic_lossy_32, fetch_pixel_a2r10g10b10,
2776 NULL, store_scanline_a2r10g10b10 },
2778 { PIXMAN_x2r10g10b10,
2779 NULL, fetch_scanline_x2r10g10b10,
2780 fetch_pixel_generic_lossy_32, fetch_pixel_x2r10g10b10,
2781 NULL, store_scanline_x2r10g10b10 },
2783 { PIXMAN_a2b10g10r10,
2784 NULL, fetch_scanline_a2b10g10r10,
2785 fetch_pixel_generic_lossy_32, fetch_pixel_a2b10g10r10,
2786 NULL, store_scanline_a2b10g10r10 },
2788 { PIXMAN_x2b10g10r10,
2789 NULL, fetch_scanline_x2b10g10r10,
2790 fetch_pixel_generic_lossy_32, fetch_pixel_x2b10g10r10,
2791 NULL, store_scanline_x2b10g10r10 },
2795 fetch_scanline_yuy2, fetch_scanline_generic_64,
2796 fetch_pixel_yuy2, fetch_pixel_generic_64,
2800 fetch_scanline_yv12, fetch_scanline_generic_64,
2801 fetch_pixel_yv12, fetch_pixel_generic_64,
2808 setup_accessors (bits_image_t *image)
2810 const format_info_t *info = accessors;
2812 while (info->format != PIXMAN_null)
2814 if (info->format == image->format)
2816 image->fetch_scanline_32 = info->fetch_scanline_32;
2817 image->fetch_scanline_64 = info->fetch_scanline_64;
2818 image->fetch_pixel_32 = info->fetch_pixel_32;
2819 image->fetch_pixel_64 = info->fetch_pixel_64;
2820 image->store_scanline_32 = info->store_scanline_32;
2821 image->store_scanline_64 = info->store_scanline_64;
2830 #ifndef PIXMAN_FB_ACCESSORS
2832 _pixman_bits_image_setup_accessors_accessors (bits_image_t *image);
2835 _pixman_bits_image_setup_accessors (bits_image_t *image)
2837 if (image->read_func || image->write_func)
2838 _pixman_bits_image_setup_accessors_accessors (image);
2840 setup_accessors (image);
2846 _pixman_bits_image_setup_accessors_accessors (bits_image_t *image)
2848 setup_accessors (image);