Home | Info | Community | Development | myReactOS | Contact Us
ReactOS Development > Doxygenftspic.c
Go to the documentation of this file.
00001 /***************************************************************************/ 00002 /* */ 00003 /* ftspic.c */ 00004 /* */ 00005 /* The FreeType position independent code services for smooth module. */ 00006 /* */ 00007 /* Copyright 2009, 2010 by */ 00008 /* Oran Agra and Mickey Gabel. */ 00009 /* */ 00010 /* This file is part of the FreeType project, and may only be used, */ 00011 /* modified, and distributed under the terms of the FreeType project */ 00012 /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ 00013 /* this file you indicate that you have read the license and */ 00014 /* understand and accept it fully. */ 00015 /* */ 00016 /***************************************************************************/ 00017 00018 00019 #include <ft2build.h> 00020 #include FT_FREETYPE_H 00021 #include FT_INTERNAL_OBJECTS_H 00022 #include "ftspic.h" 00023 00024 #ifdef FT_CONFIG_OPTION_PIC 00025 00026 /* forward declaration of PIC init functions from ftgrays.c */ 00027 void FT_Init_Class_ft_grays_raster(FT_Raster_Funcs*); 00028 00029 void 00030 ft_smooth_renderer_class_pic_free( FT_Library library ) 00031 { 00032 FT_PIC_Container* pic_container = &library->pic_container; 00033 FT_Memory memory = library->memory; 00034 if ( pic_container->smooth ) 00035 { 00036 SmoothPIC* container = (SmoothPIC*)pic_container->smooth; 00037 if(--container->ref_count) 00038 return; 00039 FT_FREE( container ); 00040 pic_container->smooth = NULL; 00041 } 00042 } 00043 00044 00045 FT_Error 00046 ft_smooth_renderer_class_pic_init( FT_Library library ) 00047 { 00048 FT_PIC_Container* pic_container = &library->pic_container; 00049 FT_Error error = Smooth_Err_Ok; 00050 SmoothPIC* container; 00051 FT_Memory memory = library->memory; 00052 00053 00054 /* since this function also serve smooth_lcd and smooth_lcdv renderers, 00055 it implements reference counting */ 00056 if(pic_container->smooth) 00057 { 00058 ((SmoothPIC*)pic_container->smooth)->ref_count++; 00059 return error; 00060 } 00061 00062 /* allocate pointer, clear and set global container pointer */ 00063 if ( FT_ALLOC ( container, sizeof ( *container ) ) ) 00064 return error; 00065 FT_MEM_SET( container, 0, sizeof(*container) ); 00066 pic_container->smooth = container; 00067 container->ref_count = 1; 00068 00069 /* initialize pointer table - this is how the module usually expects this data */ 00070 FT_Init_Class_ft_grays_raster(&container->ft_grays_raster); 00071 /*Exit:*/ 00072 if(error) 00073 ft_smooth_renderer_class_pic_free(library); 00074 return error; 00075 } 00076 00077 /* re-route these init and free functions to the above functions */ 00078 FT_Error ft_smooth_lcd_renderer_class_pic_init(FT_Library library) 00079 { 00080 return ft_smooth_renderer_class_pic_init(library); 00081 } 00082 void ft_smooth_lcd_renderer_class_pic_free(FT_Library library) 00083 { 00084 ft_smooth_renderer_class_pic_free(library); 00085 } 00086 FT_Error ft_smooth_lcdv_renderer_class_pic_init(FT_Library library) 00087 { 00088 return ft_smooth_renderer_class_pic_init(library); 00089 } 00090 void ft_smooth_lcdv_renderer_class_pic_free(FT_Library library) 00091 { 00092 ft_smooth_renderer_class_pic_free(library); 00093 } 00094 00095 #endif /* FT_CONFIG_OPTION_PIC */ 00096 00097 00098 /* END */ Generated on Sun May 27 2012 04:34:02 for ReactOS by
1.7.6.1
|