| OLD | NEW |
| 1 /***************************************************************************/ | 1 /***************************************************************************/ |
| 2 /* */ | 2 /* */ |
| 3 /* pshpic.c */ | 3 /* pshpic.c */ |
| 4 /* */ | 4 /* */ |
| 5 /* The FreeType position independent code services for pshinter module. */ | 5 /* The FreeType position independent code services for pshinter module. */ |
| 6 /* */ | 6 /* */ |
| 7 /* Copyright 2009, 2010 by */ | 7 /* Copyright 2009, 2010 by */ |
| 8 /* Oran Agra and Mickey Gabel. */ | 8 /* Oran Agra and Mickey Gabel. */ |
| 9 /* */ | 9 /* */ |
| 10 /* This file is part of the FreeType project, and may only be used, */ | 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 */ | 11 /* modified, and distributed under the terms of the FreeType project */ |
| 12 /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ | 12 /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ |
| 13 /* this file you indicate that you have read the license and */ | 13 /* this file you indicate that you have read the license and */ |
| 14 /* understand and accept it fully. */ | 14 /* understand and accept it fully. */ |
| 15 /* */ | 15 /* */ |
| 16 /***************************************************************************/ | 16 /***************************************************************************/ |
| 17 | 17 |
| 18 | 18 |
| 19 #include <ft2build.h> | 19 #include <ft2build.h> |
| 20 #include FT_FREETYPE_H | 20 #include FT_FREETYPE_H |
| 21 #include FT_INTERNAL_OBJECTS_H | 21 #include FT_INTERNAL_OBJECTS_H |
| 22 #include "pshpic.h" | 22 #include "pshpic.h" |
| 23 #include "pshnterr.h" |
| 23 | 24 |
| 24 #ifdef FT_CONFIG_OPTION_PIC | 25 #ifdef FT_CONFIG_OPTION_PIC |
| 25 | 26 |
| 26 /* forward declaration of PIC init functions from pshmod.c */ | 27 /* forward declaration of PIC init functions from pshmod.c */ |
| 27 void FT_Init_Class_pshinter_interface( FT_Library, PSHinter_Interface*); | 28 void |
| 29 FT_Init_Class_pshinter_interface( FT_Library library, |
| 30 PSHinter_Interface* clazz ); |
| 28 | 31 |
| 29 void | 32 void |
| 30 pshinter_module_class_pic_free( FT_Library library ) | 33 pshinter_module_class_pic_free( FT_Library library ) |
| 31 { | 34 { |
| 32 FT_PIC_Container* pic_container = &library->pic_container; | 35 FT_PIC_Container* pic_container = &library->pic_container; |
| 33 FT_Memory memory = library->memory; | 36 FT_Memory memory = library->memory; |
| 37 |
| 38 |
| 34 if ( pic_container->pshinter ) | 39 if ( pic_container->pshinter ) |
| 35 { | 40 { |
| 36 FT_FREE( pic_container->pshinter ); | 41 FT_FREE( pic_container->pshinter ); |
| 37 pic_container->pshinter = NULL; | 42 pic_container->pshinter = NULL; |
| 38 } | 43 } |
| 39 } | 44 } |
| 40 | 45 |
| 41 | 46 |
| 42 FT_Error | 47 FT_Error |
| 43 pshinter_module_class_pic_init( FT_Library library ) | 48 pshinter_module_class_pic_init( FT_Library library ) |
| 44 { | 49 { |
| 45 FT_PIC_Container* pic_container = &library->pic_container; | 50 FT_PIC_Container* pic_container = &library->pic_container; |
| 46 FT_Error error = PSH_Err_Ok; | 51 FT_Error error = PSH_Err_Ok; |
| 47 PSHinterPIC* container; | 52 PSHinterPIC* container; |
| 48 FT_Memory memory = library->memory; | 53 FT_Memory memory = library->memory; |
| 49 | 54 |
| 50 | 55 |
| 51 /* allocate pointer, clear and set global container pointer */ | 56 /* allocate pointer, clear and set global container pointer */ |
| 52 if ( FT_ALLOC ( container, sizeof ( *container ) ) ) | 57 if ( FT_ALLOC ( container, sizeof ( *container ) ) ) |
| 53 return error; | 58 return error; |
| 54 FT_MEM_SET( container, 0, sizeof ( *container ) ); | 59 FT_MEM_SET( container, 0, sizeof ( *container ) ); |
| 55 pic_container->pshinter = container; | 60 pic_container->pshinter = container; |
| 56 | 61 |
| 57 /* add call to initialization function when you add new scripts */ | 62 /* add call to initialization function when you add new scripts */ |
| 58 FT_Init_Class_pshinter_interface(library, &container->pshinter_interface); | 63 FT_Init_Class_pshinter_interface( |
| 64 library, &container->pshinter_interface ); |
| 59 | 65 |
| 60 /*Exit:*/ | 66 /*Exit:*/ |
| 61 if(error) | 67 if( error ) |
| 62 pshinter_module_class_pic_free(library); | 68 pshinter_module_class_pic_free( library ); |
| 63 return error; | 69 return error; |
| 64 } | 70 } |
| 65 | 71 |
| 66 | 72 |
| 67 #endif /* FT_CONFIG_OPTION_PIC */ | 73 #endif /* FT_CONFIG_OPTION_PIC */ |
| 68 | 74 |
| 69 /* END */ | 75 /* END */ |
| OLD | NEW |