mirror of
https://github.com/OpenDriver2/REDRIVER2.git
synced 2024-11-22 02:12:43 +01:00
- [Psy-X] added GR_ClearVRAM to separate from GR_Clear
This commit is contained in:
parent
2524968f6a
commit
5ee512e200
@ -191,6 +191,7 @@ extern void GR_SetWireframe(int enable);
|
||||
|
||||
extern void GR_DestroyTexture(TextureID texture);
|
||||
extern void GR_Clear(int x, int y, int w, int h, unsigned char r, unsigned char g, unsigned char b);
|
||||
extern void GR_ClearVRAM(int x, int y, int w, int h, unsigned char r, unsigned char g, unsigned char b);
|
||||
extern void GR_UpdateVertexBuffer(const GrVertex* vertices, int count);
|
||||
extern void GR_DrawTriangles(int start_vertex, int triangles);
|
||||
|
||||
|
@ -27,12 +27,18 @@ void(*drawsync_callback)(void) = NULL;
|
||||
|
||||
int ClearImage(RECT16* rect, u_char r, u_char g, u_char b)
|
||||
{
|
||||
GR_ClearVRAM(rect->x, rect->y, rect->w, rect->h, r, g, b);
|
||||
|
||||
// TODO: clear all affected backbuffers
|
||||
GR_Clear(rect->x, rect->y, rect->w, rect->h, r, g, b);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int ClearImage2(RECT16* rect, u_char r, u_char g, u_char b)
|
||||
{
|
||||
GR_ClearVRAM(rect->x, rect->y, rect->w, rect->h, r, g, b);
|
||||
|
||||
// TODO: clear all affected backbuffers
|
||||
GR_Clear(rect->x, rect->y, rect->w, rect->h, r, g, b);
|
||||
return 0;
|
||||
}
|
||||
|
@ -1326,30 +1326,34 @@ void GR_DestroyTexture(TextureID texture)
|
||||
#endif
|
||||
}
|
||||
|
||||
void GR_Clear(int x, int y, int w, int h, unsigned char r, unsigned char g, unsigned char b)
|
||||
void GR_ClearVRAM(int x, int y, int w, int h, unsigned char r, unsigned char g, unsigned char b)
|
||||
{
|
||||
vram_need_update = 1;
|
||||
framebuffer_need_update = 1;
|
||||
|
||||
u_short* dst = vram + x + y * VRAM_WIDTH;
|
||||
|
||||
if (x+w > VRAM_WIDTH)
|
||||
if (x + w > VRAM_WIDTH)
|
||||
w = VRAM_WIDTH - x;
|
||||
|
||||
if (y+h > VRAM_HEIGHT)
|
||||
h = VRAM_HEIGHT-y;
|
||||
if (y + h > VRAM_HEIGHT)
|
||||
h = VRAM_HEIGHT - y;
|
||||
|
||||
// clear VRAM region with given color
|
||||
for (int i = 0; i < h; i++)
|
||||
for (int i = 0; i < h; i++)
|
||||
{
|
||||
u_short* tmp = dst;
|
||||
|
||||
|
||||
for (int j = 0; j < w; j++)
|
||||
*tmp++ = r | (g << 5) | (b << 11);
|
||||
|
||||
dst += VRAM_WIDTH;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void GR_Clear(int x, int y, int w, int h, unsigned char r, unsigned char g, unsigned char b)
|
||||
{
|
||||
framebuffer_need_update = 1;
|
||||
|
||||
#if defined(USE_OPENGL)
|
||||
glClearColor(r / 255.0f, g / 255.0f, b / 255.0f, 1.0f);
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
|
Loading…
Reference in New Issue
Block a user