kc3-lang/freetype/src/sdf/ftbsdf.c

Branch :


Log

Author Commit Date CI Message
11fa9da7 2025-05-19 21:07:10 [sdf] Skip neighbor comparison for pixels near edges. If the distance of the current pixel to the edge is less than or equal to 0.5, skip further neighbor comparisons to avoid unnecessary calculations. When the `USE_SQUARED_DISTANCES` macro is defined, compare to 0.25 instead. * src/sdf/ftbsdf.c (compare_neighbor): Add early return for pixels close to edges to avoid unnecessary neighbor checks.
f92c9655 2024-08-13 23:29:13 Fix various typos.
47574f7e 2024-01-27 11:11:22 Update all copyright notices.
c8ae37ba 2023-05-07 21:06:14 [sdf] Signature fixes.
da9eb9c7 2023-02-07 07:01:36 Fix minor clang and clang++ warnings.
65f85237 2023-01-17 09:18:25 Update all copyright notices.
ab1c98ac 2022-01-27 15:23:47 Fix sdf computation while `USE_SQUARED_DISTANCES`. Function `map_fixed_to_sdf` expects spread to be absolute and not squared. * src/sdf/ftbsdf.c (finalize_sdf): Pass absolute spread while `map_fixed_to_sdf`. * src/sdf/ftsdf.c (sdf_generate_bounding_box): Ditto.
ba5d661f 2022-01-14 21:54:17 * src/sdf/ftbsdf.c (ED): s/near/prox/. This works around the Watcom C definition of `near` as restricted __near.
d0cfb4e1 2022-01-11 10:54:10 Update all copyright notices.
4f357118 2021-12-17 11:22:09 Clang-Tidy warning fixes. * src/base/ftobjs.c (FT_Get_Paint): Operator has equivalent nested operands. * src/bdf/bdflib.c (_bdf_add_property): Value stored to `fp` is never read. * src/sdf/ftbsdf.c (bsdf_init_distance_map): Value stored to `pixel` is never read. * src/sdf/ftsdf.c (split_sdf_shape): Value stored to `error` is never read.
238245cd 2021-11-16 22:07:28 Fix clang++ warnings. * src/*: Initialize some variables to NULL.
7f8f0c1c 2021-09-02 23: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.
be6ab319 2021-08-02 09: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.
36ee7171 2021-06-08 09:00:39 [sdf] Formatting and improved comments.
2b1d5562 2021-06-08 08: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.
a50c39aa 2021-05-29 09: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.
b6e8a712 2021-01-17 07:18:48 Update all copyright notices.
aa1b5362 2020-12-24 08:32:04 [sdf] Fix tracing. * include/freetype/internal.fttrace.h: Add 'bsdf' component. * src/sdf/ftbsdf.c, src/sdf/ftsdf.c (FT_COMPONENT): Define.
04a64432 2020-12-24 08:29:05 [sdf] Add copyright notices.
6444875f 2020-08-21 03:59:23 [sdf] Add brief technical overview of both rasterizers.
d27d107f 2020-08-20 21: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.
a2113475 2020-08-20 21:21:33 [sdf] Add function to copy SDF data into output bitmap. * src/sdf/ftbsdf.c (finalize_sdf): New function.
e2ae96b9 2020-08-20 21:19:32 [sdf] Add '8-point sequential Euclidean distance mapping' algorithm. * src/sdf/ftbsdf.c (compare_neighbor, first_pass, second_pass, edt8): New functions.
6b9a8044 2020-08-20 21:09:23 [sdf] Add function to copy source bitmap to distance map. * src/sdf/ftbsdf.c (bsdf_init_distance_map): New function.
0f644f38 2020-08-20 09:25:15 [sdf] Add functions to compute pixel edge distances. * src/sdf/ftbsdf.c (compute_edge_distance, bsdf_approximate_edge): New functions.
c5761764 2020-08-20 09:20:26 [sdf] Add function to find edge pixels in a grid of alpha values. * src/sdf/ftbsdf.c (bsdf_is_edge): New function.
9bbb3611 2020-08-20 09: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.
cd6ff28a 2020-08-16 17: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.