src/sdf/ftbsdf.c


Log

Author Commit Date CI Message
Alexei Podtelezhnikov 7f8f0c1c 2021-09-02T23:30:31 [smooth, raster, sdf] Clean up initialization calls. * src/raster/ftraster.c (ft_black_init): Removed. (ft_black_new): Clean up. * src/sdf/ftbsdf.c (bsdf_raster_new): Ditto. * src/sdf/ftsdf.c (sdf_raster_new): Ditto. * src/smooth/ftgrays.c (gray_raster_new): Ditto.
Anuj Verma be6ab319 2021-08-02T09:44:16 [sdf] Fix out-of-range-access. * src/sdf/ftbsdf.c (first_pass, second_pass): Fix range during forward pass. Otherwise the index goes out of range for the last column. Fixes issue #1077.
Werner Lemberg 36ee7171 2021-06-08T09:00:39 [sdf] Formatting and improved comments.
Anuj Verma 2b1d5562 2021-06-08T08:29:34 [sdf] Use 8 bits for final SDF output instead of 16bits. Since 8-bits is enough to represent SDF data we no longer require 16-bits for this purpose. Also, we now normalize the output data to use the entire 8-bit range efficiently. For example: if we use 3.5 format with a spread of 1 we basically only use the starting 5-bits. By normalizing we can use the entire 8-bit range. * include/freetype/freetype.h (FT_Render_Mode): Updated description for `FT_RENDER_MODE_SDF` regarding this change. * include/freetype/ftimage.h (FT_Pixel_Mode): Removed `FT_PIXEL_MODE_GRAY16` since no longer required. * include/freetype/fttypes.h (FT_F6Dot10): Removed since no longer required. * src/sdf/ftsdfrend.c (ft_sdf_render, ft_bsdf_render): Allocate 8-bit bitmap instead of 16-bit buffer. * src/sdf/ftsdfcommon.h (map_fixed_to_sdf): Added function to convert 16.16 distance value to our desired format. * src/sdf/ftsdf.c (sdf_generate_with_overlaps, sdf_generate_bounding_box): Use the new `map_fixed_to_sdf` function and also use 8-bit output buffer. * src/sdf/ftbsdf.c (finalize_sdf): Output to a 8-bit buffer instead of 16-bit buffer.
Werner Lemberg a50c39aa 2021-05-29T09:50:29 Fix compilation errors and (some) warnings for clang++. * src/autofit/afmodule.c (AF_GlyphHintsRec): Make it static. * src/cache/ftcache.c (FTC_Cache_NewNode), src/cache/ftcsbits.c (ftc_snode_compare): Remove semicolon. * src/cff/cffparse.c (cff_parser_run): Add `break` statement. * src/cid/cidload.c (cid_hex_to_binary): Add cast. * src/sdf/ftbsdf.c (CHECK_NEIGHBOR): Use `do {} while(0)` loop. (bsdf_init_distance_map, finalize_sdf, bsdf_raster_render): Add casts. * src/sdf/ftsdf.c (sdf_generate_bounding_box, sdf_generate_with_overlaps): Ditto. * src/sdf/ftsdfcommon.h (square_root): Ditto. * src/sdf/ftsdfrend.c (sdf_property_get, ft_sdf_render, ft_bsdf_render): Ditto. * src/sfnt/ttcolr.c (find_base_glyph_record, find_base_glyph_v1_record): Fix variable signedness. (read_color_line): Add cast. (read_paint): Add casts. Fix signedness issue. (tt_face_get_colorline_stops) Fix signedness issues. * src/sfnt/ttpost.c (load_format_20): Add casts. * src/truetype/ttsubpix.c (TWEAK_RULES, TWEAK_RULES_EXCEPTIONS): Remove final semicolons.
Werner Lemberg b6e8a712 2021-01-17T07:18:48 Update all copyright notices.
Werner Lemberg aa1b5362 2020-12-24T08:32:04 [sdf] Fix tracing. * include/freetype/internal.fttrace.h: Add 'bsdf' component. * src/sdf/ftbsdf.c, src/sdf/ftsdf.c (FT_COMPONENT): Define.
Werner Lemberg 04a64432 2020-12-24T08:29:05 [sdf] Add copyright notices.
Anuj Verma 6444875f 2020-08-21T03:59:23 [sdf] Add brief technical overview of both rasterizers.
Anuj Verma d27d107f 2020-08-20T21:25:46 [sdf] Add interface functions for the 'bsdf' rasterizer. * src/sdf/ftsdf.c (bsdf_raster_new, bsdf_raster_reset, bsdf_raster_set_mode, bsdf_raster_render, bsdf_raster_done): New functions. (ft_bitmap_sdf_raster): New variable. * src/sdf/ftsdf.h: Updated.
Anuj Verma a2113475 2020-08-20T21:21:33 [sdf] Add function to copy SDF data into output bitmap. * src/sdf/ftbsdf.c (finalize_sdf): New function.
Anuj Verma e2ae96b9 2020-08-20T21:19:32 [sdf] Add '8-point sequential Euclidean distance mapping' algorithm. * src/sdf/ftbsdf.c (compare_neighbor, first_pass, second_pass, edt8): New functions.
Anuj Verma 6b9a8044 2020-08-20T21:09:23 [sdf] Add function to copy source bitmap to distance map. * src/sdf/ftbsdf.c (bsdf_init_distance_map): New function.
Anuj Verma 0f644f38 2020-08-20T09:25:15 [sdf] Add functions to compute pixel edge distances. * src/sdf/ftbsdf.c (compute_edge_distance, bsdf_approximate_edge): New functions.
Anuj Verma c5761764 2020-08-20T09:20:26 [sdf] Add function to find edge pixels in a grid of alpha values. * src/sdf/ftbsdf.c (bsdf_is_edge): New function.
Anuj Verma 9bbb3611 2020-08-20T09:17:38 [sdf] Add essential structures for the 'bsdf' rasterizer. * src/sdf/ftbsdf.c (ONE): New macro. (BSDF_TRaster, ED, BSDF_Worker): New structures. (zero_ed): New constant.
Anuj Verma cd6ff28a 2020-08-16T17:09:22 [sdf] Add files for new 'sdf' module. Here is a breakdown of what the files will contain. * src/sdf/ftsdfrend.c, src/sdf/ftsdfrend.h: The 'sdf' and 'bsdf' renderers. * src/sdf/ftsdf.c, src/sdf/ftsdf.h: The rasterizer for the 'sdf' renderer. * src/sdf/ftbsdf.c, src/sdf/ftbsdf.h: The rasterizer for the 'bsdf' renderer. * src/sdf/ftsdfcommon.h: Commmon properties and functions for both rasterizers. * src/sdf/ftsdferrs.h: Common error defines. * src/sdf/sdf.c: For building a single object of the entire module.