shithub: cstory

Download patch

ref: ce8b5651bc33720a4f34309c81d0b12d7ce5791e
parent: 64598dc2a57256eb079b96348dea8aa024abbb90
author: Clownacy <Clownacy@users.noreply.github.com>
date: Wed Aug 21 12:25:02 EDT 2019

Give the FONT_PIXEL_MODE enums a type

--- a/src/Backends/Rendering.h
+++ b/src/Backends/Rendering.h
@@ -4,12 +4,12 @@
 
 #include "../WindowsWrapper.h"
 
-enum
+typedef enum FontPixelMode
 {
 	FONT_PIXEL_MODE_LCD,
 	FONT_PIXEL_MODE_GRAY,
 	FONT_PIXEL_MODE_MONO,
-};
+} FontPixelMode;
 
 typedef struct Backend_Surface Backend_Surface;
 typedef struct Backend_Glyph Backend_Glyph;
@@ -25,7 +25,7 @@
 void Backend_Blit(Backend_Surface *source_surface, const RECT *rect, Backend_Surface *destination_surface, 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);
 BOOL Backend_SupportsSubpixelGlyphs(void);
-Backend_Glyph* Backend_LoadGlyph(const unsigned char *pixels, unsigned int width, unsigned int height, int pitch, unsigned char pixel_mode);
+Backend_Glyph* Backend_LoadGlyph(const unsigned char *pixels, unsigned int width, unsigned int height, int pitch, FontPixelMode 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_HandleDeviceLoss(void);
--- a/src/Backends/Rendering/OpenGL3.cpp
+++ b/src/Backends/Rendering/OpenGL3.cpp
@@ -628,7 +628,7 @@
 	return TRUE;
 }
 
-Backend_Glyph* Backend_LoadGlyph(const unsigned char *pixels, unsigned int width, unsigned int height, int pitch, unsigned char pixel_mode)
+Backend_Glyph* Backend_LoadGlyph(const unsigned char *pixels, unsigned int width, unsigned int height, int pitch, FontPixelMode pixel_mode)
 {
 	Backend_Glyph *glyph = (Backend_Glyph*)malloc(sizeof(Backend_Glyph));
 
--- a/src/Backends/Rendering/SDLSurface.cpp
+++ b/src/Backends/Rendering/SDLSurface.cpp
@@ -142,7 +142,7 @@
 	return FALSE;	// SDL_Surfaces don't have per-component alpha
 }
 
-Backend_Glyph* Backend_LoadGlyph(const unsigned char *pixels, unsigned int width, unsigned int height, int pitch, unsigned char pixel_mode)
+Backend_Glyph* Backend_LoadGlyph(const unsigned char *pixels, unsigned int width, unsigned int height, int pitch, FontPixelMode pixel_mode)
 {
 	Backend_Glyph *glyph = (Backend_Glyph*)malloc(sizeof(Backend_Glyph));
 
@@ -159,7 +159,9 @@
 
 	switch (pixel_mode)
 	{
-		// FONT_PIXEL_MODE_LCD is unsupported
+		case FONT_PIXEL_MODE_LCD:
+			// Unsupported
+			break;
 
 		case FONT_PIXEL_MODE_GRAY:
 			for (unsigned int y = 0; y < height; ++y)
--- a/src/Backends/Rendering/SDLTexture.cpp
+++ b/src/Backends/Rendering/SDLTexture.cpp
@@ -205,7 +205,7 @@
 	return FALSE;	// SDL_Textures don't have per-component alpha
 }
 
-Backend_Glyph* Backend_LoadGlyph(const unsigned char *pixels, unsigned int width, unsigned int height, int pitch, unsigned char pixel_mode)
+Backend_Glyph* Backend_LoadGlyph(const unsigned char *pixels, unsigned int width, unsigned int height, int pitch, FontPixelMode pixel_mode)
 {
 	Backend_Glyph *glyph = (Backend_Glyph*)malloc(sizeof(Backend_Glyph));
 
@@ -233,7 +233,9 @@
 
 	switch (pixel_mode)
 	{
-		// FONT_PIXEL_MODE_LCD is unsupported
+		case FONT_PIXEL_MODE_LCD:
+			// Unsupported
+			break;
 
 		case FONT_PIXEL_MODE_GRAY:
 
--- a/src/Backends/Rendering/Software.cpp
+++ b/src/Backends/Rendering/Software.cpp
@@ -26,7 +26,7 @@
 	void *pixels;
 	unsigned int width;
 	unsigned int height;
-	unsigned char pixel_mode;
+	FontPixelMode pixel_mode;
 } Backend_Glyph;
 
 static SDL_Window *window;
@@ -260,7 +260,7 @@
 	return TRUE;	// It's a software renderer, baby
 }
 
-Backend_Glyph* Backend_LoadGlyph(const unsigned char *pixels, unsigned int width, unsigned int height, int pitch, unsigned char pixel_mode)
+Backend_Glyph* Backend_LoadGlyph(const unsigned char *pixels, unsigned int width, unsigned int height, int pitch, FontPixelMode pixel_mode)
 {
 	Backend_Glyph *glyph = (Backend_Glyph*)malloc(sizeof(Backend_Glyph));
 
--- a/src/Font.cpp
+++ b/src/Font.cpp
@@ -987,7 +987,7 @@
 		FT_Bitmap_New(&bitmap);
 		FT_Bitmap_Convert(font_object->library, &font_object->face->glyph->bitmap, &bitmap, 1);
 
-		unsigned char pixel_mode;
+		FontPixelMode pixel_mode;
 		switch (font_object->face->glyph->bitmap.pixel_mode)
 		{
 			case FT_PIXEL_MODE_LCD: