Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(231)

Side by Side Diff: src/smooth/ftspic.c

Issue 23555005: Update freetype to the latest version of Android external/freetype (Closed) Base URL: https://chromium.googlesource.com/chromium/src/third_party/freetype.git@master
Patch Set: Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/smooth/ftspic.h ('k') | src/truetype/ttdriver.c » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /***************************************************************************/ 1 /***************************************************************************/
2 /* */ 2 /* */
3 /* ftspic.c */ 3 /* ftspic.c */
4 /* */ 4 /* */
5 /* The FreeType position independent code services for smooth module. */ 5 /* The FreeType position independent code services for smooth 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 "ftspic.h" 22 #include "ftspic.h"
23 #include "ftsmerrs.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 ftgrays.c */ 27 /* forward declaration of PIC init functions from ftgrays.c */
27 void FT_Init_Class_ft_grays_raster(FT_Raster_Funcs*); 28 void
29 FT_Init_Class_ft_grays_raster( FT_Raster_Funcs* funcs );
28 30
29 void 31 void
30 ft_smooth_renderer_class_pic_free( FT_Library library ) 32 ft_smooth_renderer_class_pic_free( FT_Library library )
31 { 33 {
32 FT_PIC_Container* pic_container = &library->pic_container; 34 FT_PIC_Container* pic_container = &library->pic_container;
33 FT_Memory memory = library->memory; 35 FT_Memory memory = library->memory;
36
37
34 if ( pic_container->smooth ) 38 if ( pic_container->smooth )
35 { 39 {
36 SmoothPIC* container = (SmoothPIC*)pic_container->smooth; 40 SmoothPIC* container = (SmoothPIC*)pic_container->smooth;
37 if(--container->ref_count) 41
42
43 if ( --container->ref_count )
38 return; 44 return;
39 FT_FREE( container ); 45 FT_FREE( container );
40 pic_container->smooth = NULL; 46 pic_container->smooth = NULL;
41 } 47 }
42 } 48 }
43 49
44 50
45 FT_Error 51 FT_Error
46 ft_smooth_renderer_class_pic_init( FT_Library library ) 52 ft_smooth_renderer_class_pic_init( FT_Library library )
47 { 53 {
48 FT_PIC_Container* pic_container = &library->pic_container; 54 FT_PIC_Container* pic_container = &library->pic_container;
49 FT_Error error = Smooth_Err_Ok; 55 FT_Error error = Smooth_Err_Ok;
50 SmoothPIC* container; 56 SmoothPIC* container;
51 FT_Memory memory = library->memory; 57 FT_Memory memory = library->memory;
52 58
53 59
54 /* since this function also serve smooth_lcd and smooth_lcdv renderers, 60 /* since this function also serve smooth_lcd and smooth_lcdv renderers,
55 it implements reference counting */ 61 it implements reference counting */
56 if(pic_container->smooth) 62 if ( pic_container->smooth )
57 { 63 {
58 ((SmoothPIC*)pic_container->smooth)->ref_count++; 64 ((SmoothPIC*)pic_container->smooth)->ref_count++;
59 return error; 65 return error;
60 } 66 }
61 67
62 /* allocate pointer, clear and set global container pointer */ 68 /* allocate pointer, clear and set global container pointer */
63 if ( FT_ALLOC ( container, sizeof ( *container ) ) ) 69 if ( FT_ALLOC ( container, sizeof ( *container ) ) )
64 return error; 70 return error;
65 FT_MEM_SET( container, 0, sizeof(*container) ); 71 FT_MEM_SET( container, 0, sizeof ( *container ) );
66 pic_container->smooth = container; 72 pic_container->smooth = container;
67 container->ref_count = 1; 73 container->ref_count = 1;
68 74
69 /* initialize pointer table - this is how the module usually expects this da ta */ 75 /* initialize pointer table - this is how the module usually expects this da ta */
70 FT_Init_Class_ft_grays_raster(&container->ft_grays_raster); 76 FT_Init_Class_ft_grays_raster( &container->ft_grays_raster );
71 /*Exit:*/ 77 /*Exit:*/
72 if(error) 78 if ( error )
73 ft_smooth_renderer_class_pic_free(library); 79 ft_smooth_renderer_class_pic_free( library );
74 return error; 80 return error;
75 } 81 }
76 82
77 /* re-route these init and free functions to the above functions */ 83 /* re-route these init and free functions to the above functions */
78 FT_Error ft_smooth_lcd_renderer_class_pic_init(FT_Library library) 84 FT_Error ft_smooth_lcd_renderer_class_pic_init( FT_Library library )
79 { 85 {
80 return ft_smooth_renderer_class_pic_init(library); 86 return ft_smooth_renderer_class_pic_init( library );
81 } 87 }
82 void ft_smooth_lcd_renderer_class_pic_free(FT_Library library) 88
89 void ft_smooth_lcd_renderer_class_pic_free( FT_Library library )
83 { 90 {
84 ft_smooth_renderer_class_pic_free(library); 91 ft_smooth_renderer_class_pic_free( library );
85 } 92 }
86 FT_Error ft_smooth_lcdv_renderer_class_pic_init(FT_Library library) 93
94 FT_Error ft_smooth_lcdv_renderer_class_pic_init( FT_Library library )
87 { 95 {
88 return ft_smooth_renderer_class_pic_init(library); 96 return ft_smooth_renderer_class_pic_init( library );
89 } 97 }
90 void ft_smooth_lcdv_renderer_class_pic_free(FT_Library library) 98
99 void ft_smooth_lcdv_renderer_class_pic_free( FT_Library library )
91 { 100 {
92 ft_smooth_renderer_class_pic_free(library); 101 ft_smooth_renderer_class_pic_free( library );
93 } 102 }
94 103
95 #endif /* FT_CONFIG_OPTION_PIC */ 104 #endif /* FT_CONFIG_OPTION_PIC */
96 105
97 106
98 /* END */ 107 /* END */
OLDNEW
« no previous file with comments | « src/smooth/ftspic.h ('k') | src/truetype/ttdriver.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698