summaryrefslogtreecommitdiffstats
path: root/minui/graphics.cpp
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2015-04-10 22:57:37 +0200
committerGerrit Code Review <noreply-gerritcodereview@google.com>2015-04-10 22:57:37 +0200
commit23017c5d5c145a1040ee49466d30489d6e11bb61 (patch)
treedbb3c6ea45cb910397cec50054460d46c99b454f /minui/graphics.cpp
parentMerge "Fix ScreenRecoveryUI to handle devices without power/up/down." (diff)
parentSwitch minui over to C++. (diff)
downloadandroid_bootable_recovery-23017c5d5c145a1040ee49466d30489d6e11bb61.tar
android_bootable_recovery-23017c5d5c145a1040ee49466d30489d6e11bb61.tar.gz
android_bootable_recovery-23017c5d5c145a1040ee49466d30489d6e11bb61.tar.bz2
android_bootable_recovery-23017c5d5c145a1040ee49466d30489d6e11bb61.tar.lz
android_bootable_recovery-23017c5d5c145a1040ee49466d30489d6e11bb61.tar.xz
android_bootable_recovery-23017c5d5c145a1040ee49466d30489d6e11bb61.tar.zst
android_bootable_recovery-23017c5d5c145a1040ee49466d30489d6e11bb61.zip
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;