summaryrefslogtreecommitdiffstats
path: root/minui/graphics.cpp
diff options
context:
space:
mode:
authorTianjie Xu <xunchang@google.com>2018-03-30 19:53:01 +0200
committerandroid-build-merger <android-build-merger@google.com>2018-03-30 19:53:01 +0200
commitdea56f6531195314a5d36cae2b7f0e5fd56eaab7 (patch)
treed8b9159569bfd14e150cda7d6806b693e6275707 /minui/graphics.cpp
parentMerge "Specify a default module for TARGET_RECOVERY_UI_LIB." (diff)
parentMerge "Remove the obsolete mkfont.c and font_10x18.h" (diff)
downloadandroid_bootable_recovery-dea56f6531195314a5d36cae2b7f0e5fd56eaab7.tar
android_bootable_recovery-dea56f6531195314a5d36cae2b7f0e5fd56eaab7.tar.gz
android_bootable_recovery-dea56f6531195314a5d36cae2b7f0e5fd56eaab7.tar.bz2
android_bootable_recovery-dea56f6531195314a5d36cae2b7f0e5fd56eaab7.tar.lz
android_bootable_recovery-dea56f6531195314a5d36cae2b7f0e5fd56eaab7.tar.xz
android_bootable_recovery-dea56f6531195314a5d36cae2b7f0e5fd56eaab7.tar.zst
android_bootable_recovery-dea56f6531195314a5d36cae2b7f0e5fd56eaab7.zip
Diffstat (limited to 'minui/graphics.cpp')
-rw-r--r--minui/graphics.cpp37
1 files changed, 5 insertions, 32 deletions
diff --git a/minui/graphics.cpp b/minui/graphics.cpp
index 56f471bce..202ce71fd 100644
--- a/minui/graphics.cpp
+++ b/minui/graphics.cpp
@@ -23,7 +23,6 @@
#include <memory>
-#include "font_10x18.h"
#include "graphics_adf.h"
#include "graphics_drm.h"
#include "graphics_fbdev.h"
@@ -313,42 +312,16 @@ int gr_init_font(const char* name, GRFont** dest) {
return 0;
}
-static void gr_init_font(void) {
- int res = gr_init_font("font", &gr_font);
- if (res == 0) {
- return;
- }
-
- printf("failed to read font: res=%d\n", res);
-
- // fall back to the compiled-in font.
- gr_font = static_cast<GRFont*>(calloc(1, sizeof(*gr_font)));
- gr_font->texture = static_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 = static_cast<unsigned char*>(malloc(font.width * font.height));
- gr_font->texture->data = bits;
-
- unsigned char data;
- unsigned char* in = font.rundata;
- while ((data = *in++)) {
- memset(bits, (data & 0x80) ? 255 : 0, data & 0x7f);
- bits += (data & 0x7f);
- }
-
- gr_font->char_width = font.char_width;
- gr_font->char_height = font.char_height;
-}
-
void gr_flip() {
gr_draw = gr_backend->Flip();
}
int gr_init() {
- gr_init_font();
+ int ret = gr_init_font("font", &gr_font);
+ if (ret != 0) {
+ printf("Failed to init font: %d\n", ret);
+ return -1;
+ }
auto backend = std::unique_ptr<MinuiBackend>{ std::make_unique<MinuiBackendAdf>() };
gr_draw = backend->Init();