freetype-commit
[Top][All Lists]
Advanced

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

[Git][freetype/freetype-demos][master] [graph/x11] Gray multiplication t


From: Alexei Podtelezhnikov
Subject: [Git][freetype/freetype-demos][master] [graph/x11] Gray multiplication tricks.
Date: Sun, 28 Feb 2021 13:42:21 +0000

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

Commits:

2 changed files:

Changes:

  • ChangeLog
    1
    +2021-02-28  Alexei Podtelezhnikov  <apodtele@gmail.com>
    
    2
    +
    
    3
    +	[graph/x11] Gray multiplication tricks.
    
    4
    +
    
    5
    +	* graph/x11/grx11.c (gr_x11_convert_gray_to_rgb{555,565,0888,8880}):
    
    6
    +	Combine multiple shifts into multiplication.
    
    7
    +
    
    1 8
     2021-02-26  Alexei Podtelezhnikov  <apodtele@gmail.com>
    
    2 9
     
    
    3 10
     	[ftdiff] Make it agnostic to display mode.
    

  • graph/x11/grx11.c
    ... ... @@ -257,9 +257,8 @@
    257 257
             unsigned int  p = lread[0];
    
    258 258
     
    
    259 259
     
    
    260
    -        lwrite[0] = (unsigned short)( ( ( p << 8 ) & 0xF800U ) |
    
    261
    -                                      ( ( p << 3 ) & 0x07E0  ) |
    
    262
    -                                      ( ( p >> 3 ) & 0x001F  ) );
    
    260
    +        lwrite[0] = (unsigned short)( ( ( p >> 3 ) * 0x0801U ) |
    
    261
    +                                      ( ( p >> 2 ) * 0x0020U ) );
    
    263 262
           }
    
    264 263
     
    
    265 264
           line_read  += blit->src_pitch;
    
    ... ... @@ -382,14 +381,7 @@
    382 381
     
    
    383 382
     
    
    384 383
           for ( ; x > 0; x--, lread++, lwrite++ )
    
    385
    -      {
    
    386
    -        unsigned int  p = lread[0];
    
    387
    -
    
    388
    -
    
    389
    -        lwrite[0] = (unsigned short)( ( ( p << 7 ) & 0x7C00 ) |
    
    390
    -                                      ( ( p << 2 ) & 0x03E0 ) |
    
    391
    -                                      ( ( p >> 3 ) & 0x001F ) );
    
    392
    -      }
    
    384
    +        *lwrite = (unsigned short)( ( *lread >> 3 ) * 0x0421U );
    
    393 385
     
    
    394 386
           line_read  += blit->src_pitch;
    
    395 387
           line_write += blit->dst_pitch;
    
    ... ... @@ -619,14 +611,7 @@
    619 611
     
    
    620 612
     
    
    621 613
           for ( ; x > 0; x--, lread++, lwrite++ )
    
    622
    -      {
    
    623
    -        uint32_t  p = lread[0];
    
    624
    -
    
    625
    -
    
    626
    -        *lwrite = ( p << 24 ) |
    
    627
    -                  ( p << 16 ) |
    
    628
    -                  ( p <<  8 );
    
    629
    -      }
    
    614
    +        *lwrite = *lread * 0x01010100U;
    
    630 615
     
    
    631 616
           line_read  += blit->src_pitch;
    
    632 617
           line_write += blit->dst_pitch;
    
    ... ... @@ -699,14 +684,7 @@
    699 684
     
    
    700 685
     
    
    701 686
           for ( ; x > 0; x--, lread++, lwrite++ )
    
    702
    -      {
    
    703
    -        uint32_t  p = lread[0];
    
    704
    -
    
    705
    -
    
    706
    -        *lwrite = ( p << 16 ) |
    
    707
    -                  ( p <<  8 ) |
    
    708
    -                  ( p <<  0 );
    
    709
    -      }
    
    687
    +        *lwrite = *lread * 0x010101U;
    
    710 688
     
    
    711 689
           line_read  += blit->src_pitch;
    
    712 690
           line_write += blit->dst_pitch;
    


  • reply via email to

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