summaryrefslogtreecommitdiffstats
path: root/minui/graphics.cpp
diff options
context:
space:
mode:
authorTianjie Xu <xunchang@google.com>2018-06-01 03:16:28 +0200
committerTianjie Xu <xunchang@google.com>2018-06-01 06:42:58 +0200
commit842f2a3dca26cb6e91ef531d363d8f68c0f2f5ab (patch)
tree59dd3456f9fbb431445b0adc6001db7d9d7d6672 /minui/graphics.cpp
parentMerge "updater: Drop the 'blocks' parameter in LoadStash()." (diff)
downloadandroid_bootable_recovery-842f2a3dca26cb6e91ef531d363d8f68c0f2f5ab.tar
android_bootable_recovery-842f2a3dca26cb6e91ef531d363d8f68c0f2f5ab.tar.gz
android_bootable_recovery-842f2a3dca26cb6e91ef531d363d8f68c0f2f5ab.tar.bz2
android_bootable_recovery-842f2a3dca26cb6e91ef531d363d8f68c0f2f5ab.tar.lz
android_bootable_recovery-842f2a3dca26cb6e91ef531d363d8f68c0f2f5ab.tar.xz
android_bootable_recovery-842f2a3dca26cb6e91ef531d363d8f68c0f2f5ab.tar.zst
android_bootable_recovery-842f2a3dca26cb6e91ef531d363d8f68c0f2f5ab.zip
Diffstat (limited to 'minui/graphics.cpp')
-rw-r--r--minui/graphics.cpp15
1 files changed, 12 insertions, 3 deletions
diff --git a/minui/graphics.cpp b/minui/graphics.cpp
index 202ce71fd..3b386015a 100644
--- a/minui/graphics.cpp
+++ b/minui/graphics.cpp
@@ -51,12 +51,21 @@ const GRFont* gr_sys_font() {
}
int gr_measure(const GRFont* font, const char* s) {
+ if (font == nullptr) {
+ return -1;
+ }
+
return font->char_width * strlen(s);
}
-void gr_font_size(const GRFont* font, int* x, int* y) {
+int gr_font_size(const GRFont* font, int* x, int* y) {
+ if (font == nullptr) {
+ return -1;
+ }
+
*x = font->char_width;
*y = font->char_height;
+ return 0;
}
// Blends gr_current onto pix value, assumes alpha as most significant byte.
@@ -319,8 +328,8 @@ void gr_flip() {
int gr_init() {
int ret = gr_init_font("font", &gr_font);
if (ret != 0) {
- printf("Failed to init font: %d\n", ret);
- return -1;
+ printf("Failed to init font: %d, continuing graphic backend initialization without font file\n",
+ ret);
}
auto backend = std::unique_ptr<MinuiBackend>{ std::make_unique<MinuiBackendAdf>() };