From 9acb022ab8c048ff42aacd846d75bcdd7fd3c8c7 Mon Sep 17 00:00:00 2001 From: Ricardo Cerqueira Date: Mon, 8 Nov 2010 23:54:30 +0000 Subject: [PATCH] recovery: Support board-specified font sizes and font-files This, for example, is for an LDPI device: BOARD_RECOVERY_FONT_INCLUDE_HEADER := ../../device/geeksphone/one/font_7x16.h BOARD_RECOVERY_FONT_WIDTH := 7 BOARD_RECOVERY_FONT_HEIGHT := 16 Change-Id: I71d2f420b9668b5767c9b0b5d90e3e523c56e873 --- Android.mk | 2 +- minui/Android.mk | 4 ++++ minui/graphics.c | 7 ++++++- ui.c | 9 +++++++-- 4 files changed, 18 insertions(+), 4 deletions(-) diff --git a/Android.mk b/Android.mk index 1303c24..bc0e3b2 100644 --- a/Android.mk +++ b/Android.mk @@ -50,7 +50,7 @@ LOCAL_CFLAGS += -DRECOVERY_VERSION="$(RECOVERY_VERSION)" RECOVERY_API_VERSION := 2 LOCAL_CFLAGS += -DRECOVERY_API_VERSION=$(RECOVERY_API_VERSION) -BOARD_RECOVERY_DEFINES := BOARD_HAS_NO_SELECT_BUTTON BOARD_SDCARD_DEVICE_PRIMARY BOARD_SDCARD_DEVICE_SECONDARY BOARD_SDEXT_DEVICE BOARD_SDEXT_FILESYSTEM BOARD_DATA_DEVICE BOARD_DATA_FILESYSTEM BOARD_DATADATA_DEVICE BOARD_DATADATA_FILESYSTEM BOARD_CACHE_DEVICE BOARD_CACHE_FILESYSTEM BOARD_SYSTEM_DEVICE BOARD_SYSTEM_FILESYSTEM BOARD_HAS_DATADATA BOARD_DATA_FILESYSTEM_OPTIONS BOARD_DATADATA_FILESYSTEM_OPTIONS BOARD_CACHE_FILESYSTEM_OPTIONS BOARD_SYSTEM_FILESYSTEM_OPTIONS BOARD_HAS_MTD_CACHE BOARD_USES_BMLUTILS BOARD_USES_MMCUTILS BOARD_HAS_SMALL_RECOVERY +BOARD_RECOVERY_DEFINES := BOARD_HAS_NO_SELECT_BUTTON BOARD_SDCARD_DEVICE_PRIMARY BOARD_SDCARD_DEVICE_SECONDARY BOARD_SDEXT_DEVICE BOARD_SDEXT_FILESYSTEM BOARD_DATA_DEVICE BOARD_DATA_FILESYSTEM BOARD_DATADATA_DEVICE BOARD_DATADATA_FILESYSTEM BOARD_CACHE_DEVICE BOARD_CACHE_FILESYSTEM BOARD_SYSTEM_DEVICE BOARD_SYSTEM_FILESYSTEM BOARD_HAS_DATADATA BOARD_DATA_FILESYSTEM_OPTIONS BOARD_DATADATA_FILESYSTEM_OPTIONS BOARD_CACHE_FILESYSTEM_OPTIONS BOARD_SYSTEM_FILESYSTEM_OPTIONS BOARD_HAS_MTD_CACHE BOARD_USES_BMLUTILS BOARD_USES_MMCUTILS BOARD_HAS_SMALL_RECOVERY BOARD_LDPI_RECOVERY $(foreach board_define,$(BOARD_RECOVERY_DEFINES), \ $(if $($(board_define)), \ diff --git a/minui/Android.mk b/minui/Android.mk index 91dd939..10f0f3f 100644 --- a/minui/Android.mk +++ b/minui/Android.mk @@ -7,6 +7,10 @@ LOCAL_C_INCLUDES +=\ external/libpng\ external/zlib +ifneq ($(BOARD_LDPI_RECOVERY),) + LOCAL_CFLAGS += -DBOARD_LDPI_RECOVERY='"$(BOARD_LDPI_RECOVERY)"' +endif + LOCAL_MODULE := libminui include $(BUILD_STATIC_LIBRARY) diff --git a/minui/graphics.c b/minui/graphics.c index adbfc09..c562053 100644 --- a/minui/graphics.c +++ b/minui/graphics.c @@ -29,7 +29,12 @@ #include -#include "font_10x18.h" +#ifndef BOARD_LDPI_RECOVERY + #include "font_10x18.h" +#else + #include "font_7x16.h" +#endif + #include "minui.h" typedef struct { diff --git a/ui.c b/ui.c index df52c7e..644ea96 100644 --- a/ui.c +++ b/ui.c @@ -41,8 +41,13 @@ static int gShowBackButton = 0; #define MENU_MAX_COLS 64 #define MENU_MAX_ROWS 250 -#define CHAR_WIDTH 10 -#define CHAR_HEIGHT 18 +#ifndef BOARD_LDPI_RECOVERY + #define CHAR_WIDTH 10 + #define CHAR_HEIGHT 18 +#else + #define CHAR_WIDTH 7 + #define CHAR_HEIGHT 16 +#endif #define PROGRESSBAR_INDETERMINATE_STATES 6 #define PROGRESSBAR_INDETERMINATE_FPS 15