freetype-commit
[Top][All Lists]
Advanced

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

[Git][freetype/freetype][gsoc-anurag-2022] 2 commits: Remove redundant c


From: Anurag Thakur (@AdbhutDev)
Subject: [Git][freetype/freetype][gsoc-anurag-2022] 2 commits: Remove redundant code
Date: Wed, 14 Sep 2022 15:05:19 +0000

Anurag Thakur pushed to branch gsoc-anurag-2022 at FreeType / FreeType

Commits:

  • 2741dd49
    by Anurag Thakur at 2022-09-14T20:10:37+05:30
    Remove redundant code
    
  • 339e30ba
    by Anurag Thakur at 2022-09-14T20:34:48+05:30
    Almost fix rendering
    

3 changed files:

Changes:

  • src/dense/ftdense.c
    ... ... @@ -67,13 +67,13 @@ swap( long int* a, long int* b )
    67 67
     
    
    68 68
     
    
    69 69
     void
    
    70
    -dense_render_line( dense_worker* worker, TPos to_x, TPos to_y )
    
    70
    +dense_render_line( dense_worker* worker, TPos tox, TPos toy )
    
    71 71
     {
    
    72 72
       // printf("line from: %d, %d to %d, %d\n", worker->prev_x, worker->prev_y,
    
    73 73
       // to_x, to_y);
    
    74
    -  TPos from_x = worker->prev_x;
    
    75
    -  TPos from_y = worker->prev_y;
    
    76
    -  if ( from_y == to_y )
    
    74
    +  float from_x = worker->prev_x;
    
    75
    +  float from_y = worker->prev_y;
    
    76
    +  if ( from_y == toy )
    
    77 77
         return;
    
    78 78
     
    
    79 79
       // aP0.m_x -= worker->m_origin_x;
    
    ... ... @@ -81,10 +81,18 @@ dense_render_line( dense_worker* worker, TPos to_x, TPos to_y )
    81 81
       // aP1.m_x -= worker->m_origin_x;
    
    82 82
       // aP1.m_y -= worker->m_origin_y;
    
    83 83
     
    
    84
    -  from_x = TRUNC( (int)from_x );
    
    85
    -  from_y = TRUNC( (int)from_y );
    
    86
    -  to_x   = TRUNC( (int)to_x );
    
    87
    -  to_y   = TRUNC( (int)to_y );
    
    84
    +  // from_x = TRUNC( (int)from_x );
    
    85
    +  // from_y = TRUNC( (int)from_y );
    
    86
    +  // to_x   = TRUNC( (int)to_x );
    
    87
    +  // to_y   = TRUNC( (int)to_y );
    
    88
    +
    
    89
    +  from_x /= 256.0;
    
    90
    +  from_y /= 256.0;
    
    91
    +  float to_x = tox / 256.0;
    
    92
    +  float to_y = toy / 256.0;
    
    93
    +
    
    94
    +
    
    95
    +  //printf("line from: %f, %f to %f, %f\n", from_x, from_y, to_x, to_y);
    
    88 96
     
    
    89 97
       float dir;
    
    90 98
       if ( from_y < to_y )
    
    ... ... @@ -112,57 +120,6 @@ dense_render_line( dense_worker* worker, TPos to_x, TPos to_y )
    112 120
         to_y = (float)worker->m_h;
    
    113 121
       }
    
    114 122
     
    
    115
    -  /**
    
    116
    -  Handle parts of the line outside the clip rectangle by
    
    117
    -  snapping them to the left or right edge, or, if they intersect the clip area,
    
    118
    -  by recursive calls.
    
    119
    -  */
    
    120
    -
    
    121
    -  FT_Vector intersect = { 0, 0 };
    
    122
    -  int       recursive = 0;
    
    123
    -  if ( from_x >= worker->m_w && to_x >= worker->m_w )
    
    124
    -  {
    
    125
    -    from_x = to_x = (float)worker->m_w;
    
    126
    -    dxdy          = 0;
    
    127
    -  }
    
    128
    -  else if ( from_x <= 0 && to_x <= 0 )
    
    129
    -  {
    
    130
    -    from_x = to_x = 0;
    
    131
    -    dxdy          = 0;
    
    132
    -  }
    
    133
    -  else if ( ( from_x < 0 ) != ( to_x < 0 ) )
    
    134
    -  {
    
    135
    -    intersect.x = 0;
    
    136
    -    intersect.y = to_y - to_x / dxdy;
    
    137
    -    recursive   = 1;
    
    138
    -  }
    
    139
    -  else if ( ( from_x > worker->m_w ) != ( to_x > worker->m_w ) )
    
    140
    -  {
    
    141
    -    intersect.x = worker->m_w;
    
    142
    -    intersect.y = from_y + ( worker->m_w - from_x ) / dxdy;
    
    143
    -    recursive   = 1;
    
    144
    -  }
    
    145
    -  if ( recursive )
    
    146
    -  {
    
    147
    -    from_x += worker->m_origin_x;
    
    148
    -    from_y += worker->m_origin_y;
    
    149
    -    to_x += worker->m_origin_x;
    
    150
    -    to_y += worker->m_origin_y;
    
    151
    -    intersect.x += worker->m_origin_x;
    
    152
    -    intersect.y += worker->m_origin_y;
    
    153
    -    if ( dir == 1 )
    
    154
    -    {
    
    155
    -      dense_render_line( worker, intersect.x, intersect.y );
    
    156
    -      dense_render_line( worker, to_x, to_y );
    
    157
    -    }
    
    158
    -    else
    
    159
    -    {
    
    160
    -      dense_render_line( worker, intersect.x, intersect.y );
    
    161
    -      dense_render_line( worker, from_x, from_y );
    
    162
    -    }
    
    163
    -    return;
    
    164
    -  }
    
    165
    -
    
    166 123
       float  x       = from_x;
    
    167 124
       int    y0      = (int)from_y;
    
    168 125
       int    y_limit = (int)ceil( to_y );
    
    ... ... @@ -170,6 +127,7 @@ dense_render_line( dense_worker* worker, TPos to_x, TPos to_y )
    170 127
     
    
    171 128
       for ( int y = y0; y < y_limit; y++ )
    
    172 129
       {
    
    130
    +   // printf("y is %d\n", y);
    
    173 131
         int   linestart = y * worker->m_w;
    
    174 132
         float dy        = fmin( y + 1.0f, to_y ) - fmax( (float)y, from_y );
    
    175 133
         float xnext     = x + dxdy * dy;
    

  • src/dense/ftdenserend.c
    ... ... @@ -98,13 +98,18 @@ take a variable named `memory`. It can only be known if you follow the macros 3
    98 98
       if ( FT_ALLOC_MULT( bitmap->buffer, bitmap->rows, bitmap->pitch ) )
    
    99 99
         goto Exit;
    
    100 100
     
    
    101
    +    /* @QUES: What does this flag mean ?*/
    
    102
    +  slot->internal->flags |= FT_GLYPH_OWN_BITMAP;
    
    103
    +  
    
    101 104
       /* @QUES: Where can I read more about why x and y shift are required */
    
    102 105
       x_shift = 64 * -slot->bitmap_left;
    
    103 106
       y_shift = 64 * -slot->bitmap_top;
    
    104 107
     
    
    105
    -  /* @QUES: What does this flag mean ?*/
    
    106
    -  slot->internal->flags |= FT_GLYPH_OWN_BITMAP;
    
    107
    -  y_shift += 64 * (FT_Int)bitmap->rows;
    
    108
    +  if ( bitmap->pixel_mode == FT_PIXEL_MODE_LCD_V )
    
    109
    +     y_shift += 64 * (FT_Int)bitmap->rows / 3;
    
    110
    +   else
    
    111
    +     y_shift += 64 * (FT_Int)bitmap->rows;
    
    112
    +
    
    108 113
     
    
    109 114
       if ( origin )
    
    110 115
       {
    

  • src/smooth/ftgrays.c
    ... ... @@ -876,10 +876,10 @@ typedef ptrdiff_t FT_PtrDist;
    876 876
         TCoord  fx1, fy1, fx2, fy2;
    
    877 877
         TCoord  ex1, ey1, ex2, ey2;
    
    878 878
     
    
    879
    +
    
    879 880
         ey1 = TRUNC( ras.y );
    
    880 881
         ey2 = TRUNC( to_y );
    
    881 882
     
    
    882
    -
    
    883 883
         /* perform vertical clipping */
    
    884 884
         if ( ( ey1 >= ras.max_ey && ey2 >= ras.max_ey ) ||
    
    885 885
              ( ey1 <  ras.min_ey && ey2 <  ras.min_ey ) )
    


  • reply via email to

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