int miIsSolidAlpha (pixman_image_t *src) { char line[1]; /* Alpha-only */ if (PICT_FORMAT_TYPE (src->format_code) != PICT_TYPE_A) return 0; /* repeat */ if (!src->repeat) return 0; /* 1x1 */ if (src->pixels->width != 1 || src->pixels->height != 1) return 0; line[0] = 1; /* XXX: For the next line, fb has: (*pScreen->GetImage) (src->pixels, 0, 0, 1, 1, ZPixmap, ~0L, line); Is the following simple assignment sufficient? */ line[0] = src->pixels->data[0]; switch (src->pixels->bpp) { case 1: return (uint8_t) line[0] == 1 || (uint8_t) line[0] == 0x80; case 4: return (uint8_t) line[0] == 0xf || (uint8_t) line[0] == 0xf0; case 8: return (uint8_t) line[0] == 0xff; default: return 0; } }
/* * Create an xa format from a PICT format. */ enum xa_formats to_xa_format(enum _PictFormatShort format) { uint32_t ptype = PICT_FORMAT_TYPE(format); if ((ptype >= ARRAY_SIZE(stype_map)) || (stype_map[ptype] == 0) || (stype_map[ptype] == xa_type_other)) return xa_format_unknown; return xa_format(PICT_FORMAT_BPP(format), stype_map[ptype], PICT_FORMAT_A(format), PICT_FORMAT_R(format), PICT_FORMAT_G(format), PICT_FORMAT_B(format)); }
static Bool uxa_get_pixel_from_rgba(CARD32 * pixel, CARD16 red, CARD16 green, CARD16 blue, CARD16 alpha, CARD32 format) { int rbits, bbits, gbits, abits; int rshift, bshift, gshift, ashift; rbits = PICT_FORMAT_R(format); gbits = PICT_FORMAT_G(format); bbits = PICT_FORMAT_B(format); abits = PICT_FORMAT_A(format); if (abits == 0) abits = PICT_FORMAT_BPP(format) - (rbits+gbits+bbits); if (PICT_FORMAT_TYPE(format) == PICT_TYPE_A) { *pixel = alpha >> (16 - abits); return TRUE; }