Rendering backend API naming improvements

This commit is contained in:
Clownacy 2019-08-10 19:50:10 +01:00
parent 2b86db32a0
commit 85f58d7d39
7 changed files with 34 additions and 34 deletions

View file

@ -20,17 +20,17 @@ void Backend_Deinit(void);
void Backend_DrawScreen(void);
Backend_Surface* Backend_CreateSurface(unsigned int width, unsigned int height);
void Backend_FreeSurface(Backend_Surface *surface);
unsigned char* Backend_Lock(Backend_Surface *surface, unsigned int *pitch);
void Backend_Unlock(Backend_Surface *surface);
void Backend_Blit(Backend_Surface *source_surface, const RECT *rect, Backend_Surface *destination_surface, long x, long y);
unsigned char* Backend_LockSurface(Backend_Surface *surface, unsigned int *pitch);
void Backend_UnlockSurface(Backend_Surface *surface);
void Backend_BlitToSurface(Backend_Surface *source_surface, const RECT *rect, Backend_Surface *destination_surface, long x, long y);
void Backend_BlitToScreen(Backend_Surface *source_surface, const RECT *rect, long x, long y, BOOL colour_key);
void Backend_ColourFill(Backend_Surface *surface, const RECT *rect, unsigned char red, unsigned char green, unsigned char blue);
void Backend_ColourFillToSurface(Backend_Surface *surface, const RECT *rect, unsigned char red, unsigned char green, unsigned char blue);
void Backend_ColourFillToScreen(const RECT *rect, unsigned char red, unsigned char green, unsigned char blue);
void Backend_ScreenToSurface(Backend_Surface *surface, const RECT *rect);
BOOL Backend_SupportsSubpixelGlyph(void);
Backend_Glyph* Backend_LoadGlyph(const unsigned char *pixels, unsigned int width, unsigned int height, int pitch, unsigned char pixel_mode);
void Backend_UnloadGlyph(Backend_Glyph *glyph);
void Backend_DrawGlyph(Backend_Surface *surface, Backend_Glyph *glyph, long x, long y, const unsigned char *colours);
void Backend_DrawGlyphToSurface(Backend_Surface *surface, Backend_Glyph *glyph, long x, long y, const unsigned char *colours);
void Backend_DrawGlyphToScreen(Backend_Glyph *glyph, long x, long y, const unsigned char *colours);
void Backend_HandleDeviceLoss(void);
void Backend_HandleWindowResize(void);

View file

@ -463,7 +463,7 @@ void Backend_FreeSurface(Backend_Surface *surface)
free(surface);
}
unsigned char* Backend_Lock(Backend_Surface *surface, unsigned int *pitch)
unsigned char* Backend_LockSurface(Backend_Surface *surface, unsigned int *pitch)
{
if (surface == NULL)
return NULL;
@ -473,7 +473,7 @@ unsigned char* Backend_Lock(Backend_Surface *surface, unsigned int *pitch)
return surface->pixels;
}
void Backend_Unlock(Backend_Surface *surface)
void Backend_UnlockSurface(Backend_Surface *surface)
{
if (surface == NULL)
return;
@ -565,7 +565,7 @@ static void BlitCommon(Backend_Surface *source_surface, const RECT *rect, Backen
vertex_buffer_slot->vertices[1][2].vertex_coordinate.y = vertex_bottom;
}
void Backend_Blit(Backend_Surface *source_surface, const RECT *rect, Backend_Surface *destination_surface, long x, long y)
void Backend_BlitToSurface(Backend_Surface *source_surface, const RECT *rect, Backend_Surface *destination_surface, long x, long y)
{
BlitCommon(source_surface, rect, destination_surface, x, y, TRUE);
}
@ -636,7 +636,7 @@ static void ColourFillCommon(Backend_Surface *surface, const RECT *rect, unsigne
vertex_buffer_slot->vertices[1][2].vertex_coordinate.y = vertex_bottom;
}
void Backend_ColourFill(Backend_Surface *surface, const RECT *rect, unsigned char red, unsigned char green, unsigned char blue)
void Backend_ColourFillToSurface(Backend_Surface *surface, const RECT *rect, unsigned char red, unsigned char green, unsigned char blue)
{
ColourFillCommon(surface, rect, red, green, blue);
}
@ -811,7 +811,7 @@ static void DrawGlyphCommon(Backend_Surface *surface, Backend_Glyph *glyph, long
vertex_buffer_slot->vertices[1][2].vertex_coordinate.y = vertex_bottom;
}
void Backend_DrawGlyph(Backend_Surface *surface, Backend_Glyph *glyph, long x, long y, const unsigned char *colours)
void Backend_DrawGlyphToSurface(Backend_Surface *surface, Backend_Glyph *glyph, long x, long y, const unsigned char *colours)
{
DrawGlyphCommon(surface, glyph, x, y, colours);
}

View file

@ -95,7 +95,7 @@ void Backend_FreeSurface(Backend_Surface *surface)
free(surface);
}
unsigned char* Backend_Lock(Backend_Surface *surface, unsigned int *pitch)
unsigned char* Backend_LockSurface(Backend_Surface *surface, unsigned int *pitch)
{
if (surface == NULL)
return NULL;
@ -104,7 +104,7 @@ unsigned char* Backend_Lock(Backend_Surface *surface, unsigned int *pitch)
return (unsigned char*)surface->sdl_surface->pixels;
}
void Backend_Unlock(Backend_Surface *surface)
void Backend_UnlockSurface(Backend_Surface *surface)
{
(void)surface;
}
@ -128,7 +128,7 @@ static void BlitCommon(Backend_Surface *source_surface, const RECT *rect, Backen
SDL_BlitSurface(source_surface->sdl_surface, &source_rect, destination_surface->sdl_surface, &destination_rect);
}
void Backend_Blit(Backend_Surface *source_surface, const RECT *rect, Backend_Surface *destination_surface, long x, long y)
void Backend_BlitToSurface(Backend_Surface *source_surface, const RECT *rect, Backend_Surface *destination_surface, long x, long y)
{
BlitCommon(source_surface, rect, &framebuffer, x, y, TRUE);
}
@ -138,7 +138,7 @@ void Backend_BlitToScreen(Backend_Surface *source_surface, const RECT *rect, lon
BlitCommon(source_surface, rect, &framebuffer, x, y, colour_key);
}
void Backend_ColourFill(Backend_Surface *surface, const RECT *rect, unsigned char red, unsigned char green, unsigned char blue)
void Backend_ColourFillToSurface(Backend_Surface *surface, const RECT *rect, unsigned char red, unsigned char green, unsigned char blue)
{
if (surface == NULL)
return;
@ -230,7 +230,7 @@ void Backend_UnloadGlyph(Backend_Glyph *glyph)
free(glyph);
}
void Backend_DrawGlyph(Backend_Surface *surface, Backend_Glyph *glyph, long x, long y, const unsigned char *colours)
void Backend_DrawGlyphToSurface(Backend_Surface *surface, Backend_Glyph *glyph, long x, long y, const unsigned char *colours)
{
if (glyph == NULL || surface == NULL)
return;

View file

@ -176,7 +176,7 @@ void Backend_FreeSurface(Backend_Surface *surface)
free(surface);
}
unsigned char* Backend_Lock(Backend_Surface *surface, unsigned int *pitch)
unsigned char* Backend_LockSurface(Backend_Surface *surface, unsigned int *pitch)
{
if (surface == NULL)
return NULL;
@ -185,7 +185,7 @@ unsigned char* Backend_Lock(Backend_Surface *surface, unsigned int *pitch)
return (unsigned char*)surface->sdl_surface->pixels;
}
void Backend_Unlock(Backend_Surface *surface)
void Backend_UnlockSurface(Backend_Surface *surface)
{
if (surface == NULL)
return;
@ -193,7 +193,7 @@ void Backend_Unlock(Backend_Surface *surface)
surface->needs_syncing = TRUE;
}
void Backend_Blit(Backend_Surface *source_surface, const RECT *rect, Backend_Surface *destination_surface, long x, long y)
void Backend_BlitToSurface(Backend_Surface *source_surface, const RECT *rect, Backend_Surface *destination_surface, long x, long y)
{
if (source_surface == NULL || destination_surface == NULL)
return;
@ -241,7 +241,7 @@ void Backend_BlitToScreen(Backend_Surface *source_surface, const RECT *rect, lon
SDL_RenderCopy(renderer, source_surface->texture, &source_rect, &destination_rect);
}
void Backend_ColourFill(Backend_Surface *surface, const RECT *rect, unsigned char red, unsigned char green, unsigned char blue)
void Backend_ColourFillToSurface(Backend_Surface *surface, const RECT *rect, unsigned char red, unsigned char green, unsigned char blue)
{
if (surface == NULL)
return;
@ -334,7 +334,7 @@ Backend_Glyph* Backend_LoadGlyph(const unsigned char *pixels, unsigned int width
}
unsigned int surface_pitch;
unsigned char *surface_pixels = Backend_Lock(glyph->surface, &surface_pitch);
unsigned char *surface_pixels = Backend_LockSurface(glyph->surface, &surface_pitch);
switch (pixel_mode)
{
@ -375,7 +375,7 @@ Backend_Glyph* Backend_LoadGlyph(const unsigned char *pixels, unsigned int width
break;
}
Backend_Unlock(glyph->surface);
Backend_UnlockSurface(glyph->surface);
return glyph;
}
@ -389,7 +389,7 @@ void Backend_UnloadGlyph(Backend_Glyph *glyph)
free(glyph);
}
void Backend_DrawGlyph(Backend_Surface *surface, Backend_Glyph *glyph, long x, long y, const unsigned char *colours)
void Backend_DrawGlyphToSurface(Backend_Surface *surface, Backend_Glyph *glyph, long x, long y, const unsigned char *colours)
{
// The SDL_Texture side of things uses alpha, not a colour-key, so the bug where the font is blended
// with the colour key doesn't occur. SDL_Textures don't support colour-keys, so the next best thing

View file

@ -101,7 +101,7 @@ void Backend_FreeSurface(Backend_Surface *surface)
free(surface);
}
unsigned char* Backend_Lock(Backend_Surface *surface, unsigned int *pitch)
unsigned char* Backend_LockSurface(Backend_Surface *surface, unsigned int *pitch)
{
if (surface == NULL)
return NULL;
@ -110,7 +110,7 @@ unsigned char* Backend_Lock(Backend_Surface *surface, unsigned int *pitch)
return surface->pixels;
}
void Backend_Unlock(Backend_Surface *surface)
void Backend_UnlockSurface(Backend_Surface *surface)
{
(void)surface;
}
@ -198,7 +198,7 @@ static void BlitCommon(Backend_Surface *source_surface, const RECT *rect, Backen
}
}
void Backend_Blit(Backend_Surface *source_surface, const RECT *rect, Backend_Surface *destination_surface, long x, long y)
void Backend_BlitToSurface(Backend_Surface *source_surface, const RECT *rect, Backend_Surface *destination_surface, long x, long y)
{
BlitCommon(source_surface, rect, &framebuffer, x, y, TRUE);
}
@ -208,7 +208,7 @@ void Backend_BlitToScreen(Backend_Surface *source_surface, const RECT *rect, lon
BlitCommon(source_surface, rect, &framebuffer, x, y, colour_key);
}
void Backend_ColourFill(Backend_Surface *surface, const RECT *rect, unsigned char red, unsigned char green, unsigned char blue)
void Backend_ColourFillToSurface(Backend_Surface *surface, const RECT *rect, unsigned char red, unsigned char green, unsigned char blue)
{
if (surface == NULL)
return;
@ -268,7 +268,7 @@ void Backend_ColourFill(Backend_Surface *surface, const RECT *rect, unsigned cha
void Backend_ColourFillToScreen(const RECT *rect, unsigned char red, unsigned char green, unsigned char blue)
{
Backend_ColourFill(&framebuffer, rect, red, green, blue);
Backend_ColourFillToSurface(&framebuffer, rect, red, green, blue);
}
void Backend_ScreenToSurface(Backend_Surface *surface, const RECT *rect)
@ -352,7 +352,7 @@ void Backend_UnloadGlyph(Backend_Glyph *glyph)
free(glyph);
}
void Backend_DrawGlyph(Backend_Surface *surface, Backend_Glyph *glyph, long x, long y, const unsigned char *colours)
void Backend_DrawGlyphToSurface(Backend_Surface *surface, Backend_Glyph *glyph, long x, long y, const unsigned char *colours)
{
if (glyph == NULL || surface == NULL)
return;
@ -421,7 +421,7 @@ void Backend_DrawGlyph(Backend_Surface *surface, Backend_Glyph *glyph, long x, l
void Backend_DrawGlyphToScreen(Backend_Glyph *glyph, long x, long y, const unsigned char *colours)
{
Backend_DrawGlyph(&framebuffer, glyph, x, y, colours);
Backend_DrawGlyphToSurface(&framebuffer, glyph, x, y, colours);
}
void Backend_HandleDeviceLoss(void)

View file

@ -217,7 +217,7 @@ static BOOL LoadBitmap(SDL_RWops *fp, Surface_Ids surf_no, BOOL create_surface)
{
// IF YOU WANT TO ADD HD SPRITES, THIS IS THE CODE YOU SHOULD EDIT
unsigned int pitch;
unsigned char *pixels = Backend_Lock(surf[surf_no].backend, &pitch);
unsigned char *pixels = Backend_LockSurface(surf[surf_no].backend, &pitch);
if (magnification == 1)
{
@ -258,7 +258,7 @@ static BOOL LoadBitmap(SDL_RWops *fp, Surface_Ids surf_no, BOOL create_surface)
}
}
Backend_Unlock(surf[surf_no].backend);
Backend_UnlockSurface(surf[surf_no].backend);
SDL_FreeSurface(converted_surface);
success = TRUE;
}
@ -421,7 +421,7 @@ void Surface2Surface(int x, int y, const RECT *rect, int to, int from)
RECT frameRect;
ScaleRect(rect, &frameRect);
Backend_Blit(surf[from].backend, &frameRect, surf[to].backend, x * magnification, y * magnification);
Backend_BlitToSurface(surf[from].backend, &frameRect, surf[to].backend, x * magnification, y * magnification);
}
unsigned long GetCortBoxColor(unsigned long col)
@ -456,7 +456,7 @@ void CortBox2(const RECT *rect, unsigned long col, Surface_Ids surf_no)
const unsigned char col_green = (unsigned char)((col >> 8) & 0xFF);
const unsigned char col_blue = (unsigned char)((col >> 16) & 0xFF);
Backend_ColourFill(surf[surf_no].backend, &destRect, col_red, col_green, col_blue);
Backend_ColourFillToSurface(surf[surf_no].backend, &destRect, col_red, col_green, col_blue);
}
#ifdef WINDOWS

View file

@ -1156,7 +1156,7 @@ void DrawText(FontObject *font_object, Backend_Surface *surface, int x, int y, u
if (glyph->backend)
{
if (surface)
Backend_DrawGlyph(surface, glyph->backend, letter_x, letter_y, colours);
Backend_DrawGlyphToSurface(surface, glyph->backend, letter_x, letter_y, colours);
else
Backend_DrawGlyphToScreen(glyph->backend, letter_x, letter_y, colours);
}