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

Unified Diff: third_party/freetype/src/base/ftlcdfil.c

Issue 815103002: Update freetype to 2.5.4. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Adjust GYP and GN Created 6 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/freetype/src/base/ftinit.c ('k') | third_party/freetype/src/base/ftmac.c » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/freetype/src/base/ftlcdfil.c
diff --git a/core/src/fxge/fx_freetype/fxft2.5.01/src/base/fxft_ftlcdfil.c b/third_party/freetype/src/base/ftlcdfil.c
similarity index 88%
rename from core/src/fxge/fx_freetype/fxft2.5.01/src/base/fxft_ftlcdfil.c
rename to third_party/freetype/src/base/ftlcdfil.c
index 66676de916a50ee45673549b1ed0c1c5c6ce0602..d8bcbbf1d222c96fcb34d55c668d239ec47aacc4 100644
--- a/core/src/fxge/fx_freetype/fxft2.5.01/src/base/fxft_ftlcdfil.c
+++ b/third_party/freetype/src/base/ftlcdfil.c
@@ -1,11 +1,10 @@
-#if !defined(_FXFT_VERSION_) || _FXFT_VERSION_ == 2501
/***************************************************************************/
/* */
/* ftlcdfil.c */
/* */
/* FreeType API for color filtering of subpixel bitmap glyphs (body). */
/* */
-/* Copyright 2006, 2008-2010, 2013 by */
+/* Copyright 2006, 2008-2010, 2013, 2014 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* This file is part of the FreeType project, and may only be used, */
@@ -16,13 +15,13 @@
/* */
/***************************************************************************/
-#define FT2_BUILD_LIBRARY
-#include "../../include/ft2build.h"
-#include "../../include/freetype/internal/ftdebug.h"
-#include "../../include/freetype/ftlcdfil.h"
-#include "../../include/freetype/ftimage.h"
-#include "../../include/freetype/internal/ftobjs.h"
+#include <ft2build.h>
+#include FT_INTERNAL_DEBUG_H
+
+#include FT_LCD_FILTER_H
+#include FT_IMAGE_H
+#include FT_INTERNAL_OBJECTS_H
#ifdef FT_CONFIG_OPTION_SUBPIXEL_RENDERING
@@ -47,9 +46,16 @@
FT_Byte* line = bitmap->buffer;
+ /* take care of bitmap flow */
+ if ( bitmap->pitch < 0 )
+ line -= bitmap->pitch * ( bitmap->rows - 1 );
+
+ /* `fir' and `pix' must be at least 32 bit wide, since the sum of */
+ /* the values in `weights' can exceed 0xFF */
+
for ( ; height > 0; height--, line += bitmap->pitch )
{
- FT_UInt fir[5];
+ FT_UInt fir[4]; /* below, `pix' is used as the 5th element */
FT_UInt val1, xx;
@@ -58,7 +64,6 @@
fir[1] = weights[3] * val1;
fir[2] = weights[4] * val1;
fir[3] = 0;
- fir[4] = 0;
val1 = line[1];
fir[0] += weights[1] * val1;
@@ -105,10 +110,14 @@
FT_Int pitch = bitmap->pitch;
+ /* take care of bitmap flow */
+ if ( bitmap->pitch < 0 )
+ column -= bitmap->pitch * ( bitmap->rows - 1 );
+
for ( ; width > 0; width--, column++ )
{
FT_Byte* col = column;
- FT_UInt fir[5];
+ FT_UInt fir[4]; /* below, `pix' is used as the 5th element */
FT_UInt val1, yy;
@@ -117,7 +126,6 @@
fir[1] = weights[3] * val1;
fir[2] = weights[4] * val1;
fir[3] = 0;
- fir[4] = 0;
col += pitch;
val1 = col[0];
@@ -154,7 +162,7 @@
col[-2 * pitch] = (FT_Byte)pix;
pix = fir[1] >> 8;
- pix |= (FT_UInt)-(FT_Int)( pix >> 8 );
+ pix |= (FT_UInt)-(FT_Int)( pix >> 8 );
col[-pitch] = (FT_Byte)pix;
}
}
@@ -190,6 +198,10 @@
FT_Byte* line = bitmap->buffer;
+ /* take care of bitmap flow */
+ if ( bitmap->pitch < 0 )
+ line -= bitmap->pitch * ( bitmap->rows - 1 );
+
for ( ; height > 0; height--, line += pitch )
{
FT_UInt xx;
@@ -229,6 +241,10 @@
FT_Byte* column = bitmap->buffer;
+ /* take care of bitmap flow */
+ if ( bitmap->pitch < 0 )
+ column -= bitmap->pitch * ( bitmap->rows - 1 );
+
for ( ; width > 0; width--, column++ )
{
FT_Byte* col = column;
@@ -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 )
{
@@ -377,5 +396,3 @@
/* END */
-#endif
-
« no previous file with comments | « third_party/freetype/src/base/ftinit.c ('k') | third_party/freetype/src/base/ftmac.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698