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 mishandling of LCDv f


From: Alexei Podtelezhnikov (@apodtele)
Subject: [Git][freetype/freetype-demos][master] [graph] Fix mishandling of LCDv formats.
Date: Thu, 18 Aug 2022 16:10:30 +0000

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

Commits:

  • ffcc5c03
    by Alexei Podtelezhnikov at 2022-08-18T16:09:53+00:00
    [graph] Fix mishandling of LCDv formats.
    
    * graph/gblblit.c (gblender_blit)init): Triple the LCDv pitch.
    * graph/gblany.h (_gblender_blit_{vrgb,vbgr}_*): Updated accordingly.

2 changed files:

Changes:

  • graph/gblany.h
    ... ... @@ -279,7 +279,7 @@ GCONCAT( _gblender_blit_vrgb_, GDST_TYPE )( GBlenderBlit blit,
    279 279
       GBLENDER_CHANNEL_VARS( blender, fore.r, fore.g, fore.b );
    
    280 280
     
    
    281 281
       int                   h         = blit->height;
    
    282
    -  int                   src_pitch = blit->src_pitch;
    
    282
    +  int                   src_pitch = blit->src_pitch / 3;
    
    283 283
       const unsigned char*  src_line  = blit->src_line + blit->src_x;
    
    284 284
       unsigned char*        dst_line  = blit->dst_line + blit->dst_x*GDST_INCR;
    
    285 285
     
    
    ... ... @@ -322,7 +322,7 @@ GCONCAT( _gblender_blit_vrgb_, GDST_TYPE )( GBlenderBlit blit,
    322 322
         }
    
    323 323
         while (--w > 0);
    
    324 324
     
    
    325
    -    src_line += blit->src_pitch*3;
    
    325
    +    src_line += blit->src_pitch;
    
    326 326
         dst_line += blit->dst_pitch;
    
    327 327
       }
    
    328 328
       while (--h > 0);
    
    ... ... @@ -342,7 +342,7 @@ GCONCAT( _gblender_blit_vbgr_, GDST_TYPE )( GBlenderBlit blit,
    342 342
       GBLENDER_CHANNEL_VARS( blender, fore.r, fore.g, fore.b );
    
    343 343
     
    
    344 344
       int                   h         = blit->height;
    
    345
    -  int                   src_pitch = blit->src_pitch;
    
    345
    +  int                   src_pitch = blit->src_pitch / 3;
    
    346 346
       const unsigned char*  src_line  = blit->src_line + blit->src_x;
    
    347 347
       unsigned char*        dst_line  = blit->dst_line + blit->dst_x*GDST_INCR;
    
    348 348
     
    
    ... ... @@ -385,7 +385,7 @@ GCONCAT( _gblender_blit_vbgr_, GDST_TYPE )( GBlenderBlit blit,
    385 385
         }
    
    386 386
         while (--w > 0);
    
    387 387
     
    
    388
    -    src_line += blit->src_pitch*3;
    
    388
    +    src_line += blit->src_pitch;
    
    389 389
         dst_line += blit->dst_pitch;
    
    390 390
       }
    
    391 391
       while (--h > 0);
    

  • graph/gblblit.c
    ... ... @@ -252,7 +252,7 @@ gblender_blit_init( GBlenderBlit blit,
    252 252
     
    
    253 253
       GBlenderSourceFormat   src_format;
    
    254 254
       const unsigned char*   src_buffer = glyph->buffer;
    
    255
    -  const int              src_pitch  = glyph->pitch;
    
    255
    +  int                    src_pitch  = glyph->pitch;
    
    256 256
       int                    src_width  = glyph->width;
    
    257 257
       int                    src_height = glyph->rows;
    
    258 258
       unsigned char*         dst_buffer = target->buffer;
    
    ... ... @@ -276,10 +276,12 @@ gblender_blit_init( GBlenderBlit blit,
    276 276
         break;
    
    277 277
       case gr_pixel_mode_lcdv:  src_format = GBLENDER_SOURCE_VRGB;
    
    278 278
         src_height /= 3;
    
    279
    +    src_pitch  *= 3;
    
    279 280
         gblender_use_channels( surface->gblender, 1 );
    
    280 281
         break;
    
    281 282
       case gr_pixel_mode_lcdv2: src_format = GBLENDER_SOURCE_VBGR;
    
    282 283
         src_height /= 3;
    
    284
    +    src_pitch  *= 3;
    
    283 285
         gblender_use_channels( surface->gblender, 1 );
    
    284 286
         break;
    
    285 287
       case gr_pixel_mode_bgra:  src_format = GBLENDER_SOURCE_BGRA;
    
    ... ... @@ -347,7 +349,7 @@ gblender_blit_init( GBlenderBlit blit,
    347 349
     
    
    348 350
       blit->src_pitch = src_pitch;
    
    349 351
       if ( src_pitch < 0 )
    
    350
    -    src_y -= glyph->rows - 1;
    
    352
    +    src_y -= src_height - 1;
    
    351 353
       blit->src_line  = src_buffer + src_pitch * src_y;
    
    352 354
       blit->src_x     = src_x;
    
    353 355
     
    


  • reply via email to

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