… | |
… | |
620 | else if (depth == 15 || depth == 16) |
620 | else if (depth == 15 || depth == 16) |
621 | bytes_per_pixel = 2; |
621 | bytes_per_pixel = 2; |
622 | else |
622 | else |
623 | return false; |
623 | return false; |
624 | |
624 | |
625 | width_r = rxvt_popcount (visual->red_mask); |
625 | width_r = ecb_popcount32 (visual->red_mask); |
626 | width_g = rxvt_popcount (visual->green_mask); |
626 | width_g = ecb_popcount32 (visual->green_mask); |
627 | width_b = rxvt_popcount (visual->blue_mask); |
627 | width_b = ecb_popcount32 (visual->blue_mask); |
628 | |
628 | |
629 | if (width_r > 8 || width_g > 8 || width_b > 8) |
629 | if (width_r > 8 || width_g > 8 || width_b > 8) |
630 | return false; |
630 | return false; |
631 | |
631 | |
632 | sh_r = rxvt_ctz (visual->red_mask); |
632 | sh_r = ecb_ctz32 (visual->red_mask); |
633 | sh_g = rxvt_ctz (visual->green_mask); |
633 | sh_g = ecb_ctz32 (visual->green_mask); |
634 | sh_b = rxvt_ctz (visual->blue_mask); |
634 | sh_b = ecb_ctz32 (visual->blue_mask); |
635 | |
635 | |
636 | if (width > INT_MAX / height / bytes_per_pixel) |
636 | if (width > INT_MAX / height / bytes_per_pixel) |
637 | return false; |
637 | return false; |
638 | |
638 | |
639 | data = (char *)malloc (width * height * bytes_per_pixel); |
639 | data = (char *)malloc (width * height * bytes_per_pixel); |
… | |
… | |
646 | { |
646 | { |
647 | free (data); |
647 | free (data); |
648 | return false; |
648 | return false; |
649 | } |
649 | } |
650 | |
650 | |
651 | ximage->byte_order = byteorder::big_endian () ? MSBFirst : LSBFirst; |
651 | ximage->byte_order = ecb_big_endian () ? MSBFirst : LSBFirst; |
652 | |
652 | |
653 | rowstride = gdk_pixbuf_get_rowstride (pixbuf); |
653 | rowstride = gdk_pixbuf_get_rowstride (pixbuf); |
654 | channels = gdk_pixbuf_get_n_channels (pixbuf); |
654 | channels = gdk_pixbuf_get_n_channels (pixbuf); |
655 | row = gdk_pixbuf_get_pixels (pixbuf) + src_y * rowstride + src_x * channels; |
655 | row = gdk_pixbuf_get_pixels (pixbuf) + src_y * rowstride + src_x * channels; |
656 | line = data; |
656 | line = data; |
… | |
… | |
1439 | uint32_t mask_r, mask_g, mask_b; |
1439 | uint32_t mask_r, mask_g, mask_b; |
1440 | uint32_t *lookup, *lookup_r, *lookup_g, *lookup_b; |
1440 | uint32_t *lookup, *lookup_r, *lookup_g, *lookup_b; |
1441 | rgba low; |
1441 | rgba low; |
1442 | rgba high; |
1442 | rgba high; |
1443 | int i; |
1443 | int i; |
1444 | int host_byte_order = byteorder::big_endian () ? MSBFirst : LSBFirst; |
1444 | int host_byte_order = ecb_big_endian () ? MSBFirst : LSBFirst; |
1445 | |
1445 | |
1446 | if (visual->c_class != TrueColor || ximage->format != ZPixmap) return; |
1446 | if (visual->c_class != TrueColor || ximage->format != ZPixmap) return; |
1447 | |
1447 | |
1448 | /* for convenience */ |
1448 | /* for convenience */ |
1449 | mask_r = visual->red_mask; |
1449 | mask_r = visual->red_mask; |