1 /***************************************************************************/
5 /* The FreeType position independent code services for raster 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 ftraster.c */
29 FT_Init_Class_ft_standard_raster( FT_Raster_Funcs* funcs );
32 ft_raster1_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->raster )
40 RasterPIC* container = (RasterPIC*)pic_container->raster;
41 if ( --container->ref_count )
44 pic_container->raster = NULL;
50 ft_raster1_renderer_class_pic_init( FT_Library library )
52 FT_PIC_Container* pic_container = &library->pic_container;
53 FT_Error error = Raster_Err_Ok;
55 FT_Memory memory = library->memory;
58 /* since this function also serve raster5 renderer,
59 it implements reference counting */
60 if ( pic_container->raster )
62 ((RasterPIC*)pic_container->raster)->ref_count++;
66 /* allocate pointer, clear and set global container pointer */
67 if ( FT_ALLOC( container, sizeof ( *container ) ) )
69 FT_MEM_SET( container, 0, sizeof ( *container ) );
70 pic_container->raster = container;
71 container->ref_count = 1;
73 /* initialize pointer table - this is how the module usually expects this data */
74 FT_Init_Class_ft_standard_raster( &container->ft_standard_raster );
77 ft_raster1_renderer_class_pic_free( library );
81 /* re-route these init and free functions to the above functions */
83 ft_raster5_renderer_class_pic_init( FT_Library library )
85 return ft_raster1_renderer_class_pic_init( library );
89 ft_raster5_renderer_class_pic_free( FT_Library library )
91 ft_raster1_renderer_class_pic_free( library );
94 #endif /* FT_CONFIG_OPTION_PIC */