1 /***************************************************************************/
5 /* The FreeType position independent code services for smooth module. */
7 /* Copyright 2009, 2010 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
25 #ifdef FT_CONFIG_OPTION_PIC
27 /* forward declaration of PIC init functions from ftgrays.c */
29 FT_Init_Class_ft_grays_raster( FT_Raster_Funcs* funcs );
32 ft_smooth_renderer_class_pic_free( FT_Library library )
34 FT_PIC_Container* pic_container = &library->pic_container;
35 FT_Memory memory = library->memory;
38 if ( pic_container->smooth )
40 SmoothPIC* container = (SmoothPIC*)pic_container->smooth;
43 if ( --container->ref_count )
46 pic_container->smooth = NULL;
52 ft_smooth_renderer_class_pic_init( FT_Library library )
54 FT_PIC_Container* pic_container = &library->pic_container;
55 FT_Error error = Smooth_Err_Ok;
57 FT_Memory memory = library->memory;
60 /* since this function also serve smooth_lcd and smooth_lcdv renderers,
61 it implements reference counting */
62 if ( pic_container->smooth )
64 ((SmoothPIC*)pic_container->smooth)->ref_count++;
68 /* allocate pointer, clear and set global container pointer */
69 if ( FT_ALLOC ( container, sizeof ( *container ) ) )
71 FT_MEM_SET( container, 0, sizeof ( *container ) );
72 pic_container->smooth = container;
73 container->ref_count = 1;
75 /* initialize pointer table - this is how the module usually expects this data */
76 FT_Init_Class_ft_grays_raster( &container->ft_grays_raster );
79 ft_smooth_renderer_class_pic_free( library );
83 /* re-route these init and free functions to the above functions */
84 FT_Error ft_smooth_lcd_renderer_class_pic_init( FT_Library library )
86 return ft_smooth_renderer_class_pic_init( library );
89 void ft_smooth_lcd_renderer_class_pic_free( FT_Library library )
91 ft_smooth_renderer_class_pic_free( library );
94 FT_Error ft_smooth_lcdv_renderer_class_pic_init( FT_Library library )
96 return ft_smooth_renderer_class_pic_init( library );
99 void ft_smooth_lcdv_renderer_class_pic_free( FT_Library library )
101 ft_smooth_renderer_class_pic_free( library );
104 #endif /* FT_CONFIG_OPTION_PIC */