summaryrefslogtreecommitdiffstats
path: root/minui/graphics.cpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--minui/graphics.cpp (renamed from minui/graphics.c)12
1 files changed, 6 insertions, 6 deletions
diff --git a/minui/graphics.c b/minui/graphics.cpp
index 9d1e1b480..d7d6e8d5a 100644
--- a/minui/graphics.c
+++ b/minui/graphics.cpp
@@ -35,11 +35,11 @@
#include "minui.h"
#include "graphics.h"
-typedef struct {
+struct GRFont {
GRSurface* texture;
int cwidth;
int cheight;
-} GRFont;
+};
static GRFont* gr_font = NULL;
static minui_backend* gr_backend = NULL;
@@ -269,7 +269,7 @@ unsigned int gr_get_height(GRSurface* surface) {
static void gr_init_font(void)
{
- gr_font = calloc(sizeof(*gr_font), 1);
+ gr_font = reinterpret_cast<GRFont*>(calloc(sizeof(*gr_font), 1));
int res = res_create_alpha_surface("font", &(gr_font->texture));
if (res == 0) {
@@ -282,14 +282,14 @@ static void gr_init_font(void)
printf("failed to read font: res=%d\n", res);
// fall back to the compiled-in font.
- gr_font->texture = malloc(sizeof(*gr_font->texture));
+ gr_font->texture = reinterpret_cast<GRSurface*>(malloc(sizeof(*gr_font->texture)));
gr_font->texture->width = font.width;
gr_font->texture->height = font.height;
gr_font->texture->row_bytes = font.width;
gr_font->texture->pixel_bytes = 1;
- unsigned char* bits = malloc(font.width * font.height);
- gr_font->texture->data = (void*) bits;
+ unsigned char* bits = reinterpret_cast<unsigned char*>(malloc(font.width * font.height));
+ gr_font->texture->data = reinterpret_cast<unsigned char*>(bits);
unsigned char data;
unsigned char* in = font.rundata;