summaryrefslogtreecommitdiffstats
path: root/firmware/font.c
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/font.c')
-rw-r--r--firmware/font.c16
1 files changed, 6 insertions, 10 deletions
diff --git a/firmware/font.c b/firmware/font.c
index 724cb84d57..7ce64ed47d 100644
--- a/firmware/font.c
+++ b/firmware/font.c
@@ -90,7 +90,6 @@ extern struct font sysfont;
struct buflib_alloc_data {
struct font font; /* must be the first member! */
- int handle_locks; /* is the buflib handle currently locked? */
int refcount; /* how many times has this font been loaded? */
unsigned char buffer[];
};
@@ -107,9 +106,6 @@ static int buflibmove_callback(int handle, void* current, void* new)
struct buflib_alloc_data *alloc = (struct buflib_alloc_data*)current;
ptrdiff_t diff = new - current;
- if (alloc->handle_locks > 0)
- return BUFLIB_CB_CANNOT_MOVE;
-
#define UPDATE(x) if (x) { x = PTR_ADD(x, diff); }
UPDATE(alloc->font.bits);
@@ -129,18 +125,18 @@ static void lock_font_handle(int handle, bool lock)
{
if ( handle < 0 )
return;
- struct buflib_alloc_data *alloc = core_get_data(handle);
- if ( lock )
- alloc->handle_locks++;
+
+ if (lock)
+ core_pin(handle);
else
- alloc->handle_locks--;
+ core_unpin(handle);
}
void font_lock(int font_id, bool lock)
{
if( font_id < 0 || font_id >= MAXFONTS )
return;
- if( buflib_allocations[font_id] >= 0 )
+ if( buflib_allocations[font_id] > 0 )
lock_font_handle(buflib_allocations[font_id], lock);
}
@@ -522,8 +518,8 @@ int font_load_ex( const char *path, size_t buf_size, int glyphs )
return -1;
}
struct buflib_alloc_data *pdata;
+ core_pin(handle);
pdata = core_get_data(handle);
- pdata->handle_locks = 1;
pdata->refcount = 1;
/* load and init */