[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[freetype2] master 8a459e5: [cache] Restore SBit copying for unowned (BD
From: |
Werner Lemberg |
Subject: |
[freetype2] master 8a459e5: [cache] Restore SBit copying for unowned (BDF) bitmaps. |
Date: |
Tue, 20 Apr 2021 22:54:03 -0400 (EDT) |
branch: master
commit 8a459e5172dbb54b42d7b8247c98627d5cefb98d
Author: Alexei Podtelezhnikov <apodtele@gmail.com>
Commit: Alexei Podtelezhnikov <apodtele@gmail.com>
[cache] Restore SBit copying for unowned (BDF) bitmaps.
* src/cache/ftcsbits.c (ftc_sbit_copy_bitmap): Restore.
(ftc_snode_load): Check ownership and copy unowned bitmaps.
---
ChangeLog | 7 +++++++
src/cache/ftcsbits.c | 38 +++++++++++++++++++++++++++++++++++---
2 files changed, 42 insertions(+), 3 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 9bd9553..15ee63d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2021-04-20 Alexei Podtelezhnikov <apodtele@gmail.com>
+
+ [cache] Restore SBit copying for unowned (BDF) bitmaps.
+
+ * src/cache/ftcsbits.c (ftc_sbit_copy_bitmap): Restore.
+ (ftc_snode_load): Check ownership and copy unowned bitmaps.
+
2021-04-19 Dominik Röttsches <drott@chromium.org>
[sfnt] Return in 'COLR' v1 when layer pointer outside table
diff --git a/src/cache/ftcsbits.c b/src/cache/ftcsbits.c
index 01d94ec..33c4538 100644
--- a/src/cache/ftcsbits.c
+++ b/src/cache/ftcsbits.c
@@ -38,6 +38,30 @@
/*************************************************************************/
+ 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 )
@@ -153,9 +177,17 @@
sbit->format = (FT_Byte)bitmap->pixel_mode;
sbit->max_grays = (FT_Byte)(bitmap->num_grays - 1);
- /* take the bitmap ownership */
- sbit->buffer = bitmap->buffer;
- slot->internal->flags &= ~FT_GLYPH_OWN_BITMAP;
+ if ( slot->internal->flags & FT_GLYPH_OWN_BITMAP )
+ {
+ /* take the bitmap ownership */
+ sbit->buffer = bitmap->buffer;
+ slot->internal->flags &= ~FT_GLYPH_OWN_BITMAP;
+ }
+ else
+ {
+ /* copy the bitmap into a new buffer -- ignore error */
+ error = ftc_sbit_copy_bitmap( sbit, bitmap, manager->memory );
+ }
/* now, compute size */
if ( asize )
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [freetype2] master 8a459e5: [cache] Restore SBit copying for unowned (BDF) bitmaps.,
Werner Lemberg <=