freetype-commit
[Top][All Lists]
Advanced

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

[Git][freetype/freetype-demos][master] [ftdiff] Make it agnostic to disp


From: Alexei Podtelezhnikov
Subject: [Git][freetype/freetype-demos][master] [ftdiff] Make it agnostic to display mode.
Date: Sat, 27 Feb 2021 03:34:01 +0000

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

Commits:

2 changed files:

Changes:

  • ChangeLog
    1
    +2021-02-26  Alexei Podtelezhnikov  <apodtele@gmail.com>
    
    2
    +
    
    3
    +	[ftdiff] Make it agnostic to display mode.
    
    4
    +
    
    5
    +	* src/ftdiff.c (main): Let the driver choose the mode.
    
    6
    +	(adisplay_init): Call `grFindColor' to set colors.
    
    7
    +	(adisplay_clear): Call `grFillRect' to clear display.
    
    8
    +
    
    1 9
     2021-02-25  Alexei Podtelezhnikov  <apodtele@gmail.com>
    
    2 10
     
    
    3 11
     	* graph/gblany.h, graph/gblblit.c: Multiply by 0x010101U.
    

  • src/ftdiff.c
    ... ... @@ -989,10 +989,6 @@
    989 989
         grBitmap    bit;
    
    990 990
     
    
    991 991
     
    
    992
    -    if ( mode != gr_pixel_mode_gray  &&
    
    993
    -         mode != gr_pixel_mode_rgb24 )
    
    994
    -      return -1;
    
    995
    -
    
    996 992
         grInitDevices();
    
    997 993
     
    
    998 994
         bit.mode  = mode;
    
    ... ... @@ -1013,8 +1009,8 @@
    1013 1009
     
    
    1014 1010
         grSetTargetGamma( display->bitmap, display->gamma );
    
    1015 1011
     
    
    1016
    -    memset( &display->fore_color, 0, sizeof( grColor ) );
    
    1017
    -    memset( &display->back_color, 0xff, sizeof( grColor ) );
    
    1012
    +    display->fore_color = grFindColor( display->bitmap,   0,   0,   0, 255 );
    
    1013
    +    display->back_color = grFindColor( display->bitmap, 255, 255, 255, 255 );
    
    1018 1014
     
    
    1019 1015
         return 0;
    
    1020 1016
       }
    
    ... ... @@ -1024,30 +1020,9 @@
    1024 1020
       adisplay_clear( ADisplay  display )
    
    1025 1021
       {
    
    1026 1022
         grBitmap*  bit   = display->bitmap;
    
    1027
    -    int        pitch = bit->pitch;
    
    1028
    -
    
    1029
    -
    
    1030
    -    if ( pitch < 0 )
    
    1031
    -      pitch = -pitch;
    
    1032
    -
    
    1033
    -    if ( bit->mode == gr_pixel_mode_gray )
    
    1034
    -      memset( bit->buffer,
    
    1035
    -              display->back_color.value,
    
    1036
    -              (size_t)pitch * (size_t)bit->rows );
    
    1037
    -    else
    
    1038
    -    {
    
    1039
    -      unsigned char*  p = bit->buffer;
    
    1040
    -      int             i, j;
    
    1041
    -
    
    1042 1023
     
    
    1043
    -      for ( i = 0; i < bit->rows; i++ )
    
    1044
    -      {
    
    1045
    -        for ( j = 0; j < bit->width; j++ )
    
    1046
    -          memcpy( p + 3 * j, display->back_color.chroma, 3 );
    
    1047 1024
     
    
    1048
    -        p += pitch;
    
    1049
    -      }
    
    1050
    -    }
    
    1025
    +    grFillRect( bit, 0, 0, bit->width, bit->rows, display->back_color );
    
    1051 1026
       }
    
    1052 1027
     
    
    1053 1028
     
    
    ... ... @@ -1622,7 +1597,7 @@
    1622 1597
         }
    
    1623 1598
     
    
    1624 1599
         /* Initialize display */
    
    1625
    -    if ( adisplay_init( adisplay, gr_pixel_mode_rgb24,
    
    1600
    +    if ( adisplay_init( adisplay, gr_pixel_mode_none,
    
    1626 1601
                             width, height ) < 0 )
    
    1627 1602
         {
    
    1628 1603
           fprintf( stderr, "could not initialize display!  Aborting.\n" );
    


  • reply via email to

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