mirror of
https://git.planet-casio.com/Lephenixnoir/gint.git
synced 2024-12-29 13:03:36 +01:00
render-cg: update to bopti formats for Azur
This commit is contained in:
parent
73446aae61
commit
1384c54b5f
2 changed files with 18 additions and 7 deletions
|
@ -69,18 +69,29 @@ typedef struct
|
||||||
later on */
|
later on */
|
||||||
uint16_t profile;
|
uint16_t profile;
|
||||||
|
|
||||||
/* Color code assigned to transparent pixels (unused in 16-bit) */
|
/* Color code assigned to transparent pixels (unused in 16-bit). In
|
||||||
|
P8_RGB565A, the value assigned to alpha is always 0. */
|
||||||
uint16_t alpha;
|
uint16_t alpha;
|
||||||
|
|
||||||
/* Full width and height, in pixels */
|
/* Full width and height, in pixels */
|
||||||
uint16_t width;
|
uint16_t width;
|
||||||
uint16_t height;
|
uint16_t height;
|
||||||
|
|
||||||
/* Color palette:
|
/* Here we lose structure because of the flexible array.
|
||||||
* 16-bit and 16-bit alpha: none
|
|
||||||
* 8-bit: 256 colors (total 512 bytes)
|
RGB565, RGB565A:
|
||||||
* 4-bit: 16 colors (total 32 bytes)
|
* Pixels in row-major order, 16 bits per pixel
|
||||||
Then raw pixel data in row-major order. */
|
P8:
|
||||||
|
* Palette with 256 entries (512 bytes total)
|
||||||
|
* Pixels in row-major order, 8 bits per pixel
|
||||||
|
P8_RGB565A, P8_RGB565:
|
||||||
|
* Number of entries in palette, N (2 bytes)
|
||||||
|
* Palette with N entries (2N bytes)
|
||||||
|
* Pixels in row-major order, 8 bits per pixel (signed indices in an
|
||||||
|
uint16_t array starting at <palette>+<256 bytes>)
|
||||||
|
P4/P4_RGB565A, P4_RGB565:
|
||||||
|
* Palette with 16 entries (32 bytes total)
|
||||||
|
* Pixels in row-major order, 4 bits per pixel, each row byte-padded */
|
||||||
uint16_t data[];
|
uint16_t data[];
|
||||||
|
|
||||||
} GPACKED(4) bopti_image_t;
|
} GPACKED(4) bopti_image_t;
|
||||||
|
|
|
@ -61,7 +61,7 @@ void bopti_render(bopti_image_t const *img, struct box *box)
|
||||||
|
|
||||||
/* Due to nibble alignment being a hassle, in this function the
|
/* Due to nibble alignment being a hassle, in this function the
|
||||||
input stride is expressed in pixels. */
|
input stride is expressed in pixels. */
|
||||||
int in = img->width - w;
|
int in = img->width - w + (img->width & 1);
|
||||||
/* Also we don't move pointers, we just use pixel offsets. */
|
/* Also we don't move pointers, we just use pixel offsets. */
|
||||||
int offset = img->width * box->top + box->left;
|
int offset = img->width * box->top + box->left;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue