| Index: third_party/freetype/src/sfnt/pngshim.c
|
| diff --git a/third_party/freetype/src/sfnt/pngshim.c b/third_party/freetype/src/sfnt/pngshim.c
|
| index 9bfcc2a779bcd665a97185b6d66c3206ddd2d596..ea60452635a34c58d71c20bdec182fd4c1cc573b 100644
|
| --- a/third_party/freetype/src/sfnt/pngshim.c
|
| +++ b/third_party/freetype/src/sfnt/pngshim.c
|
| @@ -4,7 +4,8 @@
|
| /* */
|
| /* PNG Bitmap glyph support. */
|
| /* */
|
| -/* Copyright 2013, 2014 by Google, Inc. */
|
| +/* Copyright 2013-2015 by */
|
| +/* Google, Inc. */
|
| /* Written by Stuart Gill and Behdad Esfahbod. */
|
| /* */
|
| /* This file is part of the FreeType project, and may only be used, */
|
| @@ -36,11 +37,11 @@
|
| /* This code is freely based on cairo-png.c. There's so many ways */
|
| /* to call libpng, and the way cairo does it is defacto standard. */
|
|
|
| - static int
|
| - multiply_alpha( int alpha,
|
| - int color )
|
| + static unsigned int
|
| + multiply_alpha( unsigned int alpha,
|
| + unsigned int color )
|
| {
|
| - int temp = ( alpha * color ) + 0x80;
|
| + unsigned int temp = alpha * color + 0x80;
|
|
|
|
|
| return ( temp + ( temp >> 8 ) ) >> 8;
|
| @@ -81,10 +82,10 @@
|
| blue = multiply_alpha( alpha, blue );
|
| }
|
|
|
| - base[0] = blue;
|
| - base[1] = green;
|
| - base[2] = red;
|
| - base[3] = alpha;
|
| + base[0] = (unsigned char)blue;
|
| + base[1] = (unsigned char)green;
|
| + base[2] = (unsigned char)red;
|
| + base[3] = (unsigned char)alpha;
|
| }
|
| }
|
| }
|
| @@ -109,9 +110,9 @@
|
| unsigned int blue = base[2];
|
|
|
|
|
| - base[0] = blue;
|
| - base[1] = green;
|
| - base[2] = red;
|
| + base[0] = (unsigned char)blue;
|
| + base[1] = (unsigned char)green;
|
| + base[2] = (unsigned char)red;
|
| base[3] = 0xFF;
|
| }
|
| }
|
| @@ -257,16 +258,16 @@
|
|
|
| if ( populate_map_and_metrics )
|
| {
|
| - FT_Long size;
|
| + FT_ULong size;
|
|
|
|
|
| - metrics->width = (FT_Int)imgWidth;
|
| - metrics->height = (FT_Int)imgHeight;
|
| + metrics->width = (FT_UShort)imgWidth;
|
| + metrics->height = (FT_UShort)imgHeight;
|
|
|
| map->width = metrics->width;
|
| map->rows = metrics->height;
|
| map->pixel_mode = FT_PIXEL_MODE_BGRA;
|
| - map->pitch = map->width * 4;
|
| + map->pitch = (int)( map->width * 4 );
|
| map->num_grays = 256;
|
|
|
| /* reject too large bitmaps similarly to the rasterizer */
|
| @@ -277,7 +278,7 @@
|
| }
|
|
|
| /* this doesn't overflow: 0x7FFF * 0x7FFF * 4 < 2^32 */
|
| - size = map->rows * map->pitch;
|
| + size = map->rows * (FT_ULong)map->pitch;
|
|
|
| error = ft_glyphslot_alloc_bitmap( slot, size );
|
| if ( error )
|
|
|