shithub: freetype+ttf2subf

Download patch

ref: 23f85c8a981e1af9f36a838055865d8e7a0fb787
parent: 93715ab2c4f382f6bfebf9cfe70a1ed4cf11f2b5
author: Alexei Podtelezhnikov <[email protected]>
date: Thu Apr 22 19:34:08 EDT 2021

[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/.

git/fs: mount .git/fs: mount/attach disallowed
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
 2021-04-22  Alexei Podtelezhnikov  <[email protected]>
 
+	[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  <[email protected]>
+
 	[gxvalid,otvalid] s/FT_ALLOC/FT_QALLOC/ for initialized buffers.
 
 	* src/gxvalid/gxvmod.c (gxv_load_table): Do not zero out the buffer.
--- 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;
@@ -121,8 +119,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 )