[sfnt] Cache offset and size to bitmap data table.
This commit avoids `EBDT' and friends being looked up again and again while loading a single embedded bitmap. * include/freetype/internal/tttypes.h (TT_FaceRec) [TT_CONFIG_OPTION_EMBEDDED_BITMAPS]: New fields `ebdt_start' and `ebdt_size'. * src/sfnt/ttsbit.c (tt_sbit_decoder_init): Move table lookup to ... (tt_face_load_sbit): ... this function; also store the table size and offset.
This commit is contained in:
parent
1034ff4ac0
commit
f3e71bab9e
15
ChangeLog
15
ChangeLog
@ -1,3 +1,18 @@
|
||||
2016-08-26 Werner Lemberg <wl@gnu.org>
|
||||
|
||||
[sfnt] Cache offset and size to bitmap data table.
|
||||
|
||||
This commit avoids `EBDT' and friends being looked up again and
|
||||
again while loading a single embedded bitmap.
|
||||
|
||||
* include/freetype/internal/tttypes.h (TT_FaceRec)
|
||||
[TT_CONFIG_OPTION_EMBEDDED_BITMAPS]: New fields `ebdt_start' and
|
||||
`ebdt_size'.
|
||||
|
||||
* src/sfnt/ttsbit.c (tt_sbit_decoder_init): Move table lookup to ...
|
||||
(tt_face_load_sbit): ... this function; also store the table size
|
||||
and offset.
|
||||
|
||||
2016-08-26 Alexei Podtelezhnikov <apodtele@gmail.com>
|
||||
|
||||
* src/smooth/ftgrays.c (gray_raster_render): Minor tweaks.
|
||||
|
@ -1393,6 +1393,12 @@ FT_BEGIN_HEADER
|
||||
FT_Bool sph_compatibility_mode;
|
||||
#endif /* TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY */
|
||||
|
||||
#ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS
|
||||
/* since 2.7 */
|
||||
FT_ULong ebdt_start; /* either `CBDT', `EBDT', or `bdat' */
|
||||
FT_ULong ebdt_size;
|
||||
#endif
|
||||
|
||||
} TT_FaceRec;
|
||||
|
||||
|
||||
|
@ -197,6 +197,27 @@
|
||||
if ( !error )
|
||||
FT_TRACE3(( "sbit_num_strikes: %u\n", face->sbit_num_strikes ));
|
||||
|
||||
face->ebdt_start = 0;
|
||||
face->ebdt_size = 0;
|
||||
|
||||
if ( face->sbit_table_type != TT_SBIT_TABLE_TYPE_NONE )
|
||||
{
|
||||
FT_ULong ebdt_size;
|
||||
|
||||
|
||||
error = face->goto_table( face, TTAG_CBDT, stream, &ebdt_size );
|
||||
if ( error )
|
||||
error = face->goto_table( face, TTAG_EBDT, stream, &ebdt_size );
|
||||
if ( error )
|
||||
error = face->goto_table( face, TTAG_bdat, stream, &ebdt_size );
|
||||
|
||||
if ( !error )
|
||||
{
|
||||
face->ebdt_start = FT_STREAM_POS();
|
||||
face->ebdt_size = ebdt_size;
|
||||
}
|
||||
}
|
||||
|
||||
return FT_Err_Ok;
|
||||
|
||||
Exit:
|
||||
@ -424,17 +445,13 @@
|
||||
FT_ULong strike_index,
|
||||
TT_SBit_MetricsRec* metrics )
|
||||
{
|
||||
FT_Error error;
|
||||
FT_Error error = FT_ERR( Table_Missing );
|
||||
FT_Stream stream = face->root.stream;
|
||||
FT_ULong ebdt_size;
|
||||
|
||||
|
||||
error = face->goto_table( face, TTAG_CBDT, stream, &ebdt_size );
|
||||
if ( error )
|
||||
error = face->goto_table( face, TTAG_EBDT, stream, &ebdt_size );
|
||||
if ( error )
|
||||
error = face->goto_table( face, TTAG_bdat, stream, &ebdt_size );
|
||||
if ( error )
|
||||
if ( !face->ebdt_size )
|
||||
goto Exit;
|
||||
if ( FT_STREAM_SEEK( face->ebdt_start ) )
|
||||
goto Exit;
|
||||
|
||||
decoder->face = face;
|
||||
@ -445,8 +462,8 @@
|
||||
decoder->metrics_loaded = 0;
|
||||
decoder->bitmap_allocated = 0;
|
||||
|
||||
decoder->ebdt_start = FT_STREAM_POS();
|
||||
decoder->ebdt_size = ebdt_size;
|
||||
decoder->ebdt_start = face->ebdt_start;
|
||||
decoder->ebdt_size = face->ebdt_size;
|
||||
|
||||
decoder->eblc_base = face->sbit_table;
|
||||
decoder->eblc_limit = face->sbit_table + face->sbit_table_size;
|
||||
|
Loading…
Reference in New Issue
Block a user