diff --git a/ChangeLog b/ChangeLog index a6d8f806c..4b41688fa 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2021-04-18 Alexei Podtelezhnikov + + [cache] Switch to lazy SBit setting. + + * src/cache/ftcsbits.c (ftc_sbit_copy_bitmap): Removed. + (ftc_snode_load): Take the bitmap ownership instead of copying. + 2021-04-16 Daniel Welty <@danielwelty> * src/cache/ftcsbits.c (ftc_snode_load): Properly handle short pitch. diff --git a/src/cache/ftcsbits.c b/src/cache/ftcsbits.c index 93d5367fa..01d94ec9a 100644 --- a/src/cache/ftcsbits.c +++ b/src/cache/ftcsbits.c @@ -38,30 +38,6 @@ /*************************************************************************/ - static FT_Error - ftc_sbit_copy_bitmap( FTC_SBit sbit, - FT_Bitmap* bitmap, - FT_Memory memory ) - { - FT_Error error; - FT_Int pitch = bitmap->pitch; - FT_ULong size; - - - if ( pitch < 0 ) - pitch = -pitch; - - size = (FT_ULong)pitch * bitmap->rows; - if ( !size ) - return FT_Err_Ok; - - if ( !FT_ALLOC( sbit->buffer, size ) ) - FT_MEM_COPY( sbit->buffer, bitmap->buffer, size ); - - return error; - } - - FT_LOCAL_DEF( void ) ftc_snode_free( FTC_Node ftcsnode, FTC_Cache cache ) @@ -108,7 +84,6 @@ FT_Error error; FTC_GNode gnode = FTC_GNODE( snode ); FTC_Family family = gnode->family; - FT_Memory memory = manager->memory; FT_Face face; FTC_SBit sbit; FTC_SFamilyClass clazz; @@ -123,7 +98,7 @@ sbit = snode->sbits + ( gindex - gnode->gindex ); clazz = (FTC_SFamilyClass)family->clazz; - sbit->buffer = 0; + sbit->buffer = NULL; error = clazz->family_load_glyph( family, gindex, manager, &face ); if ( error ) @@ -178,8 +153,9 @@ sbit->format = (FT_Byte)bitmap->pixel_mode; sbit->max_grays = (FT_Byte)(bitmap->num_grays - 1); - /* copy the bitmap into a new buffer -- ignore error */ - error = ftc_sbit_copy_bitmap( sbit, bitmap, memory ); + /* take the bitmap ownership */ + sbit->buffer = bitmap->buffer; + slot->internal->flags &= ~FT_GLYPH_OWN_BITMAP; /* now, compute size */ if ( asize )