freetype-devel
[Top][All Lists]
Advanced

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

Re: [ft-devel] [freetype2] master 25e82bc: [smooth] Consolidate memory m


From: Behdad Esfahbod
Subject: Re: [ft-devel] [freetype2] master 25e82bc: [smooth] Consolidate memory management.
Date: Fri, 24 Jun 2016 10:03:22 -0400

Cool.  Thanks for doing this.

On Thu, Jun 23, 2016 at 11:24 PM, Alexei Podtelezhnikov
<address@hidden> wrote:
> branch: master
> commit 25e82bc2b54054b1819c92bad01b623de7d380c7
> Author: Alexei Podtelezhnikov <address@hidden>
> Commit: Alexei Podtelezhnikov <address@hidden>
>
>     [smooth] Consolidate memory management.
>
>     * src/smooth/ftgrays.c (gray_init_cells): Remove function.
>     (gray_TWorker): Remove fields that become local variables.
>     (gray_raster_render): Move rendering buffer declaration from here.
>     (gray_convert_glyph): ... to here and update accordingly.
> ---
>  ChangeLog            |    9 +++++++++
>  src/smooth/ftgrays.c |   43 ++++++-------------------------------------
>  2 files changed, 15 insertions(+), 37 deletions(-)
>
> diff --git a/ChangeLog b/ChangeLog
> index 219b5a6..a57b267 100644
> --- a/ChangeLog
> +++ b/ChangeLog
> @@ -1,3 +1,12 @@
> +2016-06-23  Alexei Podtelezhnikov  <address@hidden>
> +
> +       [smooth] Consolidate memory management.
> +
> +       * src/smooth/ftgrays.c (gray_init_cells): Remove function.
> +       (gray_TWorker): Remove fields that become local variables.
> +       (gray_raster_render): Move rendering buffer declaration from here.
> +       (gray_convert_glyph): ... to here and update accordingly.
> +
>  2016-06-22  Alexei Podtelezhnikov  <address@hidden>
>
>         [smooth] Consolidate boundary checks.
> diff --git a/src/smooth/ftgrays.c b/src/smooth/ftgrays.c
> index 85d39c1..140ec8e 100644
> --- a/src/smooth/ftgrays.c
> +++ b/src/smooth/ftgrays.c
> @@ -452,11 +452,6 @@ typedef ptrdiff_t  FT_PtrDist;
>      void*                render_span_data;
>      int                  span_y;
>
> -    int  band_size;
> -
> -    void*       buffer;
> -    long        buffer_size;
> -
>      PCell*     ycells;
>      TPos       ycount;
>
> @@ -510,27 +505,6 @@ typedef ptrdiff_t  FT_PtrDist;
>
>    /*************************************************************************/
>    /*                                                                       */
> -  /* Initialize the cells table.                                           */
> -  /*                                                                       */
> -  static void
> -  gray_init_cells( RAS_ARG_ void*  buffer,
> -                            long   byte_size )
> -  {
> -    ras.buffer      = buffer;
> -    ras.buffer_size = byte_size;
> -
> -    ras.ycells      = (PCell*) buffer;
> -    ras.cells       = NULL;
> -    ras.max_cells   = 0;
> -    ras.num_cells   = 0;
> -    ras.area        = 0;
> -    ras.cover       = 0;
> -    ras.invalid     = 1;
> -  }
> -
> -
> -  /*************************************************************************/
> -  /*                                                                       */
>    /* Record the current cell in the table.                                 */
>    /*                                                                       */
>    static PCell
> @@ -1910,6 +1884,8 @@ typedef ptrdiff_t  FT_PtrDist;
>    static int
>    gray_convert_glyph( RAS_ARG )
>    {
> +    TCell                 buffer[FT_MAX_GRAY_POOL];
> +    const int             band_size = FT_MAX_GRAY_POOL / 8;
>      gray_TBand            bands[40];
>      gray_TBand* volatile  band;
>      int volatile          n, num_bands;
> @@ -1917,7 +1893,7 @@ typedef ptrdiff_t  FT_PtrDist;
>
>
>      /* set up vertical bands */
> -    num_bands = (int)( ( ras.max_ey - ras.min_ey ) / ras.band_size );
> +    num_bands = (int)( ( ras.max_ey - ras.min_ey ) / band_size );
>      if ( num_bands == 0 )
>        num_bands = 1;
>      if ( num_bands >= 39 )
> @@ -1928,7 +1904,7 @@ typedef ptrdiff_t  FT_PtrDist;
>
>      for ( n = 0; n < num_bands; n++, min = max )
>      {
> -      max = min + ras.band_size;
> +      max = min + band_size;
>        if ( n == num_bands - 1 || max > max_y )
>          max = max_y;
>
> @@ -1954,10 +1930,10 @@ typedef ptrdiff_t  FT_PtrDist;
>            if ( FT_MAX_GRAY_POOL - cell_start < 2 )
>              goto ReduceBands;
>
> -          ras.cells     = (PCell)ras.buffer + cell_start;
> +          ras.cells     = buffer + cell_start;
>            ras.max_cells = (FT_PtrDist)( FT_MAX_GRAY_POOL - cell_start );
>
> -          ras.ycells = (PCell*)ras.buffer;
> +          ras.ycells = (PCell*)buffer;
>            ras.ycount = (TPos)ycount;
>            while ( ycount )
>              ras.ycells[--ycount] = NULL;
> @@ -2018,8 +1994,6 @@ typedef ptrdiff_t  FT_PtrDist;
>
>      gray_TWorker  worker[1];
>
> -    TCell  buffer[FT_MAX_GRAY_POOL];
> -
>
>      if ( !raster )
>        return FT_THROW( Invalid_Argument );
> @@ -2100,12 +2074,7 @@ typedef ptrdiff_t  FT_PtrDist;
>      ras.count_ex = ras.max_ex - ras.min_ex;
>      ras.count_ey = ras.max_ey - ras.min_ey;
>
> -    gray_init_cells( RAS_VAR_ buffer, sizeof ( buffer ) );
> -
>      ras.outline        = *outline;
> -    ras.num_cells      = 0;
> -    ras.invalid        = 1;
> -    ras.band_size      = FT_MAX_GRAY_POOL / 8;
>      ras.num_gray_spans = 0;
>      ras.span_y         = 0;
>
>



-- 
behdad
http://behdad.org/



reply via email to

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