Got rid of r_softcursor by having the backend always draw the cursor
instead. This fixes graphics glitches in at least ITE. Got rid of r_fullscreen, which wasn't even used anymore anyway. svn-id: r13748
This commit is contained in:
parent
fb1b2efb49
commit
67d82f23d8
4 changed files with 31 additions and 90 deletions
98
saga/gfx.cpp
98
saga/gfx.cpp
|
@ -63,6 +63,11 @@ int GFX_Init(OSystem *system, int width, int height) {
|
|||
// Set module data
|
||||
GfxModule.r_back_buf = r_back_buf;
|
||||
GfxModule.init = 1;
|
||||
GfxModule.white_index = -1;
|
||||
GfxModule.black_index = -1;
|
||||
|
||||
// For now, always show the mouse cursor.
|
||||
SYSINPUT_ShowMouse();
|
||||
|
||||
return R_SUCCESS;
|
||||
}
|
||||
|
@ -376,73 +381,6 @@ int GFX_BufToBuffer(byte *dst_buf, int dst_w, int dst_h, const byte *src,
|
|||
return R_SUCCESS;
|
||||
}
|
||||
|
||||
int GFX_DrawCursor(R_SURFACE *ds, R_POINT *p1) {
|
||||
static byte cursor_img[R_CURSOR_W * R_CURSOR_H] = {
|
||||
0, 0, 0, 255, 0, 0, 0,
|
||||
0, 0, 0, 255, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0,
|
||||
255, 255, 0, 0, 0, 255, 255,
|
||||
0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 255, 0, 0, 0,
|
||||
0, 0, 0, 255, 0, 0, 0
|
||||
};
|
||||
|
||||
R_CLIPINFO ci;
|
||||
|
||||
byte *src_p, *dst_p;
|
||||
|
||||
int x, y;
|
||||
int src_skip, dst_skip;
|
||||
|
||||
R_POINT cur_pt;
|
||||
R_RECT cur_rect;
|
||||
|
||||
// Clamp point to surface
|
||||
cur_pt.x = MAX(p1->x, (int16)0);
|
||||
cur_pt.y = MAX(p1->y, (int16)0);
|
||||
|
||||
cur_pt.x = MIN(p1->x, (int16)(ds->buf_w - 1));
|
||||
cur_pt.y = MIN(p1->y, (int16)(ds->buf_h - 1));
|
||||
|
||||
cur_pt.x -= R_CURSOR_ORIGIN_X;
|
||||
cur_pt.y -= R_CURSOR_ORIGIN_Y;
|
||||
|
||||
//Clip cursor to surface
|
||||
cur_rect.left = 0;
|
||||
cur_rect.top = 0;
|
||||
cur_rect.right = R_CURSOR_W - 1;
|
||||
cur_rect.bottom = R_CURSOR_H - 1;
|
||||
|
||||
ci.dst_rect = &ds->clip_rect;
|
||||
ci.src_rect = &cur_rect;
|
||||
ci.dst_pt = &cur_pt;
|
||||
|
||||
GFX_GetClipInfo(&ci);
|
||||
|
||||
src_p = cursor_img + ci.src_draw_x + (ci.src_draw_y * R_CURSOR_W);
|
||||
dst_p = ds->buf + ci.dst_draw_x + (ci.dst_draw_y * ds->buf_pitch);
|
||||
|
||||
src_skip = R_CURSOR_W - ci.draw_w;
|
||||
dst_skip = ds->buf_pitch - ci.draw_w;
|
||||
|
||||
for (y = 0; y < ci.draw_h; y++) {
|
||||
for (x = 0; x < ci.draw_w; x++) {
|
||||
if (*src_p != 0) {
|
||||
*dst_p = *src_p;
|
||||
}
|
||||
|
||||
dst_p++;
|
||||
src_p++;
|
||||
}
|
||||
|
||||
src_p += src_skip;
|
||||
dst_p += dst_skip;
|
||||
}
|
||||
|
||||
return R_SUCCESS;
|
||||
|
||||
}
|
||||
|
||||
// Fills a rectangle in the surface ds from point 'p1' to point 'p2' using
|
||||
// the specified color.
|
||||
int GFX_DrawRect(R_SURFACE *ds, R_RECT *dst_rect, int color) {
|
||||
|
@ -963,6 +901,32 @@ int GFX_SetPalette(R_SURFACE *surface, PALENTRY *pal) {
|
|||
}
|
||||
}
|
||||
|
||||
// When the palette changes, make sure the cursor colours are still
|
||||
// correct. We may have to reconsider this code later, but for now
|
||||
// there is only one cursor image.
|
||||
|
||||
if (GfxModule.white_index != best_windex) {
|
||||
// Set up the mouse cursor
|
||||
static byte cursor_img[R_CURSOR_W * R_CURSOR_H] = {
|
||||
0, 0, 0, 255, 0, 0, 0,
|
||||
0, 0, 0, 255, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0,
|
||||
255, 255, 0, 0, 0, 255, 255,
|
||||
0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 255, 0, 0, 0,
|
||||
0, 0, 0, 255, 0, 0, 0
|
||||
};
|
||||
|
||||
for (i = 0; i < R_CURSOR_W * R_CURSOR_H; i++) {
|
||||
if (cursor_img[i] == 0)
|
||||
cursor_img[i] = 255;
|
||||
else if (cursor_img[i] == 255)
|
||||
cursor_img[i] = best_windex;
|
||||
}
|
||||
|
||||
_system->setMouseCursor(cursor_img, R_CURSOR_W, R_CURSOR_H, 4, 4);
|
||||
}
|
||||
|
||||
// Set whitest and blackest color indices
|
||||
GfxModule.white_index = best_windex;
|
||||
GfxModule.black_index = best_bindex;
|
||||
|
|
|
@ -49,7 +49,6 @@ int GFX_DrawPalette(R_SURFACE *dst_s);
|
|||
int GFX_BufToSurface(R_SURFACE *ds, const byte *src, int src_w, int src_h, R_RECT *src_rect, R_POINT *dst_pt);
|
||||
int GFX_BufToBuffer(byte * dst_buf, int dst_w, int dst_h, const byte *src,
|
||||
int src_w, int src_h, R_RECT *src_rect, R_POINT *dst_pt);
|
||||
int GFX_DrawCursor(R_SURFACE *ds, R_POINT *p1);
|
||||
int GFX_DrawRect(R_SURFACE *ds, R_RECT *dst_rect, int color);
|
||||
int GFX_DrawFrame(R_SURFACE *ds, R_POINT *p1, R_POINT *p2, int color);
|
||||
int GFX_DrawPolyLine(R_SURFACE *ds, R_POINT *pts, int pt_ct, int draw_color);
|
||||
|
|
|
@ -53,14 +53,6 @@ static OSystem *_system;
|
|||
const char *test_txt = "The quick brown fox jumped over the lazy dog. She sells sea shells down by the sea shore.";
|
||||
|
||||
int RENDER_Register() {
|
||||
// Register "r_softcursor" cfg cvar
|
||||
RenderModule.r_softcursor = R_SOFTCURSOR_DEFAULT;
|
||||
|
||||
if (CVAR_Register_I(&RenderModule.r_softcursor,
|
||||
"r_softcursor", NULL, R_CVAR_CFG, 0, 1) != R_SUCCESS) {
|
||||
return R_FAILURE;
|
||||
}
|
||||
|
||||
return R_SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -105,11 +97,6 @@ int RENDER_Init(OSystem *system) {
|
|||
|
||||
RenderModule.r_backbuf_surface = GFX_GetBackBuffer();
|
||||
|
||||
// Initialize cursor state
|
||||
if (RenderModule.r_softcursor) {
|
||||
SYSINPUT_HideMouse();
|
||||
}
|
||||
|
||||
_system = system;
|
||||
RenderModule.initialized = 1;
|
||||
|
||||
|
@ -186,10 +173,6 @@ int RENDER_DrawScene() {
|
|||
|
||||
INTERFACE_Update(&mouse_pt, UPDATE_MOUSEMOVE);
|
||||
|
||||
if (RenderModule.r_softcursor) {
|
||||
GFX_DrawCursor(backbuf_surface, &mouse_pt);
|
||||
}
|
||||
|
||||
// Display text formatting test, if applicable
|
||||
if (RenderModule.r_flags & RF_TEXT_TEST) {
|
||||
TEXT_Draw(MEDIUM_FONT_ID, backbuf_surface, test_txt, mouse_pt.x, mouse_pt.y,
|
||||
|
|
|
@ -32,17 +32,12 @@ namespace Saga {
|
|||
#define R_FULLSCREEN_DEFAULT 0
|
||||
#define R_DOUBLERES_DEFAULT 1
|
||||
#define R_HICOLOR_DEFAULT 1
|
||||
#define R_SOFTCURSOR_DEFAULT 1
|
||||
|
||||
#define R_PAUSEGAME_MSG "PAWS GAME"
|
||||
|
||||
struct R_RENDER_MODULE {
|
||||
int initialized;
|
||||
|
||||
// Init cvars
|
||||
int r_fullscreen;
|
||||
int r_softcursor;
|
||||
|
||||
// Module data
|
||||
R_SURFACE *r_backbuf_surface;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue