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

Side by Side Diff: src/base/ftlcdfil.c

Issue 89753003: Update freetype to latest version of ASOP. (Closed) Base URL: https://chromium.googlesource.com/chromium/src/third_party/freetype.git@master
Patch Set: Created 7 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 unified diff | Download patch
« no previous file with comments | « src/base/ftinit.c ('k') | src/base/ftmm.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 /* ftlcdfil.c */ 3 /* ftlcdfil.c */
4 /* */ 4 /* */
5 /* FreeType API for color filtering of subpixel bitmap glyphs (body). */ 5 /* FreeType API for color filtering of subpixel bitmap glyphs (body). */
6 /* */ 6 /* */
7 /* Copyright 2006, 2008, 2009, 2010 by */ 7 /* Copyright 2006, 2008-2010, 2013 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
18 18
19 #include <ft2build.h> 19 #include <ft2build.h>
20 #include FT_INTERNAL_DEBUG_H
21
20 #include FT_LCD_FILTER_H 22 #include FT_LCD_FILTER_H
21 #include FT_IMAGE_H 23 #include FT_IMAGE_H
22 #include FT_INTERNAL_OBJECTS_H 24 #include FT_INTERNAL_OBJECTS_H
23 25
24 26
25 #ifdef FT_CONFIG_OPTION_SUBPIXEL_RENDERING 27 #ifdef FT_CONFIG_OPTION_SUBPIXEL_RENDERING
26 28
27 /* define USE_LEGACY to implement the legacy filter */ 29 /* define USE_LEGACY to implement the legacy filter */
28 #define USE_LEGACY 30 #define USE_LEGACY
29 31
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
264 } 266 }
265 267
266 #endif /* USE_LEGACY */ 268 #endif /* USE_LEGACY */
267 269
268 270
269 FT_EXPORT_DEF( FT_Error ) 271 FT_EXPORT_DEF( FT_Error )
270 FT_Library_SetLcdFilterWeights( FT_Library library, 272 FT_Library_SetLcdFilterWeights( FT_Library library,
271 unsigned char *weights ) 273 unsigned char *weights )
272 { 274 {
273 if ( !library || !weights ) 275 if ( !library || !weights )
274 return FT_Err_Invalid_Argument; 276 return FT_THROW( Invalid_Argument );
275 277
276 ft_memcpy( library->lcd_weights, weights, 5 ); 278 ft_memcpy( library->lcd_weights, weights, 5 );
277 279
278 return FT_Err_Ok; 280 return FT_Err_Ok;
279 } 281 }
280 282
281 283
282 FT_EXPORT_DEF( FT_Error ) 284 FT_EXPORT_DEF( FT_Error )
283 FT_Library_SetLcdFilter( FT_Library library, 285 FT_Library_SetLcdFilter( FT_Library library,
284 FT_LcdFilter filter ) 286 FT_LcdFilter filter )
285 { 287 {
286 static const FT_Byte light_filter[5] = 288 static const FT_Byte light_filter[5] =
287 { 0x00, 0x55, 0x56, 0x55, 0x00 }; 289 { 0x00, 0x55, 0x56, 0x55, 0x00 };
288 /* the values here sum up to a value larger than 256, */ 290 /* the values here sum up to a value larger than 256, */
289 /* providing a cheap gamma correction */ 291 /* providing a cheap gamma correction */
290 static const FT_Byte default_filter[5] = 292 static const FT_Byte default_filter[5] =
291 { 0x10, 0x40, 0x70, 0x40, 0x10 }; 293 { 0x10, 0x40, 0x70, 0x40, 0x10 };
292 294
293 295
294 if ( !library ) 296 if ( !library )
295 return FT_Err_Invalid_Argument; 297 return FT_THROW( Invalid_Argument );
296 298
297 switch ( filter ) 299 switch ( filter )
298 { 300 {
299 case FT_LCD_FILTER_NONE: 301 case FT_LCD_FILTER_NONE:
300 library->lcd_filter_func = NULL; 302 library->lcd_filter_func = NULL;
301 library->lcd_extra = 0; 303 library->lcd_extra = 0;
302 break; 304 break;
303 305
304 case FT_LCD_FILTER_DEFAULT: 306 case FT_LCD_FILTER_DEFAULT:
305 #if defined( FT_FORCE_LEGACY_LCD_FILTER ) 307 #if defined( FT_FORCE_LEGACY_LCD_FILTER )
(...skipping 26 matching lines...) Expand all
332 #ifdef USE_LEGACY 334 #ifdef USE_LEGACY
333 335
334 case FT_LCD_FILTER_LEGACY: 336 case FT_LCD_FILTER_LEGACY:
335 library->lcd_filter_func = _ft_lcd_filter_legacy; 337 library->lcd_filter_func = _ft_lcd_filter_legacy;
336 library->lcd_extra = 0; 338 library->lcd_extra = 0;
337 break; 339 break;
338 340
339 #endif 341 #endif
340 342
341 default: 343 default:
342 return FT_Err_Invalid_Argument; 344 return FT_THROW( Invalid_Argument );
343 } 345 }
344 346
345 library->lcd_filter = filter; 347 library->lcd_filter = filter;
346 348
347 return FT_Err_Ok; 349 return FT_Err_Ok;
348 } 350 }
349 351
350 #else /* !FT_CONFIG_OPTION_SUBPIXEL_RENDERING */ 352 #else /* !FT_CONFIG_OPTION_SUBPIXEL_RENDERING */
351 353
352 FT_EXPORT_DEF( FT_Error ) 354 FT_EXPORT_DEF( FT_Error )
353 FT_Library_SetLcdFilterWeights( FT_Library library, 355 FT_Library_SetLcdFilterWeights( FT_Library library,
354 unsigned char *weights ) 356 unsigned char *weights )
355 { 357 {
356 FT_UNUSED( library ); 358 FT_UNUSED( library );
357 FT_UNUSED( weights ); 359 FT_UNUSED( weights );
358 360
359 return FT_Err_Unimplemented_Feature; 361 return FT_THROW( Unimplemented_Feature );
360 } 362 }
361 363
362 364
363 FT_EXPORT_DEF( FT_Error ) 365 FT_EXPORT_DEF( FT_Error )
364 FT_Library_SetLcdFilter( FT_Library library, 366 FT_Library_SetLcdFilter( FT_Library library,
365 FT_LcdFilter filter ) 367 FT_LcdFilter filter )
366 { 368 {
367 FT_UNUSED( library ); 369 FT_UNUSED( library );
368 FT_UNUSED( filter ); 370 FT_UNUSED( filter );
369 371
370 return FT_Err_Unimplemented_Feature; 372 return FT_THROW( Unimplemented_Feature );
371 } 373 }
372 374
373 #endif /* !FT_CONFIG_OPTION_SUBPIXEL_RENDERING */ 375 #endif /* !FT_CONFIG_OPTION_SUBPIXEL_RENDERING */
374 376
375 377
376 /* END */ 378 /* END */
OLDNEW
« no previous file with comments | « src/base/ftinit.c ('k') | src/base/ftmm.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698