misc/libfreetype/src/smooth/ftspic.c
author koda
Thu, 04 Apr 2013 14:37:19 +0200
branchwebgl
changeset 8860 bde641cf53c8
parent 5172 88f2e05288ba
permissions -rw-r--r--
remove now-unused function
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
5172
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
     1
/***************************************************************************/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
     2
/*                                                                         */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
     3
/*  ftspic.c                                                               */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
     4
/*                                                                         */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
     5
/*    The FreeType position independent code services for smooth module.   */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
     6
/*                                                                         */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
     7
/*  Copyright 2009, 2010 by                                                */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
     8
/*  Oran Agra and Mickey Gabel.                                            */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
     9
/*                                                                         */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    10
/*  This file is part of the FreeType project, and may only be used,       */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    11
/*  modified, and distributed under the terms of the FreeType project      */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    12
/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    13
/*  this file you indicate that you have read the license and              */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    14
/*  understand and accept it fully.                                        */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    15
/*                                                                         */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    16
/***************************************************************************/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    17
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    18
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    19
#include <ft2build.h>
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    20
#include FT_FREETYPE_H
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    21
#include FT_INTERNAL_OBJECTS_H
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    22
#include "ftspic.h"
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    23
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    24
#ifdef FT_CONFIG_OPTION_PIC
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    25
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    26
  /* forward declaration of PIC init functions from ftgrays.c */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    27
  void FT_Init_Class_ft_grays_raster(FT_Raster_Funcs*);
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    28
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    29
  void
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    30
  ft_smooth_renderer_class_pic_free(  FT_Library library )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    31
  {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    32
    FT_PIC_Container* pic_container = &library->pic_container;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    33
    FT_Memory memory = library->memory;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    34
    if ( pic_container->smooth )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    35
    {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    36
      SmoothPIC* container = (SmoothPIC*)pic_container->smooth;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    37
      if(--container->ref_count)
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    38
        return;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    39
      FT_FREE( container );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    40
      pic_container->smooth = NULL;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    41
    }
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    42
  }
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    43
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    44
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    45
  FT_Error
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    46
  ft_smooth_renderer_class_pic_init( FT_Library  library )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    47
  {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    48
    FT_PIC_Container*  pic_container = &library->pic_container;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    49
    FT_Error           error         = Smooth_Err_Ok;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    50
    SmoothPIC*         container;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    51
    FT_Memory          memory        = library->memory;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    52
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    53
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    54
    /* since this function also serve smooth_lcd and smooth_lcdv renderers, 
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    55
       it implements reference counting */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    56
    if(pic_container->smooth)
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    57
    {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    58
      ((SmoothPIC*)pic_container->smooth)->ref_count++;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    59
      return error;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    60
    }
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    61
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    62
    /* allocate pointer, clear and set global container pointer */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    63
    if ( FT_ALLOC ( container, sizeof ( *container ) ) )
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    64
      return error;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    65
    FT_MEM_SET( container, 0, sizeof(*container) );
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    66
    pic_container->smooth = container;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    67
    container->ref_count = 1;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    68
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    69
    /* initialize pointer table - this is how the module usually expects this data */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    70
    FT_Init_Class_ft_grays_raster(&container->ft_grays_raster);
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    71
/*Exit:*/
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    72
    if(error)
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    73
      ft_smooth_renderer_class_pic_free(library);
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    74
    return error;
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    75
  }
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    76
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    77
  /* re-route these init and free functions to the above functions */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    78
  FT_Error ft_smooth_lcd_renderer_class_pic_init(FT_Library library)
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    79
  {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    80
    return ft_smooth_renderer_class_pic_init(library);
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    81
  }
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    82
  void ft_smooth_lcd_renderer_class_pic_free(FT_Library library)
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    83
  {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    84
    ft_smooth_renderer_class_pic_free(library);
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    85
  }
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    86
  FT_Error ft_smooth_lcdv_renderer_class_pic_init(FT_Library library)
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    87
  {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    88
    return ft_smooth_renderer_class_pic_init(library);
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    89
  }
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    90
  void ft_smooth_lcdv_renderer_class_pic_free(FT_Library library)
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    91
  {
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    92
    ft_smooth_renderer_class_pic_free(library);
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    93
  }
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    94
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    95
#endif /* FT_CONFIG_OPTION_PIC */
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    96
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    97
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    98
/* END */