freetype-commit
[Top][All Lists]
Advanced

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

[Git][freetype/freetype-demos][master] [graph] Fix negative pitch issues


From: Alexei Podtelezhnikov (@apodtele)
Subject: [Git][freetype/freetype-demos][master] [graph] Fix negative pitch issues.
Date: Sat, 08 Jan 2022 15:18:03 +0000

Alexei Podtelezhnikov pushed to branch master at FreeType / FreeType Demo Programs

Commits:

3 changed files:

Changes:

  • graph/gblblit.c
    ... ... @@ -263,14 +263,14 @@ gblender_blit_init( GBlenderBlit blit,
    263 263
     
    
    264 264
       GBlenderSourceFormat   src_format;
    
    265 265
       const unsigned char*   src_buffer = glyph->buffer;
    
    266
    -  int                    src_pitch  = glyph->pitch;
    
    266
    +  const int              src_pitch  = glyph->pitch;
    
    267 267
       int                    src_width  = glyph->width;
    
    268 268
       int                    src_height = glyph->rows;
    
    269 269
       GBlenderTargetFormat   dst_format;
    
    270 270
       unsigned char*         dst_buffer = target->buffer;
    
    271
    -  int                    dst_pitch  = target->pitch;
    
    272
    -  int                    dst_width  = target->width;
    
    273
    -  int                    dst_height = target->rows;
    
    271
    +  const int              dst_pitch  = target->pitch;
    
    272
    +  const int              dst_width  = target->width;
    
    273
    +  const int              dst_height = target->rows;
    
    274 274
     
    
    275 275
     
    
    276 276
       switch ( glyph->mode )
    
    ... ... @@ -345,24 +345,20 @@ gblender_blit_init( GBlenderBlit blit,
    345 345
       if ( src_width <= 0 || src_height <= 0 )
    
    346 346
         return -1;
    
    347 347
     
    
    348
    -  blit->width      = src_width;
    
    349
    -  blit->height     = src_height;
    
    350
    -  blit->src_format = src_format;
    
    351
    -  blit->dst_format = dst_format;
    
    348
    +  blit->width     = src_width;
    
    349
    +  blit->height    = src_height;
    
    352 350
     
    
    353
    -  blit->src_x     = src_x;
    
    354
    -  blit->src_y     = src_y;
    
    355
    -  blit->src_line  = src_buffer + src_pitch*src_y;
    
    356 351
       blit->src_pitch = src_pitch;
    
    357 352
       if ( src_pitch < 0 )
    
    358
    -    blit->src_line -= (src_height-1)*src_pitch;
    
    353
    +    src_y -= glyph->rows - 1;
    
    354
    +  blit->src_line  = src_buffer + src_pitch * src_y;
    
    355
    +  blit->src_x     = src_x;
    
    359 356
     
    
    360
    -  blit->dst_x     = dst_x;
    
    361
    -  blit->dst_y     = dst_y;
    
    362
    -  blit->dst_line  = dst_buffer + dst_pitch*dst_y;
    
    363 357
       blit->dst_pitch = dst_pitch;
    
    364 358
       if ( dst_pitch < 0 )
    
    365
    -    blit->dst_line -= (dst_height-1)*dst_pitch;
    
    359
    +    dst_y -= dst_height - 1;
    
    360
    +  blit->dst_line  = dst_buffer + dst_pitch * dst_y;
    
    361
    +  blit->dst_x     = dst_x;
    
    366 362
     
    
    367 363
       return 0;
    
    368 364
     }
    

  • graph/gblblit.h
    ... ... @@ -48,13 +48,9 @@ typedef struct GBlenderBlitRec_
    48 48
       const unsigned char*  src_line;
    
    49 49
       int                   src_pitch;
    
    50 50
       int                   src_x;
    
    51
    -  int                   src_y;
    
    52 51
       unsigned char*        dst_line;
    
    53 52
       int                   dst_pitch;
    
    54 53
       int                   dst_x;
    
    55
    -  int                   dst_y;
    
    56
    -  GBlenderSourceFormat  src_format;
    
    57
    -  GBlenderTargetFormat  dst_format;
    
    58 54
     
    
    59 55
       GBlender              blender;
    
    60 56
       GBlenderBlitFunc      blit_func;
    

  • graph/gblender.h
    ... ... @@ -145,7 +145,7 @@
    145 145
       GBLENDER_API( void )
    
    146 146
       gblender_dump_stats( GBlender  blender );
    
    147 147
     #else
    
    148
    -# define gblender_dump_stats(b)  do { } while (0);
    
    148
    +# define gblender_dump_stats(b)  do { } while (0)
    
    149 149
     #endif
    
    150 150
     
    
    151 151
     #ifdef GBLENDER_STATS
    


  • reply via email to

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