ReactOS  0.4.15-dev-4923-g379188a
ftspic.c
Go to the documentation of this file.
1 /***************************************************************************/
2 /* */
3 /* ftspic.c */
4 /* */
5 /* The FreeType position independent code services for smooth module. */
6 /* */
7 /* Copyright 2009-2018 by */
8 /* Oran Agra and Mickey Gabel. */
9 /* */
10 /* This file is part of the FreeType project, and may only be used, */
11 /* modified, and distributed under the terms of the FreeType project */
12 /* license, LICENSE.TXT. By continuing to use, modify, or distribute */
13 /* this file you indicate that you have read the license and */
14 /* understand and accept it fully. */
15 /* */
16 /***************************************************************************/
17 
18 
19 #include <ft2build.h>
20 #include FT_FREETYPE_H
21 #include FT_INTERNAL_OBJECTS_H
22 #include "ftspic.h"
23 #include "ftsmerrs.h"
24 
25 
26 #ifdef FT_CONFIG_OPTION_PIC
27 
28  /* forward declaration of PIC init functions from ftgrays.c */
29  void
30  FT_Init_Class_ft_grays_raster( FT_Raster_Funcs* funcs );
31 
32 
33  void
34  ft_smooth_renderer_class_pic_free( FT_Library library )
35  {
36  FT_PIC_Container* pic_container = &library->pic_container;
38 
39 
40  if ( pic_container->smooth )
41  {
42  SmoothPIC* container = (SmoothPIC*)pic_container->smooth;
43 
44 
45  if ( --container->ref_count )
46  return;
47 
48  FT_FREE( container );
49  pic_container->smooth = NULL;
50  }
51  }
52 
53 
54  FT_Error
55  ft_smooth_renderer_class_pic_init( FT_Library library )
56  {
57  FT_PIC_Container* pic_container = &library->pic_container;
59  SmoothPIC* container = NULL;
61 
62 
63  /* since this function also serve smooth_lcd and smooth_lcdv renderers,
64  it implements reference counting */
65  if ( pic_container->smooth )
66  {
67  ((SmoothPIC*)pic_container->smooth)->ref_count++;
68  return error;
69  }
70 
71  /* allocate pointer, clear and set global container pointer */
72  if ( FT_ALLOC( container, sizeof ( *container ) ) )
73  return error;
74  FT_MEM_SET( container, 0, sizeof ( *container ) );
75  pic_container->smooth = container;
76 
77  container->ref_count = 1;
78 
79  /* initialize pointer table - */
80  /* this is how the module usually expects this data */
81  FT_Init_Class_ft_grays_raster( &container->ft_grays_raster );
82 
83  return error;
84  }
85 
86 
87  /* re-route these init and free functions to the above functions */
88  FT_Error
89  ft_smooth_lcd_renderer_class_pic_init( FT_Library library )
90  {
91  return ft_smooth_renderer_class_pic_init( library );
92  }
93 
94 
95  void
96  ft_smooth_lcd_renderer_class_pic_free( FT_Library library )
97  {
98  ft_smooth_renderer_class_pic_free( library );
99  }
100 
101 
102  FT_Error
103  ft_smooth_lcdv_renderer_class_pic_init( FT_Library library )
104  {
105  return ft_smooth_renderer_class_pic_init( library );
106  }
107 
108 
109  void
110  ft_smooth_lcdv_renderer_class_pic_free( FT_Library library )
111  {
112  ft_smooth_renderer_class_pic_free( library );
113  }
114 
115 #endif /* FT_CONFIG_OPTION_PIC */
116 
117 
118 /* END */
#define FT_ALLOC(ptr, size)
Definition: ftmemory.h:303
int FT_Error
Definition: fttypes.h:300
FT_Memory memory
Definition: ftobjs.h:918
#define error(str)
Definition: mkdosfs.c:1605
if(dx==0 &&dy==0)
Definition: linetemp.h:174
FT_Library library
Definition: cffdrivr.c:654
return FT_Err_Ok
Definition: ftbbox.c:511
static char memory[1024 *256]
Definition: process.c:116
struct container container
#define FT_FREE(ptr)
Definition: ftmemory.h:329
static struct __wine_debug_functions funcs
Definition: debug.c:59
typedefFT_BEGIN_HEADER struct FT_MemoryRec_ * FT_Memory
Definition: ftsystem.h:66
#define NULL
Definition: types.h:112
#define FT_MEM_SET(dest, byte, count)
Definition: ftmemory.h:225