diff options
author | Makoto Onuki <omakoto@google.com> | 2015-06-09 16:35:08 -0700 |
---|---|---|
committer | Makoto Onuki <omakoto@google.com> | 2015-06-10 14:52:29 -0700 |
commit | ec62c527eb34ee4481a0153ceb42dfd35d7e1d26 (patch) | |
tree | 7e67208cafc4572557e8d10469fb5dc173ca2edf /src/base/ftlcdfil.c | |
parent | b7aab0ad37ad69279e367e5960912fc3ff778233 (diff) | |
download | android_external_freetype-ec62c527eb34ee4481a0153ceb42dfd35d7e1d26.tar.gz android_external_freetype-ec62c527eb34ee4481a0153ceb42dfd35d7e1d26.tar.bz2 android_external_freetype-ec62c527eb34ee4481a0153ceb42dfd35d7e1d26.zip |
Update to freetype 2.6.0
Bug 18751561
Change-Id: I871cc2925dc5908ec48073e11ecffad1924bbf50
Diffstat (limited to 'src/base/ftlcdfil.c')
-rw-r--r-- | src/base/ftlcdfil.c | 29 |
1 files changed, 24 insertions, 5 deletions
diff --git a/src/base/ftlcdfil.c b/src/base/ftlcdfil.c index 4aefb68..ff6f7e9 100644 --- a/src/base/ftlcdfil.c +++ b/src/base/ftlcdfil.c @@ -4,7 +4,7 @@ /* */ /* FreeType API for color filtering of subpixel bitmap glyphs (body). */ /* */ -/* Copyright 2006, 2008-2010, 2013, 2014 by */ +/* Copyright 2006-2015 by */ /* David Turner, Robert Wilhelm, and Werner Lemberg. */ /* */ /* This file is part of the FreeType project, and may only be used, */ @@ -46,6 +46,10 @@ FT_Byte* line = bitmap->buffer; + /* take care of bitmap flow */ + if ( bitmap->pitch < 0 ) + line -= bitmap->pitch * (FT_Int)( bitmap->rows - 1 ); + /* `fir' and `pix' must be at least 32 bit wide, since the sum of */ /* the values in `weights' can exceed 0xFF */ @@ -106,6 +110,10 @@ FT_Int pitch = bitmap->pitch; + /* take care of bitmap flow */ + if ( bitmap->pitch < 0 ) + column -= bitmap->pitch * (FT_Int)( bitmap->rows - 1 ); + for ( ; width > 0; width--, column++ ) { FT_Byte* col = column; @@ -174,7 +182,7 @@ FT_UInt height = (FT_UInt)bitmap->rows; FT_Int pitch = bitmap->pitch; - static const int filters[3][3] = + static const unsigned int filters[3][3] = { { 65538 * 9/13, 65538 * 1/6, 65538 * 1/13 }, { 65538 * 3/13, 65538 * 4/6, 65538 * 3/13 }, @@ -190,6 +198,10 @@ FT_Byte* line = bitmap->buffer; + /* take care of bitmap flow */ + if ( bitmap->pitch < 0 ) + line -= bitmap->pitch * (FT_Int)( bitmap->rows - 1 ); + for ( ; height > 0; height--, line += pitch ) { FT_UInt xx; @@ -229,10 +241,14 @@ FT_Byte* column = bitmap->buffer; + /* take care of bitmap flow */ + if ( bitmap->pitch < 0 ) + column -= bitmap->pitch * (FT_Int)( bitmap->rows - 1 ); + for ( ; width > 0; width--, column++ ) { FT_Byte* col = column; - FT_Byte* col_end = col + height * pitch; + FT_Byte* col_end = col + (FT_Int)height * pitch; for ( ; col < col_end; col += 3 * pitch ) @@ -273,7 +289,10 @@ FT_Library_SetLcdFilterWeights( FT_Library library, unsigned char *weights ) { - if ( !library || !weights ) + if ( !library ) + return FT_THROW( Invalid_Library_Handle ); + + if ( !weights ) return FT_THROW( Invalid_Argument ); ft_memcpy( library->lcd_weights, weights, 5 ); @@ -295,7 +314,7 @@ if ( !library ) - return FT_THROW( Invalid_Argument ); + return FT_THROW( Invalid_Library_Handle ); switch ( filter ) { |