freetype-commit
[Top][All Lists]
Advanced

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

[Git][freetype/freetype][master] 2 commits: [raster] Handle sub-band sta


From: Alexei Podtelezhnikov (@apodtele)
Subject: [Git][freetype/freetype][master] 2 commits: [raster] Handle sub-band stack locally.
Date: Wed, 30 Jun 2021 03:56:35 +0000

Alexei Podtelezhnikov pushed to branch master at FreeType / FreeType

Commits:

2 changed files:

Changes:

  • ChangeLog
    1
    +2021-06-29  Alexei Podtelezhnikov  <apodtele@gmail.com>
    
    2
    +
    
    3
    +	[raster] Do not skip the second pass without dropout control.
    
    4
    +
    
    5
    +	The second pass also fixes horizontal lines through the pixel centers.
    
    6
    +
    
    7
    +	* src/raster/ftraster.c (black_TWorker): Do not use `second_pass'.
    
    8
    +	(Render_Glyph): Skip the second pass only with the appropriate flag.
    
    9
    +
    
    10
    +2021-06-29  Alexei Podtelezhnikov  <apodtele@gmail.com>
    
    11
    +
    
    12
    +	[raster] Handle sub-band stack locally.
    
    13
    +
    
    14
    +	* src/raster/ftraster.c (black_TWorker): Move `band_stack' from here..
    
    15
    +	(Render_Single_Pass): ... to here and accept limit arguments.
    
    16
    +	(Render_Glyph): Updated.
    
    17
    +
    
    1 18
     2021-06-25  Anurag Thakur  <anuthadev@gmail.com>
    
    2 19
     
    
    3 20
     	[CI] Introduce linux CI and refactor job names.
    

  • src/raster/ftraster.c
    ... ... @@ -370,8 +370,8 @@
    370 370
       /* by the sub-banding mechanism                               */
    
    371 371
       typedef struct  black_TBand_
    
    372 372
       {
    
    373
    -    Short  y_min;   /* band's minimum */
    
    374
    -    Short  y_max;   /* band's maximum */
    
    373
    +    Int  y_min;   /* band's minimum */
    
    374
    +    Int  y_max;   /* band's maximum */
    
    375 375
     
    
    376 376
       } black_TBand;
    
    377 377
     
    
    ... ... @@ -483,6 +483,8 @@
    483 483
     
    
    484 484
         Int         numTurns;           /* number of Y-turns in outline        */
    
    485 485
     
    
    486
    +    Byte        dropOutControl;     /* current drop_out control method     */
    
    487
    +
    
    486 488
         UShort      bWidth;             /* target bitmap width                 */
    
    487 489
         PByte       bOrigin;            /* target bitmap bottom-left origin    */
    
    488 490
         PByte       bLine;              /* target bitmap current line          */
    
    ... ... @@ -514,16 +516,6 @@
    514 516
         Function_Sweep_Span*  Proc_Sweep_Drop;
    
    515 517
         Function_Sweep_Step*  Proc_Sweep_Step;
    
    516 518
     
    
    517
    -    Byte        dropOutControl;     /* current drop_out control method     */
    
    518
    -
    
    519
    -    Bool        second_pass;        /* indicates whether a horizontal pass */
    
    520
    -                                    /* should be performed to control      */
    
    521
    -                                    /* drop-out accurately when calling    */
    
    522
    -                                    /* Render_Glyph.                       */
    
    523
    -
    
    524
    -    black_TBand  band_stack[16];    /* band stack used for sub-banding     */
    
    525
    -                                    /* enough for signed short bands       */
    
    526
    -
    
    527 519
       };
    
    528 520
     
    
    529 521
     
    
    ... ... @@ -3029,16 +3021,21 @@
    3029 3021
        *   Renderer error code.
    
    3030 3022
        */
    
    3031 3023
       static int
    
    3032
    -  Render_Single_Pass( RAS_ARGS Bool  flipped )
    
    3024
    +  Render_Single_Pass( RAS_ARGS Bool  flipped,
    
    3025
    +                               Int   y_min,
    
    3026
    +                               Int   y_max )
    
    3033 3027
       {
    
    3034
    -    Short  i, j, k;
    
    3035
    -    Int    band_top = 0;
    
    3028
    +    Int  y_mid;
    
    3029
    +    Int  band_top = 0;
    
    3036 3030
     
    
    3031
    +    black_TBand  band_stack[16];    /* band stack used for sub-banding     */
    
    3032
    +                                    /* enough for signed short bands       */
    
    3037 3033
     
    
    3038
    -    do
    
    3034
    +
    
    3035
    +    while ( 1 )
    
    3039 3036
         {
    
    3040
    -      ras.maxY = (Long)ras.band_stack[band_top].y_max * ras.precision;
    
    3041
    -      ras.minY = (Long)ras.band_stack[band_top].y_min * ras.precision;
    
    3037
    +      ras.minY = (Long)y_min * ras.precision;
    
    3038
    +      ras.maxY = (Long)y_max * ras.precision;
    
    3042 3039
     
    
    3043 3040
           ras.top = ras.buff;
    
    3044 3041
     
    
    ... ... @@ -3051,29 +3048,31 @@
    3051 3048
     
    
    3052 3049
             /* sub-banding */
    
    3053 3050
     
    
    3054
    -        i = ras.band_stack[band_top].y_min;
    
    3055
    -        j = ras.band_stack[band_top].y_max;
    
    3056
    -
    
    3057
    -        if ( i == j )
    
    3051
    +        if ( y_min == y_max )
    
    3058 3052
               return ras.error;  /* still Raster_Overflow */
    
    3059 3053
     
    
    3060
    -        k = (Short)( ( i + j ) / 2 );
    
    3061
    -
    
    3062
    -        ras.band_stack[band_top].y_max = k;
    
    3054
    +        y_mid = ( y_min + y_max ) >> 1;
    
    3063 3055
     
    
    3064
    -        ras.band_stack[band_top + 1].y_min = (Short)( k + 1 );
    
    3065
    -        ras.band_stack[band_top + 1].y_max = j;
    
    3056
    +        band_stack[band_top].y_min = y_min;
    
    3057
    +        band_stack[band_top].y_max = y_mid;
    
    3066 3058
     
    
    3067 3059
             band_top++;
    
    3060
    +
    
    3061
    +        y_min = y_mid + 1;
    
    3068 3062
           }
    
    3069 3063
           else
    
    3070 3064
           {
    
    3071 3065
             if ( ras.fProfile )
    
    3072 3066
               if ( Draw_Sweep( RAS_VAR ) )
    
    3073 3067
                  return ras.error;
    
    3074
    -        band_top--;
    
    3068
    +
    
    3069
    +        if ( --band_top < 0 )
    
    3070
    +          break;
    
    3071
    +
    
    3072
    +        y_min = band_stack[band_top].y_min;
    
    3073
    +        y_max = band_stack[band_top].y_max;
    
    3075 3074
           }
    
    3076
    -    } while ( band_top >= 0 );
    
    3075
    +    }
    
    3077 3076
     
    
    3078 3077
         return Raster_Err_Ok;
    
    3079 3078
       }
    
    ... ... @@ -3112,9 +3111,6 @@
    3112 3111
             ras.dropOutControl += 1;
    
    3113 3112
         }
    
    3114 3113
     
    
    3115
    -    ras.second_pass = (Bool)( !( ras.outline.flags      &
    
    3116
    -                                 FT_OUTLINE_SINGLE_PASS ) );
    
    3117
    -
    
    3118 3114
         /* Vertical Sweep */
    
    3119 3115
         FT_TRACE7(( "Vertical pass (ftraster)\n" ));
    
    3120 3116
     
    
    ... ... @@ -3123,20 +3119,18 @@
    3123 3119
         ras.Proc_Sweep_Drop = Vertical_Sweep_Drop;
    
    3124 3120
         ras.Proc_Sweep_Step = Vertical_Sweep_Step;
    
    3125 3121
     
    
    3126
    -    ras.band_stack[0].y_min = 0;
    
    3127
    -    ras.band_stack[0].y_max = (Short)( ras.target.rows - 1 );
    
    3128
    -
    
    3129 3122
         ras.bWidth  = (UShort)ras.target.width;
    
    3130 3123
         ras.bOrigin = (Byte*)ras.target.buffer;
    
    3131 3124
     
    
    3132 3125
         if ( ras.target.pitch > 0 )
    
    3133 3126
           ras.bOrigin += (Long)( ras.target.rows - 1 ) * ras.target.pitch;
    
    3134 3127
     
    
    3135
    -    if ( ( error = Render_Single_Pass( RAS_VARS 0 ) ) != 0 )
    
    3128
    +    error = Render_Single_Pass( RAS_VARS 0, 0, (Int)ras.target.rows - 1 );
    
    3129
    +    if ( error )
    
    3136 3130
           return error;
    
    3137 3131
     
    
    3138 3132
         /* Horizontal Sweep */
    
    3139
    -    if ( ras.second_pass && ras.dropOutControl != 2 )
    
    3133
    +    if ( !( ras.outline.flags & FT_OUTLINE_SINGLE_PASS ) )
    
    3140 3134
         {
    
    3141 3135
           FT_TRACE7(( "Horizontal pass (ftraster)\n" ));
    
    3142 3136
     
    
    ... ... @@ -3145,10 +3139,8 @@
    3145 3139
           ras.Proc_Sweep_Drop = Horizontal_Sweep_Drop;
    
    3146 3140
           ras.Proc_Sweep_Step = Horizontal_Sweep_Step;
    
    3147 3141
     
    
    3148
    -      ras.band_stack[0].y_min = 0;
    
    3149
    -      ras.band_stack[0].y_max = (Short)( ras.target.width - 1 );
    
    3150
    -
    
    3151
    -      if ( ( error = Render_Single_Pass( RAS_VARS 1 ) ) != 0 )
    
    3142
    +      error = Render_Single_Pass( RAS_VARS 1, 0, (Int)ras.target.width - 1 );
    
    3143
    +      if ( error )
    
    3152 3144
             return error;
    
    3153 3145
         }
    
    3154 3146
     
    


  • reply via email to

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