Skip to content
Snippets Groups Projects
Commit f7ac8c7a authored by Deucе's avatar Deucе :ok_hand_tone4:
Browse files

Only set r2yptr and y2rptr if bitmap driver in use.

Rename to ciolib_[ry]2[ry]ptr and put in ciolib.c/h
Should fix curses-only build.
parent 092885ff
No related branches found
No related tags found
1 merge request!463MRC mods by Codefenix (2024-10-20)
Pipeline #4218 failed
......@@ -182,4 +182,6 @@ endif
ifdef NEED_BITMAP
CIOLIB_INTERPOLATE_OBJS = $(CIOLIB_SRC)$(DIRSEP)$(MTOBJODIR)$(DIRSEP)rgbmap$(OFILE)
CIOLIB_INTERPOLATE_TARGET = $(MTOBJODIR)$(DIRSEP)rgbmap$(OFILE)
CIOLIB_CFLAGS += -DHAS_BITMAP
CIOLIB-MT_CFLAGS += -DHAS_BITMAP
endif
......@@ -88,6 +88,9 @@ CIOLIBEXPORT const char *ciolib_appname=NULL;
CIOLIBEXPORT int ciolib_initial_window_height = -1;
CIOLIBEXPORT int ciolib_initial_window_width = -1;
CIOLIBEXPORT int ciolib_initial_scaling = 0;
CIOLIBEXPORT const uint32_t *ciolib_r2yptr;
CIOLIBEXPORT const uint32_t *ciolib_y2rptr;
static int initialized=0;
CIOLIBEXPORT int ciolib_movetext(int sx, int sy, int ex, int ey, int dx, int dy);
......
......@@ -407,6 +407,8 @@ CIOLIBEXPORTVAR const char *ciolib_appname;
CIOLIBEXPORTVAR int ciolib_initial_window_height;
CIOLIBEXPORTVAR int ciolib_initial_window_width;
CIOLIBEXPORTVAR int ciolib_initial_scaling;
CIOLIBEXPORTVAR const uint32_t *ciolib_r2yptr;
CIOLIBEXPORTVAR const uint32_t *ciolib_y2rptr;
CIOLIBEXPORT int initciolib(int mode);
CIOLIBEXPORT void suspendciolib(void);
......
......@@ -7,9 +7,6 @@
#include "scale.h"
#include "xbr.h"
const uint32_t *r2yptr;
const uint32_t *y2rptr;
static void pointy_scale3(uint32_t* src, uint32_t* dest, int width, int height);
static void pointy_scale5(uint32_t* src, uint32_t* dest, int width, int height);
static void pointy_scale_odd(uint32_t* src, uint32_t* dest, int width, int height, int mult);
......@@ -206,7 +203,7 @@ init_r2y(void)
v = 128 + (112.439 * r - 94.154 * g - 18.285 * b + 128) / 256;
CLAMP(v);
r2yptr[(r<<16) | (g<<8) | b] = (y<<16)|(u<<8)|v;
ciolib_r2yptr[(r<<16) | (g<<8) | b] = (y<<16)|(u<<8)|v;
}
}
}
......@@ -223,7 +220,7 @@ init_r2y(void)
b = luma * c + col * 1.772 * d;
CLAMP(b);
y2rptr[(y<<16) | (u<<8) | v] = (r<<16)|(g<<8)|b;
ciolib_y2rptr[(y<<16) | (u<<8) | v] = (r<<16)|(g<<8)|b;
}
}
}
......@@ -324,7 +321,7 @@ do_scale(struct rectlist* rect, int xscale, int yscale, int aspect_width, int as
total_yscaling /= 3;
yscale *= 3;
}
if (r2yptr != NULL && y2rptr != NULL) {
if (ciolib_r2yptr != NULL && ciolib_y2rptr != NULL) {
while (total_xscaling > 1 && ((total_xscaling % 4) == 0) && ((total_yscaling % 4) == 0)) {
xbr4++;
total_xscaling /= 4;
......@@ -483,7 +480,7 @@ csrc->w, csrc->h, pointymult, pointy5, pointy3, xbr4, xbr2, xmult, ymult, csrc->
}
// And finally, interpolate if needed
if (r2yptr != NULL && y2rptr != NULL) {
if (ciolib_r2yptr != NULL && ciolib_y2rptr != NULL) {
if (fheight != csrc->h) {
interpolate_height(csrc->data, ctarget->data, csrc->w, csrc->h, fheight);
ctarget->h = fheight;
......@@ -816,8 +813,8 @@ blend(const uint32_t c1, const uint32_t c2, uint16_t weight)
uint8_t yuv3[4];
const uint16_t iw = 65535 - weight;
*(uint32_t *)yuv1 = r2yptr[c1];
*(uint32_t *)yuv2 = r2yptr[c2];
*(uint32_t *)yuv1 = ciolib_r2yptr[c1];
*(uint32_t *)yuv2 = ciolib_r2yptr[c2];
#ifdef __BIG_ENDIAN__
yuv3[0] = 0;
yuv3[1] = (yuv1[1] * iw + yuv2[1] * weight) / 65535;
......@@ -830,7 +827,7 @@ blend(const uint32_t c1, const uint32_t c2, uint16_t weight)
yuv3[0] = (yuv1[0] * iw + yuv2[0] * weight) / 65535;
#endif
return y2rptr[*(uint32_t*)yuv3];
return ciolib_y2rptr[*(uint32_t*)yuv3];
}
/*
......
......@@ -10,9 +10,6 @@ struct graphics_buffer {
struct graphics_buffer *next;
};
extern const uint32_t *r2yptr;
extern const uint32_t *y2rptr;
struct graphics_buffer * get_buffer(void);
void release_buffer(struct graphics_buffer *);
void init_r2y(void);
......
......@@ -375,7 +375,7 @@ int load_vmode(struct video_stats *vs, int mode)
vs->currattr = vparams[i].default_attr;
vs->aspect_width = vparams[i].aspect_width;
vs->aspect_height = vparams[i].aspect_height;
if (vs->aspect_width == 0 || vs->aspect_height == 0 || r2yptr == NULL || y2rptr == NULL) {
if (vs->aspect_width == 0 || vs->aspect_height == 0 || ciolib_r2yptr == NULL || ciolib_y2rptr == NULL) {
vs->aspect_width = vs->scrnwidth;
vs->aspect_height = vs->scrnheight;
}
......@@ -387,7 +387,7 @@ int load_vmode(struct video_stats *vs, int mode)
vs->scrnheight = vparams[i].yres;
else
vs->scrnheight = vs->charheight * vs->rows;
if (vs->aspect_width == 0 || vs->aspect_height == 0 || r2yptr == NULL || y2rptr == NULL) {
if (vs->aspect_width == 0 || vs->aspect_height == 0 || ciolib_r2yptr == NULL || ciolib_y2rptr == NULL) {
vs->aspect_width = vs->scrnwidth;
vs->aspect_height = vs->scrnheight;
}
......
......@@ -1700,8 +1700,10 @@ main(int argc, char **argv)
cio_api.options |= CONIO_OPT_BLOCKY_SCALING;
else
cio_api.options &= ~CONIO_OPT_BLOCKY_SCALING;
r2yptr = r2y;
y2rptr = y2r;
#ifdef HAS_BITMAP
ciolib_r2yptr = r2y;
ciolib_y2rptr = y2r;
#endif
if (initciolib(ciolib_mode))
return 1;
if (settings.blocky)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment