shithub: cstory

Download patch

ref: 83e8320d84837fef22005bdf22535c5132c4d6b1
parent: 5c6b71e3a1b2f09155ea04263c268e3279e5c943
author: Clownacy <Clownacy@users.noreply.github.com>
date: Thu Sep 17 14:26:32 EDT 2020

Fix other renderers

--- a/src/Backends/Rendering/SDLSurface.cpp
+++ b/src/Backends/Rendering/SDLSurface.cpp
@@ -207,14 +207,13 @@
 	free(atlas);
 }
 
-void RenderBackend_UploadGlyph(RenderBackend_GlyphAtlas *atlas, size_t x, size_t y, const unsigned char *pixels, size_t width, size_t height)
+void RenderBackend_UploadGlyph(RenderBackend_GlyphAtlas *atlas, size_t x, size_t y, const unsigned char *pixels, size_t width, size_t height, size_t pitch)
 {
 	SDL_LockSurface(atlas->sdlsurface);
 
-	const unsigned char *source_pointer = pixels;
-
 	for (size_t iy = 0; iy < height; ++iy)
 	{
+		const unsigned char *source_pointer = &pixels[iy * pitch];
 		unsigned char *destination_pointer = &((unsigned char*)atlas->sdlsurface->pixels)[(y + iy) * atlas->sdlsurface->pitch + x * 4];
 
 		for (size_t ix = 0; ix < width; ++ix)
--- a/src/Backends/Rendering/Software.cpp
+++ b/src/Backends/Rendering/Software.cpp
@@ -265,10 +265,10 @@
 	free(atlas);
 }
 
-void RenderBackend_UploadGlyph(RenderBackend_GlyphAtlas *atlas, size_t x, size_t y, const unsigned char *pixels, size_t width, size_t height)
+void RenderBackend_UploadGlyph(RenderBackend_GlyphAtlas *atlas, size_t x, size_t y, const unsigned char *pixels, size_t width, size_t height, size_t pitch)
 {
 	for (size_t i = 0; i < height; ++i)
-		memcpy(&atlas->pixels[(y + i) * atlas->width + x], &pixels[i * width], width);
+		memcpy(&atlas->pixels[(y + i) * atlas->width + x], &pixels[i * pitch], width);
 }
 
 void RenderBackend_PrepareToDrawGlyphs(RenderBackend_GlyphAtlas *atlas, RenderBackend_Surface *destination_surface, unsigned char red, unsigned char green, unsigned char blue)
--- a/src/Backends/Rendering/WiiU.cpp
+++ b/src/Backends/Rendering/WiiU.cpp
@@ -754,7 +754,7 @@
 	free(atlas);
 }
 
-void RenderBackend_UploadGlyph(RenderBackend_GlyphAtlas *atlas, size_t x, size_t y, const unsigned char *pixels, size_t width, size_t height)
+void RenderBackend_UploadGlyph(RenderBackend_GlyphAtlas *atlas, size_t x, size_t y, const unsigned char *pixels, size_t width, size_t height, size_t pitch)
 {
 	unsigned char *buffer = (unsigned char*)GX2RLockSurfaceEx(&atlas->texture.surface, 0, (GX2RResourceFlags)0);
 
@@ -765,7 +765,7 @@
 	{
 		memcpy(out_pointer, in_pointer, width);
 
-		in_pointer += width;
+		in_pointer += pitch;
 		out_pointer += atlas->texture.surface.pitch;
 	}