Give the FONT_PIXEL_MODE enums a type

This commit is contained in:
Clownacy 2019-08-21 16:25:02 +00:00
parent 64598dc2a5
commit ce8b5651bc
6 changed files with 15 additions and 11 deletions

View file

@ -4,12 +4,12 @@
#include "../WindowsWrapper.h" #include "../WindowsWrapper.h"
enum typedef enum FontPixelMode
{ {
FONT_PIXEL_MODE_LCD, FONT_PIXEL_MODE_LCD,
FONT_PIXEL_MODE_GRAY, FONT_PIXEL_MODE_GRAY,
FONT_PIXEL_MODE_MONO, FONT_PIXEL_MODE_MONO,
}; } FontPixelMode;
typedef struct Backend_Surface Backend_Surface; typedef struct Backend_Surface Backend_Surface;
typedef struct Backend_Glyph Backend_Glyph; typedef struct Backend_Glyph Backend_Glyph;
@ -25,7 +25,7 @@ void Backend_UnlockSurface(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, BOOL colour_key);
void Backend_ColourFill(Backend_Surface *surface, const RECT *rect, unsigned char red, unsigned char green, unsigned char blue); void Backend_ColourFill(Backend_Surface *surface, const RECT *rect, unsigned char red, unsigned char green, unsigned char blue);
BOOL Backend_SupportsSubpixelGlyphs(void); 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_UnloadGlyph(Backend_Glyph *glyph);
void Backend_DrawGlyph(Backend_Surface *surface, Backend_Glyph *glyph, long x, long y, const unsigned char *colours); void Backend_DrawGlyph(Backend_Surface *surface, Backend_Glyph *glyph, long x, long y, const unsigned char *colours);
void Backend_HandleDeviceLoss(void); void Backend_HandleDeviceLoss(void);

View file

@ -628,7 +628,7 @@ BOOL Backend_SupportsSubpixelGlyphs(void)
return TRUE; 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)); Backend_Glyph *glyph = (Backend_Glyph*)malloc(sizeof(Backend_Glyph));

View file

@ -142,7 +142,7 @@ BOOL Backend_SupportsSubpixelGlyphs(void)
return FALSE; // SDL_Surfaces don't have per-component alpha 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)); Backend_Glyph *glyph = (Backend_Glyph*)malloc(sizeof(Backend_Glyph));
@ -159,7 +159,9 @@ Backend_Glyph* Backend_LoadGlyph(const unsigned char *pixels, unsigned int width
switch (pixel_mode) switch (pixel_mode)
{ {
// FONT_PIXEL_MODE_LCD is unsupported case FONT_PIXEL_MODE_LCD:
// Unsupported
break;
case FONT_PIXEL_MODE_GRAY: case FONT_PIXEL_MODE_GRAY:
for (unsigned int y = 0; y < height; ++y) for (unsigned int y = 0; y < height; ++y)

View file

@ -205,7 +205,7 @@ BOOL Backend_SupportsSubpixelGlyphs(void)
return FALSE; // SDL_Textures don't have per-component alpha 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)); Backend_Glyph *glyph = (Backend_Glyph*)malloc(sizeof(Backend_Glyph));
@ -233,7 +233,9 @@ Backend_Glyph* Backend_LoadGlyph(const unsigned char *pixels, unsigned int width
switch (pixel_mode) switch (pixel_mode)
{ {
// FONT_PIXEL_MODE_LCD is unsupported case FONT_PIXEL_MODE_LCD:
// Unsupported
break;
case FONT_PIXEL_MODE_GRAY: case FONT_PIXEL_MODE_GRAY:

View file

@ -26,7 +26,7 @@ typedef struct Backend_Glyph
void *pixels; void *pixels;
unsigned int width; unsigned int width;
unsigned int height; unsigned int height;
unsigned char pixel_mode; FontPixelMode pixel_mode;
} Backend_Glyph; } Backend_Glyph;
static SDL_Window *window; static SDL_Window *window;
@ -260,7 +260,7 @@ BOOL Backend_SupportsSubpixelGlyphs(void)
return TRUE; // It's a software renderer, baby 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)); Backend_Glyph *glyph = (Backend_Glyph*)malloc(sizeof(Backend_Glyph));

View file

@ -987,7 +987,7 @@ static CachedGlyph* GetGlyphCached(FontObject *font_object, unsigned long unicod
FT_Bitmap_New(&bitmap); FT_Bitmap_New(&bitmap);
FT_Bitmap_Convert(font_object->library, &font_object->face->glyph->bitmap, &bitmap, 1); 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) switch (font_object->face->glyph->bitmap.pixel_mode)
{ {
case FT_PIXEL_MODE_LCD: case FT_PIXEL_MODE_LCD: