From 23f85c8a981e1af9f36a838055865d8e7a0fb787 Mon Sep 17 00:00:00 2001 From: Alexei Podtelezhnikov Date: Thu, 22 Apr 2021 23:34:08 -0400 Subject: [PATCH] [cache] Optimize SBit copying. * src/cache/ftcsbits.c (ftc_snode_load): Do not initialize the buffer. (ftc_sbit_copy_bitmap): Accept zero size, s/FT_ALLOC/FT_QALLOC/. --- ChangeLog | 7 +++++++ src/cache/ftcsbits.c | 6 +----- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 599b9c399..2cf4c53bd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2021-04-22 Alexei Podtelezhnikov + + [cache] Optimize SBit copying. + + * src/cache/ftcsbits.c (ftc_snode_load): Do not initialize the buffer. + (ftc_sbit_copy_bitmap): Accept zero size, s/FT_ALLOC/FT_QALLOC/. + 2021-04-22 Alexei Podtelezhnikov [gxvalid,otvalid] s/FT_ALLOC/FT_QALLOC/ for initialized buffers. diff --git a/src/cache/ftcsbits.c b/src/cache/ftcsbits.c index 33c45386c..723192f9d 100644 --- a/src/cache/ftcsbits.c +++ b/src/cache/ftcsbits.c @@ -52,10 +52,8 @@ pitch = -pitch; size = (FT_ULong)pitch * bitmap->rows; - if ( !size ) - return FT_Err_Ok; - if ( !FT_ALLOC( sbit->buffer, size ) ) + if ( !FT_QALLOC( sbit->buffer, size ) ) FT_MEM_COPY( sbit->buffer, bitmap->buffer, size ); return error; @@ -122,8 +120,6 @@ sbit = snode->sbits + ( gindex - gnode->gindex ); clazz = (FTC_SFamilyClass)family->clazz; - sbit->buffer = NULL; - error = clazz->family_load_glyph( family, gindex, manager, &face ); if ( error ) goto BadGlyph;