1 /***************************************************************************/
5 /* The FreeType position independent code services for smooth module. */
7 /* Copyright 2009, 2010, 2012, 2013 by */
8 /* Oran Agra and Mickey Gabel. */
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. */
16 /***************************************************************************/
20 #include FT_FREETYPE_H
21 #include FT_INTERNAL_OBJECTS_H
26 #ifdef FT_CONFIG_OPTION_PIC
28 /* forward declaration of PIC init functions from ftgrays.c */
30 FT_Init_Class_ft_grays_raster( FT_Raster_Funcs* funcs );
34 ft_smooth_renderer_class_pic_free( FT_Library library )
36 FT_PIC_Container* pic_container = &library->pic_container;
37 FT_Memory memory = library->memory;
40 if ( pic_container->smooth )
42 SmoothPIC* container = (SmoothPIC*)pic_container->smooth;
45 if ( --container->ref_count )
49 pic_container->smooth = NULL;
55 ft_smooth_renderer_class_pic_init( FT_Library library )
57 FT_PIC_Container* pic_container = &library->pic_container;
58 FT_Error error = FT_Err_Ok;
59 SmoothPIC* container = NULL;
60 FT_Memory memory = library->memory;
63 /* since this function also serve smooth_lcd and smooth_lcdv renderers,
64 it implements reference counting */
65 if ( pic_container->smooth )
67 ((SmoothPIC*)pic_container->smooth)->ref_count++;
71 /* allocate pointer, clear and set global container pointer */
72 if ( FT_ALLOC( container, sizeof ( *container ) ) )
74 FT_MEM_SET( container, 0, sizeof ( *container ) );
75 pic_container->smooth = container;
77 container->ref_count = 1;
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 );
87 /* re-route these init and free functions to the above functions */
89 ft_smooth_lcd_renderer_class_pic_init( FT_Library library )
91 return ft_smooth_renderer_class_pic_init( library );
96 ft_smooth_lcd_renderer_class_pic_free( FT_Library library )
98 ft_smooth_renderer_class_pic_free( library );
103 ft_smooth_lcdv_renderer_class_pic_init( FT_Library library )
105 return ft_smooth_renderer_class_pic_init( library );
110 ft_smooth_lcdv_renderer_class_pic_free( FT_Library library )
112 ft_smooth_renderer_class_pic_free( library );
115 #endif /* FT_CONFIG_OPTION_PIC */