freetype-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Git][freetype/freetype][master] [cache] Switch to lazy SBit setting.


From: Alexei Podtelezhnikov
Subject: [Git][freetype/freetype][master] [cache] Switch to lazy SBit setting.
Date: Mon, 19 Apr 2021 02:32:52 +0000

Alexei Podtelezhnikov pushed to branch master at FreeType / FreeType

Commits:

2 changed files:

Changes:

  • ChangeLog
    1
    +2021-04-18  Alexei Podtelezhnikov  <apodtele@gmail.com>
    
    2
    +
    
    3
    +	[cache] Switch to lazy SBit setting.
    
    4
    +
    
    5
    +	* src/cache/ftcsbits.c (ftc_sbit_copy_bitmap): Removed.
    
    6
    +	(ftc_snode_load): Take the bitmap ownership instead of copying.
    
    7
    +
    
    1 8
     2021-04-16  Daniel Welty  <@danielwelty>
    
    2 9
     
    
    3 10
     	* src/cache/ftcsbits.c (ftc_snode_load): Properly handle short pitch.
    

  • src/cache/ftcsbits.c
    ... ... @@ -38,30 +38,6 @@
    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
    -
    
    65 41
       FT_LOCAL_DEF( void )
    
    66 42
       ftc_snode_free( FTC_Node   ftcsnode,
    
    67 43
                       FTC_Cache  cache )
    
    ... ... @@ -108,7 +84,6 @@
    108 84
         FT_Error          error;
    
    109 85
         FTC_GNode         gnode  = FTC_GNODE( snode );
    
    110 86
         FTC_Family        family = gnode->family;
    
    111
    -    FT_Memory         memory = manager->memory;
    
    112 87
         FT_Face           face;
    
    113 88
         FTC_SBit          sbit;
    
    114 89
         FTC_SFamilyClass  clazz;
    
    ... ... @@ -123,7 +98,7 @@
    123 98
         sbit  = snode->sbits + ( gindex - gnode->gindex );
    
    124 99
         clazz = (FTC_SFamilyClass)family->clazz;
    
    125 100
     
    
    126
    -    sbit->buffer = 0;
    
    101
    +    sbit->buffer = NULL;
    
    127 102
     
    
    128 103
         error = clazz->family_load_glyph( family, gindex, manager, &face );
    
    129 104
         if ( error )
    
    ... ... @@ -178,8 +153,9 @@
    178 153
           sbit->format    = (FT_Byte)bitmap->pixel_mode;
    
    179 154
           sbit->max_grays = (FT_Byte)(bitmap->num_grays - 1);
    
    180 155
     
    
    181
    -      /* copy the bitmap into a new buffer -- ignore error */
    
    182
    -      error = ftc_sbit_copy_bitmap( sbit, bitmap, memory );
    
    156
    +      /* take the bitmap ownership */
    
    157
    +      sbit->buffer = bitmap->buffer;
    
    158
    +      slot->internal->flags &= ~FT_GLYPH_OWN_BITMAP;
    
    183 159
     
    
    184 160
           /* now, compute size */
    
    185 161
           if ( asize )
    


  • reply via email to

    [Prev in Thread] Current Thread [Next in Thread]