gint/src/gray/gimage.c
lephe 1cf5bf514a bopti: add gray support for all four profiles
This change finally introduces gray image rendering with bopti. This
is the final iteration of bopti v2 and certainly the fastest so far.
All four profiles are supported, without change to the format.
2019-07-27 19:51:53 -04:00

41 lines
922 B
C

#include <gint/gray.h>
#include <display/fx.h>
#include "../render-fx/bopti-asm.h"
/* List of rendering functions */
static void *bopti_asm[] = {
bopti_gasm_mono,
bopti_gasm_mono_alpha,
bopti_gasm_gray,
bopti_gasm_gray_alpha,
};
/* gimage(): Render a full image */
void gimage(int x, int y, image_t const *img)
{
uint32_t *light, *dark;
gvram(&light, &dark);
bopti_render_clip(x, y, img, 0, 0, img->width, img->height, light,
dark, bopti_asm[img->profile]);
}
/* gsubimage(): Render a section of an image */
void gsubimage(int x, int y, image_t const *img, int left, int top,
int width, int height, int flags)
{
uint32_t *light, *dark;
gvram(&light, &dark);
if(flags & DIMAGE_NOCLIP)
{
bopti_render_noclip(x, y, img, left, top, width, height,
light, dark, bopti_asm[img->profile]);
}
else
{
bopti_render_clip(x, y, img, left, top, width, height,
light, dark, bopti_asm[img->profile]);
}
}