freetype-commit
[Top][All Lists]
Advanced

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

[Git][freetype/freetype][master] Revert "[truetype] Reduce allocation sc


From: Alexei Podtelezhnikov (@apodtele)
Subject: [Git][freetype/freetype][master] Revert "[truetype] Reduce allocation scope."
Date: Fri, 24 May 2024 02:51:22 +0000

Alexei Podtelezhnikov pushed to branch master at FreeType / FreeType

Commits:

  • 70299c92
    by Alexei Podtelezhnikov (Алексей Подтележников) at 2024-05-23T22:50:32-04:00
    Revert "[truetype] Reduce allocation scope."
    
    This reverts commit 9ff4153cbfd60491f11bb56905ce6e20e94d23c7.
    

1 changed file:

Changes:

  • src/truetype/ttgxvar.c
    ... ... @@ -4079,6 +4079,10 @@
    4079 4079
         FT_UInt    glyph_index = loader->glyph_index;
    
    4080 4080
         FT_UInt    n_points    = (FT_UInt)outline->n_points + 4;
    
    4081 4081
     
    
    4082
    +    FT_Vector*  points_org = NULL;  /* coordinates in 16.16 format */
    
    4083
    +    FT_Vector*  points_out = NULL;  /* coordinates in 16.16 format */
    
    4084
    +    FT_Bool*    has_delta  = NULL;
    
    4085
    +
    
    4082 4086
         FT_ULong  glyph_start;
    
    4083 4087
     
    
    4084 4088
         FT_UInt   tupleCount;
    
    ... ... @@ -4125,12 +4129,17 @@
    4125 4129
           return FT_Err_Ok;
    
    4126 4130
         }
    
    4127 4131
     
    
    4132
    +    if ( FT_NEW_ARRAY( points_org, n_points ) ||
    
    4133
    +         FT_NEW_ARRAY( points_out, n_points ) ||
    
    4134
    +         FT_NEW_ARRAY( has_delta, n_points )  )
    
    4135
    +      goto Fail1;
    
    4136
    +
    
    4128 4137
         dataSize = blend->glyphoffsets[glyph_index + 1] -
    
    4129 4138
                      blend->glyphoffsets[glyph_index];
    
    4130 4139
     
    
    4131 4140
         if ( FT_STREAM_SEEK( blend->glyphoffsets[glyph_index] ) ||
    
    4132 4141
              FT_FRAME_ENTER( dataSize )                         )
    
    4133
    -      return error;
    
    4142
    +      goto Fail1;
    
    4134 4143
     
    
    4135 4144
         glyph_start = FT_Stream_FTell( stream );
    
    4136 4145
     
    
    ... ... @@ -4180,6 +4189,12 @@
    4180 4189
              FT_NEW_ARRAY( point_deltas_y, n_points ) )
    
    4181 4190
           goto Fail3;
    
    4182 4191
     
    
    4192
    +    for ( j = 0; j < n_points; j++ )
    
    4193
    +    {
    
    4194
    +      points_org[j].x = FT_intToFixed( outline->points[j].x );
    
    4195
    +      points_org[j].y = FT_intToFixed( outline->points[j].y );
    
    4196
    +    }
    
    4197
    +
    
    4183 4198
         for ( i = 0; i < ( tupleCount & GX_TC_TUPLE_COUNT_MASK ); i++ )
    
    4184 4199
         {
    
    4185 4200
           FT_UInt   tupleDataSize;
    
    ... ... @@ -4309,30 +4324,19 @@
    4309 4324
     
    
    4310 4325
           else
    
    4311 4326
           {
    
    4312
    -        FT_Vector*  points_org = NULL;  /* coordinates in 16.16 format */
    
    4313
    -        FT_Vector*  points_out = NULL;  /* coordinates in 16.16 format */
    
    4314
    -        FT_Bool*    has_delta  = NULL;
    
    4315
    -
    
    4316 4327
     #ifdef FT_DEBUG_LEVEL_TRACE
    
    4317 4328
             int  count = 0;
    
    4318 4329
     #endif
    
    4319 4330
     
    
    4320 4331
     
    
    4321
    -        /* note that `has_delta` is set to FALSE, zeroed out */
    
    4322
    -        if ( FT_QNEW_ARRAY( points_org, n_points ) ||
    
    4323
    -             FT_QNEW_ARRAY( points_out, n_points ) ||
    
    4324
    -             FT_NEW_ARRAY( has_delta, n_points )   )
    
    4325
    -          goto Fail4;
    
    4326
    -
    
    4332
    +        /* we have to interpolate the missing deltas similar to the */
    
    4333
    +        /* IUP bytecode instruction                                 */
    
    4327 4334
             for ( j = 0; j < n_points; j++ )
    
    4328 4335
             {
    
    4329
    -          points_org[j].x = FT_intToFixed( outline->points[j].x );
    
    4330
    -          points_org[j].y = FT_intToFixed( outline->points[j].y );
    
    4336
    +          has_delta[j]  = FALSE;
    
    4337
    +          points_out[j] = points_org[j];
    
    4331 4338
             }
    
    4332
    -        FT_ARRAY_COPY( points_out, points_org, n_points );
    
    4333 4339
     
    
    4334
    -        /* we have to interpolate the missing deltas similar to the */
    
    4335
    -        /* IUP bytecode instruction                                 */
    
    4336 4340
             for ( j = 0; j < point_count; j++ )
    
    4337 4341
             {
    
    4338 4342
               FT_UShort  idx = points[j];
    
    ... ... @@ -4390,10 +4394,6 @@
    4390 4394
             if ( !count )
    
    4391 4395
               FT_TRACE7(( "      none\n" ));
    
    4392 4396
     #endif
    
    4393
    -      Fail4:
    
    4394
    -        FT_FREE( points_org );
    
    4395
    -        FT_FREE( points_out );
    
    4396
    -        FT_FREE( has_delta );
    
    4397 4397
           }
    
    4398 4398
     
    
    4399 4399
           if ( localpoints != ALL_POINTS )
    
    ... ... @@ -4466,6 +4466,11 @@
    4466 4466
     
    
    4467 4467
         FT_FRAME_EXIT();
    
    4468 4468
     
    
    4469
    +  Fail1:
    
    4470
    +    FT_FREE( points_org );
    
    4471
    +    FT_FREE( points_out );
    
    4472
    +    FT_FREE( has_delta );
    
    4473
    +
    
    4469 4474
         return error;
    
    4470 4475
       }
    
    4471 4476
     
    


  • reply via email to

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