ref: 7c685cb3f636a2fb9962e9fc371e5007e6f5258d
parent: 02dec617310dee3e79eb9488cc4d8a8b75f304b0
author: Alexei Podtelezhnikov <[email protected]>
date: Sun Apr 18 18:31:13 EDT 2021
[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.
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2021-04-18 Alexei Podtelezhnikov <[email protected]>
+
+ [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.
--- 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 )