mirror of
https://git.planet-casio.com/Lephenixnoir/gint.git
synced 2024-12-29 13:03:36 +01:00
bopti: add support for r5g6b5 and r5g6b5a on fxcg50
This commit introduces bopti for fxcg50 with the first basic 16-bit formats. The performance is rather slow, especially for large images, and will need refinements and/or overclock to be really efficient in full-screen real-time applications.
This commit is contained in:
parent
62a49a543e
commit
652637d475
4 changed files with 72 additions and 31 deletions
|
@ -81,37 +81,6 @@ typedef struct
|
|||
|
||||
} GPACKED(4) image_t;
|
||||
|
||||
/* dimage() - render a full image
|
||||
This function blits an image on the VRAM using gint's special format. It is
|
||||
a special case of dsubimage() where the full image is drawn with clipping.
|
||||
|
||||
@x @y Coordinates of the top-left corner of the image
|
||||
@image Pointer to image encoded with [fxconv] */
|
||||
void dimage(int x, int y, image_t const *image);
|
||||
|
||||
/* Option values for dsubimage() */
|
||||
enum {
|
||||
/* No option */
|
||||
DIMAGE_NONE = 0x00,
|
||||
|
||||
/* Disable clipping, ie. adjustments to the specified subrectangle and
|
||||
screen location such that any part that overflows from the image or
|
||||
the screen is ignored. Slightly faster. */
|
||||
DIMAGE_NOCLIP = 0x01,
|
||||
};
|
||||
|
||||
/* dsubimage() - render a section of an image
|
||||
This function blits a subrectangle [left, top, width, height] of an image on
|
||||
the VRAM. It is more general than dimage() and also provides a few options.
|
||||
|
||||
@x @y Coordinates on screen of the rendered subrectangle
|
||||
@image Pointer to image encoded with [fxconv]
|
||||
@left @top Top-left coordinates of the subrectangle within [image]
|
||||
@width @height Subrectangle dimensions
|
||||
@flags OR-combination of DIMAGE_* flags */
|
||||
void dsubimage(int x, int y, image_t const *image, int left, int top,
|
||||
int width, int height, int flags);
|
||||
|
||||
#endif /* FX9860G */
|
||||
|
||||
#endif /* GINT_DISPLAY_FX */
|
||||
|
|
|
@ -199,6 +199,43 @@ void dsize(const char *str, font_t const * font, int *w, int *h);
|
|||
fxcg50: Any R5G6B5 color, or C_NONE */
|
||||
void dtext(int x, int y, const char *str, int fg, int bg);
|
||||
|
||||
//---
|
||||
// Image rendering (bopti)
|
||||
//---
|
||||
|
||||
/* The image_t structure is platform-dependent. */
|
||||
|
||||
/* dimage() - render a full image
|
||||
This function blits an image on the VRAM using gint's special format. It is
|
||||
a special case of dsubimage() where the full image is drawn with clipping.
|
||||
|
||||
@x @y Coordinates of the top-left corner of the image
|
||||
@image Pointer to image encoded with [fxconv] */
|
||||
void dimage(int x, int y, image_t const *image);
|
||||
|
||||
/* Option values for dsubimage() */
|
||||
enum {
|
||||
/* No option */
|
||||
DIMAGE_NONE = 0x00,
|
||||
|
||||
/* Disable clipping, ie. adjustments to the specified subrectangle and
|
||||
screen location such that any part that overflows from the image or
|
||||
the screen is ignored. Slightly faster. */
|
||||
DIMAGE_NOCLIP = 0x01,
|
||||
};
|
||||
|
||||
/* dsubimage() - render a section of an image
|
||||
This function blits a subrectangle [left, top, width, height] of an image on
|
||||
the VRAM. It is more general than dimage() and also provides a few options.
|
||||
|
||||
@x @y Coordinates on screen of the rendered subrectangle
|
||||
@image Pointer to image encoded with [fxconv]
|
||||
@left @top Top-left coordinates of the subrectangle within [image]
|
||||
@width @height Subrectangle dimensions
|
||||
@flags OR-combination of DIMAGE_* flags */
|
||||
void dsubimage(int x, int y, image_t const *image, int left, int top,
|
||||
int width, int height, int flags);
|
||||
|
||||
//---
|
||||
// Advanced functions
|
||||
//---
|
||||
|
|
|
@ -22,4 +22,16 @@ void bopti_r5g6b5(uint16_t const *data, uint16_t *target, int width,
|
|||
void bopti_r5g6b5a(uint16_t const *data, uint16_t *target, int width,
|
||||
int height, int in_stride, int out_stride, uint16_t alpha);
|
||||
|
||||
/* bopti_render_clip(): Render with clipping
|
||||
Same parameters as dsubimage(), except for flags. */
|
||||
void bopti_render_clip(int x, int y, image_t const *img, int left, int top,
|
||||
int width, int height);
|
||||
|
||||
/* bopti_render_clip(): Render without clipping
|
||||
Behaviour is not defined if (left,top)+(width,height) is not included in the
|
||||
source image or (x,y)+(width,height) is not included in the VRAM area.
|
||||
Same parameters as dsubimage(), except for flags. */
|
||||
void bopti_render_noclip(int x, int y, image_t const *img, int left, int top,
|
||||
int width, int height);
|
||||
|
||||
#endif /* GINT_RENDERCG_BOPTIASM */
|
||||
|
|
23
src/render-cg/dimage.c
Normal file
23
src/render-cg/dimage.c
Normal file
|
@ -0,0 +1,23 @@
|
|||
#define GINT_NEED_VRAM
|
||||
#include <gint/display.h>
|
||||
#include "bopti-asm.h"
|
||||
|
||||
/* dimage() - render a full image */
|
||||
void dimage(int x, int y, image_t const *img)
|
||||
{
|
||||
bopti_render_clip(x, y, img, 0, 0, img->width, img->height);
|
||||
}
|
||||
|
||||
/* dsubimage() - render a section of an image */
|
||||
void dsubimage(int x, int y, image_t const *img, int left, int top,
|
||||
int width, int height, int flags)
|
||||
{
|
||||
if(flags & DIMAGE_NOCLIP)
|
||||
{
|
||||
bopti_render_noclip(x, y, img, left, top, width, height);
|
||||
}
|
||||
else
|
||||
{
|
||||
bopti_render_clip(x, y, img, left, top, width, height);
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue