OLD | NEW |
1 /***************************************************************************/ | 1 /***************************************************************************/ |
2 /* */ | 2 /* */ |
3 /* ftrend1.c */ | 3 /* ftrend1.c */ |
4 /* */ | 4 /* */ |
5 /* The FreeType glyph rasterizer interface (body). */ | 5 /* The FreeType glyph rasterizer interface (body). */ |
6 /* */ | 6 /* */ |
7 /* Copyright 1996-2001, 2002, 2003, 2005, 2006 by */ | 7 /* Copyright 1996-2003, 2005, 2006, 2011 by */ |
8 /* David Turner, Robert Wilhelm, and Werner Lemberg. */ | 8 /* David Turner, Robert Wilhelm, and Werner Lemberg. */ |
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 |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 cbox.yMax = FT_PIX_ROUND( cbox.yMax ); | 169 cbox.yMax = FT_PIX_ROUND( cbox.yMax ); |
170 #else | 170 #else |
171 cbox.xMin = FT_PIX_FLOOR( cbox.xMin ); | 171 cbox.xMin = FT_PIX_FLOOR( cbox.xMin ); |
172 cbox.yMin = FT_PIX_FLOOR( cbox.yMin ); | 172 cbox.yMin = FT_PIX_FLOOR( cbox.yMin ); |
173 cbox.xMax = FT_PIX_CEIL( cbox.xMax ); | 173 cbox.xMax = FT_PIX_CEIL( cbox.xMax ); |
174 cbox.yMax = FT_PIX_CEIL( cbox.yMax ); | 174 cbox.yMax = FT_PIX_CEIL( cbox.yMax ); |
175 #endif | 175 #endif |
176 | 176 |
177 width = (FT_UInt)( ( cbox.xMax - cbox.xMin ) >> 6 ); | 177 width = (FT_UInt)( ( cbox.xMax - cbox.xMin ) >> 6 ); |
178 height = (FT_UInt)( ( cbox.yMax - cbox.yMin ) >> 6 ); | 178 height = (FT_UInt)( ( cbox.yMax - cbox.yMin ) >> 6 ); |
| 179 |
| 180 if ( width > FT_USHORT_MAX || height > FT_USHORT_MAX ) |
| 181 { |
| 182 error = Raster_Err_Invalid_Argument; |
| 183 goto Exit; |
| 184 } |
| 185 |
179 bitmap = &slot->bitmap; | 186 bitmap = &slot->bitmap; |
180 memory = render->root.memory; | 187 memory = render->root.memory; |
181 | 188 |
182 /* release old bitmap buffer */ | 189 /* release old bitmap buffer */ |
183 if ( slot->internal->flags & FT_GLYPH_OWN_BITMAP ) | 190 if ( slot->internal->flags & FT_GLYPH_OWN_BITMAP ) |
184 { | 191 { |
185 FT_FREE( bitmap->buffer ); | 192 FT_FREE( bitmap->buffer ); |
186 slot->internal->flags &= ~FT_GLYPH_OWN_BITMAP; | 193 slot->internal->flags &= ~FT_GLYPH_OWN_BITMAP; |
187 } | 194 } |
188 | 195 |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
230 | 237 |
231 slot->format = FT_GLYPH_FORMAT_BITMAP; | 238 slot->format = FT_GLYPH_FORMAT_BITMAP; |
232 slot->bitmap_left = (FT_Int)( cbox.xMin >> 6 ); | 239 slot->bitmap_left = (FT_Int)( cbox.xMin >> 6 ); |
233 slot->bitmap_top = (FT_Int)( cbox.yMax >> 6 ); | 240 slot->bitmap_top = (FT_Int)( cbox.yMax >> 6 ); |
234 | 241 |
235 Exit: | 242 Exit: |
236 return error; | 243 return error; |
237 } | 244 } |
238 | 245 |
239 | 246 |
240 FT_DEFINE_RENDERER(ft_raster1_renderer_class, | 247 FT_DEFINE_RENDERER( ft_raster1_renderer_class, |
241 | 248 |
242 FT_MODULE_RENDERER, | 249 FT_MODULE_RENDERER, |
243 sizeof( FT_RendererRec ), | 250 sizeof ( FT_RendererRec ), |
244 | 251 |
245 "raster1", | 252 "raster1", |
246 0x10000L, | 253 0x10000L, |
247 0x20000L, | 254 0x20000L, |
248 | 255 |
249 0, /* module specific interface */ | 256 0, /* module specific interface */ |
250 | 257 |
251 (FT_Module_Constructor)ft_raster1_init, | 258 (FT_Module_Constructor)ft_raster1_init, |
252 (FT_Module_Destructor) 0, | 259 (FT_Module_Destructor) 0, |
253 (FT_Module_Requester) 0 | 260 (FT_Module_Requester) 0 |
254 , | 261 , |
255 | 262 |
256 FT_GLYPH_FORMAT_OUTLINE, | 263 FT_GLYPH_FORMAT_OUTLINE, |
257 | 264 |
258 (FT_Renderer_RenderFunc) ft_raster1_render, | 265 (FT_Renderer_RenderFunc) ft_raster1_render, |
259 (FT_Renderer_TransformFunc)ft_raster1_transform, | 266 (FT_Renderer_TransformFunc)ft_raster1_transform, |
260 (FT_Renderer_GetCBoxFunc) ft_raster1_get_cbox, | 267 (FT_Renderer_GetCBoxFunc) ft_raster1_get_cbox, |
261 (FT_Renderer_SetModeFunc) ft_raster1_set_mode, | 268 (FT_Renderer_SetModeFunc) ft_raster1_set_mode, |
262 | 269 |
263 (FT_Raster_Funcs*) &FT_STANDARD_RASTER_GET | 270 (FT_Raster_Funcs*) &FT_STANDARD_RASTER_GET |
264 ) | 271 ) |
265 | 272 |
266 | 273 |
267 /* This renderer is _NOT_ part of the default modules; you will need */ | 274 /* This renderer is _NOT_ part of the default modules; you will need */ |
268 /* to register it by hand in your application. It should only be */ | 275 /* to register it by hand in your application. It should only be */ |
269 /* used for backwards-compatibility with FT 1.x anyway. */ | 276 /* used for backwards-compatibility with FT 1.x anyway. */ |
270 /* */ | 277 /* */ |
271 FT_DEFINE_RENDERER(ft_raster5_renderer_class, | 278 FT_DEFINE_RENDERER( ft_raster5_renderer_class, |
272 | 279 |
273 | |
274 FT_MODULE_RENDERER, | 280 FT_MODULE_RENDERER, |
275 sizeof( FT_RendererRec ), | 281 sizeof ( FT_RendererRec ), |
276 | 282 |
277 "raster5", | 283 "raster5", |
278 0x10000L, | 284 0x10000L, |
279 0x20000L, | 285 0x20000L, |
280 | 286 |
281 0, /* module specific interface */ | 287 0, /* module specific interface */ |
282 | 288 |
283 (FT_Module_Constructor)ft_raster1_init, | 289 (FT_Module_Constructor)ft_raster1_init, |
284 (FT_Module_Destructor) 0, | 290 (FT_Module_Destructor) 0, |
285 (FT_Module_Requester) 0 | 291 (FT_Module_Requester) 0 |
286 , | 292 , |
287 | 293 |
288 FT_GLYPH_FORMAT_OUTLINE, | 294 FT_GLYPH_FORMAT_OUTLINE, |
289 | 295 |
290 (FT_Renderer_RenderFunc) ft_raster1_render, | 296 (FT_Renderer_RenderFunc) ft_raster1_render, |
291 (FT_Renderer_TransformFunc)ft_raster1_transform, | 297 (FT_Renderer_TransformFunc)ft_raster1_transform, |
292 (FT_Renderer_GetCBoxFunc) ft_raster1_get_cbox, | 298 (FT_Renderer_GetCBoxFunc) ft_raster1_get_cbox, |
293 (FT_Renderer_SetModeFunc) ft_raster1_set_mode, | 299 (FT_Renderer_SetModeFunc) ft_raster1_set_mode, |
294 | 300 |
295 (FT_Raster_Funcs*) &FT_STANDARD_RASTER_GET | 301 (FT_Raster_Funcs*) &FT_STANDARD_RASTER_GET |
296 ) | 302 ) |
297 | 303 |
298 | 304 |
299 /* END */ | 305 /* END */ |
OLD | NEW |