Alexei Podtelezhnikov pushed to branch master at FreeType / FreeType
Commits:
-
8a459e51
by Alexei Podtelezhnikov at 2021-04-20T22:53:13-04:00
2 changed files:
Changes:
1 |
+2021-04-20 Alexei Podtelezhnikov <apodtele@gmail.com>
|
|
2 |
+ |
|
3 |
+ [cache] Restore SBit copying for unowned (BDF) bitmaps.
|
|
4 |
+ |
|
5 |
+ * src/cache/ftcsbits.c (ftc_sbit_copy_bitmap): Restore.
|
|
6 |
+ (ftc_snode_load): Check ownership and copy unowned bitmaps.
|
|
7 |
+ |
|
1 | 8 |
2021-04-19 Dominik Röttsches <drott@chromium.org>
|
2 | 9 |
|
3 | 10 |
[sfnt] Return in 'COLR' v1 when layer pointer outside table
|
... | ... | @@ -38,6 +38,30 @@ |
38 | 38 |
/*************************************************************************/
|
39 | 39 |
|
40 | 40 |
|
41 |
+ static FT_Error
|
|
42 |
+ ftc_sbit_copy_bitmap( FTC_SBit sbit,
|
|
43 |
+ FT_Bitmap* bitmap,
|
|
44 |
+ FT_Memory memory )
|
|
45 |
+ {
|
|
46 |
+ FT_Error error;
|
|
47 |
+ FT_Int pitch = bitmap->pitch;
|
|
48 |
+ FT_ULong size;
|
|
49 |
+ |
|
50 |
+ |
|
51 |
+ if ( pitch < 0 )
|
|
52 |
+ pitch = -pitch;
|
|
53 |
+ |
|
54 |
+ size = (FT_ULong)pitch * bitmap->rows;
|
|
55 |
+ if ( !size )
|
|
56 |
+ return FT_Err_Ok;
|
|
57 |
+ |
|
58 |
+ if ( !FT_ALLOC( sbit->buffer, size ) )
|
|
59 |
+ FT_MEM_COPY( sbit->buffer, bitmap->buffer, size );
|
|
60 |
+ |
|
61 |
+ return error;
|
|
62 |
+ }
|
|
63 |
+ |
|
64 |
+ |
|
41 | 65 |
FT_LOCAL_DEF( void )
|
42 | 66 |
ftc_snode_free( FTC_Node ftcsnode,
|
43 | 67 |
FTC_Cache cache )
|
... | ... | @@ -153,9 +177,17 @@ |
153 | 177 |
sbit->format = (FT_Byte)bitmap->pixel_mode;
|
154 | 178 |
sbit->max_grays = (FT_Byte)(bitmap->num_grays - 1);
|
155 | 179 |
|
156 |
- /* take the bitmap ownership */
|
|
157 |
- sbit->buffer = bitmap->buffer;
|
|
158 |
- slot->internal->flags &= ~FT_GLYPH_OWN_BITMAP;
|
|
180 |
+ if ( slot->internal->flags & FT_GLYPH_OWN_BITMAP )
|
|
181 |
+ {
|
|
182 |
+ /* take the bitmap ownership */
|
|
183 |
+ sbit->buffer = bitmap->buffer;
|
|
184 |
+ slot->internal->flags &= ~FT_GLYPH_OWN_BITMAP;
|
|
185 |
+ }
|
|
186 |
+ else
|
|
187 |
+ {
|
|
188 |
+ /* copy the bitmap into a new buffer -- ignore error */
|
|
189 |
+ error = ftc_sbit_copy_bitmap( sbit, bitmap, manager->memory );
|
|
190 |
+ }
|
|
159 | 191 |
|
160 | 192 |
/* now, compute size */
|
161 | 193 |
if ( asize )
|