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

Side by Side Diff: src/base/ftbitmap.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/base/ftbase.c ('k') | src/base/ftcalc.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 /* ftbitmap.c */ 3 /* ftbitmap.c */
4 /* */ 4 /* */
5 /* FreeType utility functions for bitmaps (body). */ 5 /* FreeType utility functions for bitmaps (body). */
6 /* */ 6 /* */
7 /* Copyright 2004, 2005, 2006, 2007, 2008, 2009 by */ 7 /* Copyright 2004-2009, 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 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 224
225 if ( !library ) 225 if ( !library )
226 return FT_Err_Invalid_Library_Handle; 226 return FT_Err_Invalid_Library_Handle;
227 227
228 if ( !bitmap || !bitmap->buffer ) 228 if ( !bitmap || !bitmap->buffer )
229 return FT_Err_Invalid_Argument; 229 return FT_Err_Invalid_Argument;
230 230
231 if ( ( ( FT_PIX_ROUND( xStrength ) >> 6 ) > FT_INT_MAX ) || 231 if ( ( ( FT_PIX_ROUND( xStrength ) >> 6 ) > FT_INT_MAX ) ||
232 ( ( FT_PIX_ROUND( yStrength ) >> 6 ) > FT_INT_MAX ) ) 232 ( ( FT_PIX_ROUND( yStrength ) >> 6 ) > FT_INT_MAX ) )
233 return FT_Err_Invalid_Argument; 233 return FT_Err_Invalid_Argument;
234 234
235 xstr = (FT_Int)FT_PIX_ROUND( xStrength ) >> 6; 235 xstr = (FT_Int)FT_PIX_ROUND( xStrength ) >> 6;
236 ystr = (FT_Int)FT_PIX_ROUND( yStrength ) >> 6; 236 ystr = (FT_Int)FT_PIX_ROUND( yStrength ) >> 6;
237 237
238 if ( xstr == 0 && ystr == 0 ) 238 if ( xstr == 0 && ystr == 0 )
239 return FT_Err_Ok; 239 return FT_Err_Ok;
240 else if ( xstr < 0 || ystr < 0 ) 240 else if ( xstr < 0 || ystr < 0 )
241 return FT_Err_Invalid_Argument; 241 return FT_Err_Invalid_Argument;
242 242
243 switch ( bitmap->pixel_mode ) 243 switch ( bitmap->pixel_mode )
244 { 244 {
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
410 pad = 0; 410 pad = 0;
411 if ( alignment > 0 ) 411 if ( alignment > 0 )
412 { 412 {
413 pad = source->width % alignment; 413 pad = source->width % alignment;
414 if ( pad != 0 ) 414 if ( pad != 0 )
415 pad = alignment - pad; 415 pad = alignment - pad;
416 } 416 }
417 417
418 target->pitch = source->width + pad; 418 target->pitch = source->width + pad;
419 419
420 if ( target->pitch > 0 &&
421 (FT_ULong)target->rows > FT_ULONG_MAX / target->pitch )
422 return FT_Err_Invalid_Argument;
423
420 if ( target->rows * target->pitch > old_size && 424 if ( target->rows * target->pitch > old_size &&
421 FT_QREALLOC( target->buffer, 425 FT_QREALLOC( target->buffer,
422 old_size, target->rows * target->pitch ) ) 426 old_size, target->rows * target->pitch ) )
423 return error; 427 return error;
424 } 428 }
425 break; 429 break;
426 430
427 default: 431 default:
428 error = FT_Err_Invalid_Argument; 432 error = FT_Err_Invalid_Argument;
429 } 433 }
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
654 memory = library->memory; 658 memory = library->memory;
655 659
656 FT_FREE( bitmap->buffer ); 660 FT_FREE( bitmap->buffer );
657 *bitmap = null_bitmap; 661 *bitmap = null_bitmap;
658 662
659 return FT_Err_Ok; 663 return FT_Err_Ok;
660 } 664 }
661 665
662 666
663 /* END */ 667 /* END */
OLDNEW
« no previous file with comments | « src/base/ftbase.c ('k') | src/base/ftcalc.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698