📄 pixman-access.c
字号:
static FASTCALL voidfbStore_b8g8r8 (pixman_image_t *image, uint32_t *bits, const uint32_t *values, int x, int width, const pixman_indexed_t * indexed){ int i; uint8_t *pixel = ((uint8_t *) bits) + 3*x; for (i = 0; i < width; ++i) { uint32_t val = values[i];#if IMAGE_BYTE_ORDER == MSBFirst WRITE(image, pixel++, Blue(val)); WRITE(image, pixel++, Green(val)); WRITE(image, pixel++, Red(val));#else WRITE(image, pixel++, Red(val)); WRITE(image, pixel++, Green(val)); WRITE(image, pixel++, Blue(val));#endif }}static FASTCALL voidfbStore_r5g6b5 (pixman_image_t *image, uint32_t *bits, const uint32_t *values, int x, int width, const pixman_indexed_t * indexed){ int i; uint16_t *pixel = ((uint16_t *) bits) + x; for (i = 0; i < width; ++i) { uint32_t s = values[i]; WRITE(image, pixel++, ((s >> 3) & 0x001f) | ((s >> 5) & 0x07e0) | ((s >> 8) & 0xf800)); }}static FASTCALL voidfbStore_b5g6r5 (pixman_image_t *image, uint32_t *bits, const uint32_t *values, int x, int width, const pixman_indexed_t * indexed){ int i; uint16_t *pixel = ((uint16_t *) bits) + x; for (i = 0; i < width; ++i) { Split(values[i]); WRITE(image, pixel++, ((b << 8) & 0xf800) | ((g << 3) & 0x07e0) | ((r >> 3) )); }}static FASTCALL voidfbStore_a1r5g5b5 (pixman_image_t *image, uint32_t *bits, const uint32_t *values, int x, int width, const pixman_indexed_t * indexed){ int i; uint16_t *pixel = ((uint16_t *) bits) + x; for (i = 0; i < width; ++i) { Splita(values[i]); WRITE(image, pixel++, ((a << 8) & 0x8000) | ((r << 7) & 0x7c00) | ((g << 2) & 0x03e0) | ((b >> 3) )); }}static FASTCALL voidfbStore_x1r5g5b5 (pixman_image_t *image, uint32_t *bits, const uint32_t *values, int x, int width, const pixman_indexed_t * indexed){ int i; uint16_t *pixel = ((uint16_t *) bits) + x; for (i = 0; i < width; ++i) { Split(values[i]); WRITE(image, pixel++, ((r << 7) & 0x7c00) | ((g << 2) & 0x03e0) | ((b >> 3) )); }}static FASTCALL voidfbStore_a1b5g5r5 (pixman_image_t *image, uint32_t *bits, const uint32_t *values, int x, int width, const pixman_indexed_t * indexed){ int i; uint16_t *pixel = ((uint16_t *) bits) + x; for (i = 0; i < width; ++i) { Splita(values[i]); WRITE(image, pixel++, ((a << 8) & 0x8000) | ((b << 7) & 0x7c00) | ((g << 2) & 0x03e0) | ((r >> 3) )); }}static FASTCALL voidfbStore_x1b5g5r5 (pixman_image_t *image, uint32_t *bits, const uint32_t *values, int x, int width, const pixman_indexed_t * indexed){ int i; uint16_t *pixel = ((uint16_t *) bits) + x; for (i = 0; i < width; ++i) { Split(values[i]); WRITE(image, pixel++, ((b << 7) & 0x7c00) | ((g << 2) & 0x03e0) | ((r >> 3) )); }}static FASTCALL voidfbStore_a4r4g4b4 (pixman_image_t *image, uint32_t *bits, const uint32_t *values, int x, int width, const pixman_indexed_t * indexed){ int i; uint16_t *pixel = ((uint16_t *) bits) + x; for (i = 0; i < width; ++i) { Splita(values[i]); WRITE(image, pixel++, ((a << 8) & 0xf000) | ((r << 4) & 0x0f00) | ((g ) & 0x00f0) | ((b >> 4) )); }}static FASTCALL voidfbStore_x4r4g4b4 (pixman_image_t *image, uint32_t *bits, const uint32_t *values, int x, int width, const pixman_indexed_t * indexed){ int i; uint16_t *pixel = ((uint16_t *) bits) + x; for (i = 0; i < width; ++i) { Split(values[i]); WRITE(image, pixel++, ((r << 4) & 0x0f00) | ((g ) & 0x00f0) | ((b >> 4) )); }}static FASTCALL voidfbStore_a4b4g4r4 (pixman_image_t *image, uint32_t *bits, const uint32_t *values, int x, int width, const pixman_indexed_t * indexed){ int i; uint16_t *pixel = ((uint16_t *) bits) + x; for (i = 0; i < width; ++i) { Splita(values[i]); WRITE(image, pixel++, ((a << 8) & 0xf000) | ((b << 4) & 0x0f00) | ((g ) & 0x00f0) | ((r >> 4) )); }}static FASTCALL voidfbStore_x4b4g4r4 (pixman_image_t *image, uint32_t *bits, const uint32_t *values, int x, int width, const pixman_indexed_t * indexed){ int i; uint16_t *pixel = ((uint16_t *) bits) + x; for (i = 0; i < width; ++i) { Split(values[i]); WRITE(image, pixel++, ((b << 4) & 0x0f00) | ((g ) & 0x00f0) | ((r >> 4) )); }}static FASTCALL voidfbStore_a8 (pixman_image_t *image, uint32_t *bits, const uint32_t *values, int x, int width, const pixman_indexed_t * indexed){ int i; uint8_t *pixel = ((uint8_t *) bits) + x; for (i = 0; i < width; ++i) { WRITE(image, pixel++, values[i] >> 24); }}static FASTCALL voidfbStore_r3g3b2 (pixman_image_t *image, uint32_t *bits, const uint32_t *values, int x, int width, const pixman_indexed_t * indexed){ int i; uint8_t *pixel = ((uint8_t *) bits) + x; for (i = 0; i < width; ++i) { Split(values[i]); WRITE(image, pixel++, ((r ) & 0xe0) | ((g >> 3) & 0x1c) | ((b >> 6) )); }}static FASTCALL voidfbStore_b2g3r3 (pixman_image_t *image, uint32_t *bits, const uint32_t *values, int x, int width, const pixman_indexed_t * indexed){ int i; uint8_t *pixel = ((uint8_t *) bits) + x; for (i = 0; i < width; ++i) { Split(values[i]); WRITE(image, pixel++, ((b ) & 0xc0) | ((g >> 2) & 0x1c) | ((r >> 5) )); }}static FASTCALL voidfbStore_a2r2g2b2 (pixman_image_t *image, uint32_t *bits, const uint32_t *values, int x, int width, const pixman_indexed_t * indexed){ int i; uint8_t *pixel = ((uint8_t *) bits) + x; for (i = 0; i < width; ++i) { Splita(values[i]); WRITE(image, pixel++, ((a ) & 0xc0) | ((r >> 2) & 0x30) | ((g >> 4) & 0x0c) | ((b >> 6) )); }}static FASTCALL voidfbStore_c8 (pixman_image_t *image, uint32_t *bits, const uint32_t *values, int x, int width, const pixman_indexed_t * indexed){ int i; uint8_t *pixel = ((uint8_t *) bits) + x; for (i = 0; i < width; ++i) { WRITE(image, pixel++, miIndexToEnt24(indexed,values[i])); }}static FASTCALL voidfbStore_x4a4 (pixman_image_t *image, uint32_t *bits, const uint32_t *values, int x, int width, const pixman_indexed_t * indexed){ int i; uint8_t *pixel = ((uint8_t *) bits) + x; for (i = 0; i < width; ++i) { WRITE(image, pixel++, values[i] >> 28); }}#define Store8(img,l,o,v) (WRITE(img, (uint8_t *)(l) + ((o) >> 3), (v)))#if IMAGE_BYTE_ORDER == MSBFirst#define Store4(img,l,o,v) Store8(img,l,o,((o) & 4 ? \ (Fetch8(img,l,o) & 0xf0) | (v) : \ (Fetch8(img,l,o) & 0x0f) | ((v) << 4)))#else#define Store4(img,l,o,v) Store8(img,l,o,((o) & 4 ? \ (Fetch8(img,l,o) & 0x0f) | ((v) << 4) : \ (Fetch8(img,l,o) & 0xf0) | (v)))#endifstatic FASTCALL voidfbStore_a4 (pixman_image_t *image, uint32_t *bits, const uint32_t *values, int x, int width, const pixman_indexed_t * indexed){ int i; for (i = 0; i < width; ++i) { Store4(image, bits, i + x, values[i]>>28); }}static FASTCALL voidfbStore_r1g2b1 (pixman_image_t *image, uint32_t *bits, const uint32_t *values, int x, int width, const pixman_indexed_t * indexed){ int i; for (i = 0; i < width; ++i) { uint32_t pixel; Split(values[i]); pixel = (((r >> 4) & 0x8) | ((g >> 5) & 0x6) | ((b >> 7) )); Store4(image, bits, i + x, pixel); }}static FASTCALL voidfbStore_b1g2r1 (pixman_image_t *image, uint32_t *bits, const uint32_t *values, int x, int width, const pixman_indexed_t * indexed){ int i; for (i = 0; i < width; ++i) { uint32_t pixel; Split(values[i]); pixel = (((b >> 4) & 0x8) | ((g >> 5) & 0x6) | ((r >> 7) )); Store4(image, bits, i + x, pixel); }}static FASTCALL voidfbStore_a1r1g1b1 (pixman_image_t *image, uint32_t *bits, const uint32_t *values, int x, int width, const pixman_indexed_t * indexed){ int i; for (i = 0; i < width; ++i) { uint32_t pixel; Splita(values[i]); pixel = (((a >> 4) & 0x8) | ((r >> 5) & 0x4) | ((g >> 6) & 0x2) | ((b >> 7) )); Store4(image, bits, i + x, pixel); }}static FASTCALL voidfbStore_a1b1g1r1 (pixman_image_t *image, uint32_t *bits, const uint32_t *values, int x, int width, const pixman_indexed_t * indexed){ int i; for (i = 0; i < width; ++i) { uint32_t pixel; Splita(values[i]); pixel = (((a >> 4) & 0x8) | ((b >> 5) & 0x4) | ((g >> 6) & 0x2) | ((r >> 7) )); Store4(image, bits, i + x, pixel); }}static FASTCALL voidfbStore_c4 (pixman_image_t *image, uint32_t *bits, const uint32_t *values, int x, int width, const pixman_indexed_t * indexed){ int i; for (i = 0; i < width; ++i) { uint32_t pixel; pixel = miIndexToEnt24(indexed, values[i]); Store4(image, bits, i + x, pixel); }}static FASTCALL voidfbStore_a1 (pixman_image_t *image, uint32_t *bits, const uint32_t *values, int x, int width, const pixman_indexed_t * indexed){ int i; for (i = 0; i < width; ++i) { uint32_t *pixel = ((uint32_t *) bits) + ((i+x) >> 5); uint32_t mask = FbStipMask((i+x) & 0x1f, 1); uint32_t v = values[i] & 0x80000000 ? mask : 0; WRITE(image, pixel, (READ(image, pixel) & ~mask) | v); }}static FASTCALL voidfbStore_g1 (pixman_image_t *image, uint32_t *bits, const uint32_t *values, int x, int width, const pixman_indexed_t * indexed){ int i; for (i = 0; i < width; ++i) { uint32_t *pixel = ((uint32_t *) bits) + ((i+x) >> 5); uint32_t mask = FbStipMask((i+x) & 0x1f, 1); uint32_t v = miIndexToEntY24(indexed,values[i]) ? mask : 0; WRITE(image, pixel, (READ(image, pixel) & ~mask) | v); }}storeProc STORE_PROC_FOR_PICTURE (bits_image_t * pict){ switch(pict->format) { case PIXMAN_a8r8g8b8: return fbStore_a8r8g8b8; case PIXMAN_x8r8g8b8: return fbStore_x8r8g8b8; case PIXMAN_a8b8g8r8: return fbStore_a8b8g8r8; case PIXMAN_x8b8g8r8: return fbStore_x8b8g8r8; /* 24bpp formats */ case PIXMAN_r8g8b8: return fbStore_r8g8b8; case PIXMAN_b8g8r8: return fbStore_b8g8r8; /* 16bpp formats */ case PIXMAN_r5g6b5: return fbStore_r5g6b5; case PIXMAN_b5g6r5: return fbStore_b5g6r5; case PIXMAN_a1r5g5b5: return fbStore_a1r5g5b5; case PIXMAN_x1r5g5b5: return fbStore_x1r5g5b5; case PIXMAN_a1b5g5r5: return fbStore_a1b5g5r5; case PIXMAN_x1b5g5r5: return fbStore_x1b5g5r5; case PIXMAN_a4r4g4b4: return fbStore_a4r4g4b4; case PIXMAN_x4r4g4b4: return fbStore_x4r4g4b4; case PIXMAN_a4b4g4r4: return fbStore_a4b4g4r4; case PIXMAN_x4b4g4r4: return fbStore_x4b4g4r4; /* 8bpp formats */ case PIXMAN_a8: return fbStore_a8; case PIXMAN_r3g3b2: return fbStore_r3g3b2; case PIXMAN_b2g3r3: return fbStore_b2g3r3; case PIXMAN_a2r2g2b2: return fbStore_a2r2g2b2; case PIXMAN_c8: return fbStore_c8; case PIXMAN_g8: return fbStore_c8; case PIXMAN_x4a4: return fbStore_x4a4; /* 4bpp formats */ case PIXMAN_a4: return fbStore_a4; case PIXMAN_r1g2b1: return fbStore_r1g2b1; case PIXMAN_b1g2r1: return fbStore_b1g2r1; case PIXMAN_a1r1g1b1: return fbStore_a1r1g1b1; case PIXMAN_a1b1g1r1: return fbStore_a1b1g1r1; case PIXMAN_c4: return fbStore_c4; case PIXMAN_g4: return fbStore_c4; /* 1bpp formats */ case PIXMAN_a1: return fbStore_a1; case PIXMAN_g1: return fbStore_g1; default: return NULL; }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -