diff --git a/src/Backends/Rendering.h b/src/Backends/Rendering.h index fb1689bd..b411934e 100644 --- a/src/Backends/Rendering.h +++ b/src/Backends/Rendering.h @@ -22,7 +22,7 @@ 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, BOOL colour_key); +void Backend_Blit(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_ColourFillToScreen(const RECT *rect, unsigned char red, unsigned char green, unsigned char blue); diff --git a/src/Backends/Rendering/OpenGL3.cpp b/src/Backends/Rendering/OpenGL3.cpp index 76d03099..1b9acb2f 100644 --- a/src/Backends/Rendering/OpenGL3.cpp +++ b/src/Backends/Rendering/OpenGL3.cpp @@ -565,9 +565,9 @@ 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, BOOL colour_key) +void Backend_Blit(Backend_Surface *source_surface, const RECT *rect, Backend_Surface *destination_surface, long x, long y) { - BlitCommon(source_surface, rect, destination_surface, x, y, colour_key); + BlitCommon(source_surface, rect, destination_surface, x, y, TRUE); } void Backend_BlitToScreen(Backend_Surface *source_surface, const RECT *rect, long x, long y, BOOL colour_key) diff --git a/src/Backends/Rendering/SDLSurface.cpp b/src/Backends/Rendering/SDLSurface.cpp index 4eb918df..d08317d4 100644 --- a/src/Backends/Rendering/SDLSurface.cpp +++ b/src/Backends/Rendering/SDLSurface.cpp @@ -109,7 +109,7 @@ void Backend_Unlock(Backend_Surface *surface) (void)surface; } -void Backend_Blit(Backend_Surface *source_surface, const RECT *rect, Backend_Surface *destination_surface, long x, long y, BOOL colour_key) +static void BlitCommon(Backend_Surface *source_surface, const RECT *rect, Backend_Surface *destination_surface, long x, long y, BOOL colour_key) { if (source_surface == NULL || destination_surface == NULL) return; @@ -128,9 +128,14 @@ void Backend_Blit(Backend_Surface *source_surface, const RECT *rect, Backend_Sur 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) +{ + BlitCommon(source_surface, rect, &framebuffer, x, y, TRUE); +} + void Backend_BlitToScreen(Backend_Surface *source_surface, const RECT *rect, long x, long y, BOOL colour_key) { - Backend_Blit(source_surface, rect, &framebuffer, x, y, colour_key); + 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) @@ -151,7 +156,7 @@ void Backend_ColourFillToScreen(const RECT *rect, unsigned char red, unsigned ch void Backend_ScreenToSurface(Backend_Surface *surface, const RECT *rect) { - Backend_Blit(&framebuffer, rect, surface, rect->left, rect->top, FALSE); + BlitCommon(&framebuffer, rect, surface, rect->left, rect->top, FALSE); } BOOL Backend_SupportsSubpixelGlyph(void) diff --git a/src/Backends/Rendering/SDLTexture.cpp b/src/Backends/Rendering/SDLTexture.cpp index eb334de6..339901df 100644 --- a/src/Backends/Rendering/SDLTexture.cpp +++ b/src/Backends/Rendering/SDLTexture.cpp @@ -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, BOOL colour_key) +void Backend_Blit(Backend_Surface *source_surface, const RECT *rect, Backend_Surface *destination_surface, long x, long y) { if (source_surface == NULL || destination_surface == NULL) return; @@ -210,11 +210,11 @@ void Backend_Blit(Backend_Surface *source_surface, const RECT *rect, Backend_Sur SDL_Rect destination_rect = {(int)x, (int)y, source_rect.w, source_rect.h}; // Blit the surface - SDL_SetSurfaceBlendMode(source_surface->sdl_surface, colour_key ? SDL_BLENDMODE_BLEND : SDL_BLENDMODE_NONE); + SDL_SetSurfaceBlendMode(source_surface->sdl_surface, SDL_BLENDMODE_BLEND); SDL_BlitSurface(source_surface->sdl_surface, &source_rect, destination_surface->sdl_surface, &destination_rect); // Now blit the texture - SDL_SetTextureBlendMode(source_surface->texture, colour_key ? SDL_BLENDMODE_BLEND : SDL_BLENDMODE_NONE); + SDL_SetTextureBlendMode(source_surface->texture, SDL_BLENDMODE_BLEND); SDL_SetRenderTarget(renderer, destination_surface->texture); SDL_RenderCopy(renderer, source_surface->texture, &source_rect, &destination_rect); SDL_SetRenderTarget(renderer, screen_texture); diff --git a/src/Backends/Rendering/Software.cpp b/src/Backends/Rendering/Software.cpp index 179036eb..3dfd2791 100644 --- a/src/Backends/Rendering/Software.cpp +++ b/src/Backends/Rendering/Software.cpp @@ -115,7 +115,7 @@ void Backend_Unlock(Backend_Surface *surface) (void)surface; } -void Backend_Blit(Backend_Surface *source_surface, const RECT *rect, Backend_Surface *destination_surface, long x, long y, BOOL colour_key) +static void BlitCommon(Backend_Surface *source_surface, const RECT *rect, Backend_Surface *destination_surface, long x, long y, BOOL colour_key) { if (source_surface == NULL || destination_surface == NULL) return; @@ -198,9 +198,14 @@ void Backend_Blit(Backend_Surface *source_surface, const RECT *rect, Backend_Sur } } +void Backend_Blit(Backend_Surface *source_surface, const RECT *rect, Backend_Surface *destination_surface, long x, long y) +{ + BlitCommon(source_surface, rect, &framebuffer, x, y, TRUE); +} + void Backend_BlitToScreen(Backend_Surface *source_surface, const RECT *rect, long x, long y, BOOL colour_key) { - Backend_Blit(source_surface, rect, &framebuffer, x, y, colour_key); + 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) @@ -268,7 +273,7 @@ void Backend_ColourFillToScreen(const RECT *rect, unsigned char red, unsigned ch void Backend_ScreenToSurface(Backend_Surface *surface, const RECT *rect) { - Backend_Blit(&framebuffer, rect, surface, rect->left, rect->top, FALSE); + BlitCommon(&framebuffer, rect, surface, rect->left, rect->top, FALSE); } BOOL Backend_SupportsSubpixelGlyph(void) diff --git a/src/Draw.cpp b/src/Draw.cpp index 040c9e24..2dd50633 100644 --- a/src/Draw.cpp +++ b/src/Draw.cpp @@ -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, TRUE); + Backend_Blit(surf[from].backend, &frameRect, surf[to].backend, x * magnification, y * magnification); } unsigned long GetCortBoxColor(unsigned long col)