Commit Graph

307 Commits

Author SHA1 Message Date
Alexei Podtelezhnikov d5b7de5541 * src/smooth/ftgrays.c (FT_INTEGRATE): New convenience macro.
(gray_render_line, gray_render_scanline): Use it.
2021-03-11 22:08:45 -05:00
Alexei Podtelezhnikov 8516849977 * src/smooth/ftgrays.c (gray_render_line): Rearrange conditionals.
These produce faster or more optimizable code.
2021-03-09 22:14:44 -05:00
Werner Lemberg b6e8a71266 Update all copyright notices. 2021-01-17 07:18:48 +01:00
Priyesh Kumar 53be1753de Fix `-Wformat' compiler warnings.
* src/*: Fix format specifiers.

* builds/unix/ftsystem.c (FT_Stream_Open): Ditto.
2020-07-28 07:33:40 +02:00
Werner Lemberg 1658685967 Remove redundant inclusion of `ft2build.h'.
* */*: Remove `#include <ft2build.h>' where possible.

* include/freetype/freetype.h: Remove cpp error about missing
inclusion of `ft2build.h'.
2020-06-13 21:15:45 +02:00
David Turner e13391333f Make macros for header file names optional.
We no longer have to take care of the 8.3 file name limit; this
allows us (a) to introduce longer, meaningful file names, and (b) to
avoid macro names in `#include' lines altogether since some
compilers (most notably Visual C++) doesn't support this properly.

*/*: Replace

   #include FOO_H

with

   #include <freetype/foo.h>

or something similar.  Also update the documentation.
2020-06-08 13:31:55 +02:00
Werner Lemberg e5038be704 Update all copyright notices. 2020-01-19 17:05:19 +01:00
Alexei Podtelezhnikov e7ac9288ac [smooth] Restore the span buffering for direct mode only.
The buffer size FT_MAX_GRAY_SPANS is set to 10 spans, which should be
enough to cover the entire scanline for simple glyphs in most cases:
each slightly slanted edge needs up to two spans, plus a filling span
in-between.  This is not new, we used to do it before cb4388783c.

* src/smooth/ftgrays.c (gray_TWorker): Add `spans' and `num_spans'.
(gray_hline, gray_sweep): Implement the span buffering.
(gray_raster_render): Use negative `num_spans' to avoid the direct
mode.
2019-06-13 00:17:36 -04:00
Alexei Podtelezhnikov bdac4cbe6f Rendering considerations. 2019-06-12 21:58:35 -04:00
Werner Lemberg 9159128a92 Silence gcc 7's fall-through warnings in `switch' blocks.
Instead of an intentionally missing `break' statement there must be a
comment line containing `fall through' (and nothing else) right before the
next `case' statement.

See

  https://stackoverflow.com/questions/45129741/gcc-7-wimplicit-fallthrough-warnings-and-portable-way-to-clear-them
2019-05-29 07:51:59 +02:00
Alexei Podtelezhnikov 141e3173db Rendering considerations. 2019-05-20 23:09:59 -04:00
Alexei Podtelezhnikov bc3b5281ed [smooth] Faster fractions.
* src/smooth/ftgrays.c (SUBPIXELS): Replace with...
(FRACT): A fractional coordinate macro to use in...
(gray_render_line, gray_render_scanline): ... here.
2019-05-08 22:08:40 -04:00
Alexei Podtelezhnikov 8172577380 * src/smooth/ftgrays.c (gray_render_line): Small shortcut. 2019-05-04 08:11:20 -04:00
Alexei Podtelezhnikov 300458eb94 Miscellaneous macro updates.
* src/base/ftoutln.c (SCALED): Updated.
* src/smooth/ftgrays.c (SCALED): Ditto.
(FLOOR, ROUND, CEILING): Removed.
* src/psaux/psfixed.h (cf2_fracToFixed): Updated.
2019-05-03 23:16:42 -04:00
Alexei Podtelezhnikov 2ea511eed8 [smooth] Simplify cubic Bézier flattening.
The previous implementation is correct but it is too complex.
The revised algorithm is based on the fact that each split moves
the control points closer to the trisection points on the chord.
The corresponding distances are good surrogates for the curve
deviation from the straight line.

This cubic flattening algorithm is somewhat similar to the conic
algorithm based the distance from the control point to the middle of
the chord.  The cubic distances, however, decrease less predictably
but are easy enough to calculate on each step.

* src/smooth/ftgrays.c (gray_render_cubic): Replace the split
condition.
2019-04-29 22:49:15 -04:00
Alexei Podtelezhnikov 80475edead [smooth] Bithacks and cosmetics.
* src/smooth/ftgrays.c (gray_record_cell, gray_set_cell, gray_hline,
gray_render_conic, gray_convert_glyph_inner): Updated.
2019-04-26 21:53:00 -04:00
Alexei Podtelezhnikov 7a81b63abc Optimize Bézier bisections.
* src/raster/ftraster.c (Split_Conic, Split_Cubic): Use shifts and
refactor.
* src/smooth/ftgrays.c (gray_split_conic, gray_split_cubic): Ditto.
* src/base/ftstroke.c (ft_conic_split, ft_cubic_split): Ditto.
* src/base/ftbbox.c (cubic_peak): Use shifts.
2019-04-25 22:06:33 -04:00
Alexei Podtelezhnikov 1f271751a3 [smooth] Fix segfault in direct mode (#56092).
* src/base/ftoutln.c (FT_Outline_Render): Set missing clip_box for
direct mode.
* src/smooth/ftgrays.c (gray_raster_render): Use it.
2019-04-11 23:48:21 -04:00
Werner Lemberg 7585997024 Update all copyright notices. 2019-02-23 10:07:09 +01:00
Werner Lemberg f686ad46a3 Update copyright years. 2019-01-22 20:31:44 +01:00
Werner Lemberg afa043de9c Fix links (mostly http -> https). 2018-12-25 22:44:05 +01:00
Werner Lemberg 9817571cc9 [ftgrays] Fix typo in stand-alone mode (#54771).
* src/smooth/ftgrays.c (FT_THROW) [STANDALONE_ &&
FT_DEBUG_LEVEL_TRACE]: Fix call to `FT_ERR_CAT'.
2018-10-03 08:04:55 +02:00
Werner Lemberg a0dd16fb3d Don't use `trace_' prefix for FT_COMPONENT arguments.
* include/freetype/internal/ftdebug.h (FT_TRACE_COMP,
FT_TRACE_COMP_): New auxiliary macros to add `trace_' prefix.
(FT_TRACE): Use `FT_TRACE_COMP'.

*/* (FT_COMPONENT): Updated.
2018-08-15 18:13:17 +02:00
Alexei Podtelezhnikov e16bfbec4c [raster, smooth] Reinstate bitmap size limits.
This again moves outline and bitmap size checks one level up.

* src/base/ftoutln.c (FT_Outline_Render): Explicitly reject enormous
outlines.
* src/raster/ftrend1.c (ft_raster1_render): Reject enormous bitmaps
and, therefore, outlines that require them.
* src/smooth/ftsmooth.c (ft_smooth_render_generic): Ditto.

* src/raster/ftraster.c (ft_black_render): Remove outline size checks.
* src/smooth/ftgrays.c (gray_raster_render): Ditto.
[STANDALONE]: Remove `FT_Outline_Get_CBox' copy.
2018-08-09 22:18:00 -04:00
Werner Lemberg f60c98feaf [smooth] Improve tracing.
* src/smooth/ftgrays.c (gray_convert_glyph_inner): Only use tracing
if called the first time.
(gray_convert_glyph): Updated.
2018-08-08 18:15:53 +02:00
Werner Lemberg ca4e707aa1 [smooth, raster] Limit bitmap size (#54019).
* src/raster/ftraster.c [STANDALONE] (FT_Outline_Get_CBox): Add
function.
[!STANDALONE]: Include FT_OUTLINE_H.
(ft_black_render): Compute CBox and reject glyphs larger than
0xFFFF x 0xFFFF.

* src/smooth/ftgrays.c (gray_raster_render): Reject glyphs larger
than 0xFFFF x 0xFFFF.
2018-06-06 08:18:23 +02:00
Armin Hasitzka 80ac364530 * src/smooth/ftgrays.c (gray_convert_glyph): Remove unused variables. 2018-06-03 18:31:58 +02:00
Werner Lemberg 9ac9060df0 [GSoC] src/*.*: Convert block comments to `light' style.
This monster commit was created by applying Nikhil's scripts
`docconverter.py' and `markify.py' to all C header and source files,
followed up by minor manual clean-up.

No change in functionality, of course.

I used commit f7419907bc6044b9b7057f9789866426c804ba82 from
https://github.com/nikramakrishnan/freetype-docs.git.
2018-06-03 09:08:41 +02:00
Alexei Podtelezhnikov ae24803410 [smooth] Attempt to mitigate bug #54019.
The robust rendering of estra large glyphs came with unbearable cost.
The old way of bisecting should fail but fail faster.

* src/smooth/ftgrays.c (gray_convert_glyph): Switch back to bisecting
in y-direction.
2018-06-02 21:42:44 -04:00
Werner Lemberg 9514959241 Remove FT_CONFIG_OPTION_PIC and related code.
*/* [FT_CONFIG_OPTION_PIC]: Remove all code guarded by this
preprocessor symbol.

*/*: Replace `XXX_GET' macros (which could be either a function in
PIC mode or an array in non-PIC mode) with `xxx' arrays.

* include/freetype/internal/ftpic.h, src/autofit/afpic.c,
src/autofit/afpic.h, src/base/basepic.c, src/base/basepic.h,
src/base/ftpic.c, src/cff/cffpic.c, src/cff/cffpic.h,
src/pshinter/pshpic.c, src/pshinter/pshpic.h, src/psnames/pspic.c,
src/psnames/pspic.h, src/raster/rastpic.c, src/raster/rastpic.h,
src/sfnt/sfntpic.c, src/sfnt/sfntpic.h, src/smooth/ftspic.c,
src/smooth/ftspic.h, src/truetype/ttpic.c, src/truetype/ttpic.h:
Removed.
2018-05-02 20:27:48 +02:00
Werner Lemberg 63aaf89cec s/sub-pixel/subpixel/. 2018-02-17 10:34:47 +01:00
Werner Lemberg 0a0c22569d Update copyright year. 2018-01-02 09:33:57 +01:00
Werner Lemberg 71fecc539e Improve tracing messages by using singular and plural forms.
* src/*/*.c: Implement it.
2017-12-05 12:06:29 +01:00
Werner Lemberg 87ddad2007 Update or fix links to use the https protocol instead of http. 2017-12-04 20:43:30 +01:00
Alexei Podtelezhnikov ab6fe0768f * src/smooth/ftgrays.c (gray_set_cell): Fix uninitialized variables. 2017-11-06 21:34:56 -05:00
Alexei Podtelezhnikov 816516360c [smooth] Fix complex rendering at high ppem.
We used to split large glyphs into horizontal bands and continue
bisecting them still horizontally if that was not enough.  This is
guaranteed to fail when a single scanline cannot fit into the
rendering memory pool.  Now we bisect the bands vertically so that
the smallest unit is a column of the band height, which is guranteed
to fit into memory.

* src/smooth/ftgrays.c (gray_convert_glyph): Implement it.
2017-11-01 22:51:03 -04:00
Alexei Podtelezhnikov 91015cb41d [smooth] Improve complex rendering at high ppem.
At large sizes almost but not exactly horizontal segments can quickly
drain the rendering pool. This patch at least avoids filling the pool
with trivial cells. Beyond this, we can only increase the pool size.

Reported, analyzed, and tested by Colin Fahey.

* src/smooth/ftgrays.c (gray_set_cell): Do not record trivial cells.
2017-10-21 22:57:43 -04:00
Alexei Podtelezhnikov 6bea49e026 [base] Netpbm image tracing.
* src/base/ftobjs.c (FT_Load_Glyph): Trace bitmap size.
(FT_Render_Glyph_Internal): Trace bitmap in Netpbm format.

* src/smooth/ftgrays.c (gray_sweep): Sweep remnants of span tracing.
2017-10-14 22:45:11 -04:00
Werner Lemberg dcd8de272f */*: Remove `OVERFLOW_' prefix.
This increases readability.
2017-06-09 11:21:58 +02:00
Werner Lemberg cd02d359a6 [smooth] Some 32bit integer overflow run-time errors.
* src/smooth/ftgrays.c [STANDALONE] (OVERFLOW_ADD_LONG,
OVERFLOW_SUB_LONG, OVERFLOW_MUL_LONG, NEG_LONG): New macros.
[!STANDALONE]: Include FT_INTERNAL_CALC_H.
(gray_render_cubic): Use those macros where appropriate.
2017-06-01 17:05:39 +02:00
Alexei Podtelezhnikov 761d9e418b * src/smooth/ftgrays.c (gray_hline): Improve code. 2017-02-22 22:41:36 -05:00
Alexei Podtelezhnikov fcd47b3d3e * src/smooth/ftgrays.c (gray_sweep): Improve code. 2017-02-12 23:07:29 -05:00
Alexei Podtelezhnikov a3754d6626 Comment. 2017-02-01 22:36:16 -05:00
Alexei Podtelezhnikov 2ca5b07d4f * src/smooth/ftgrays.c (gray_render_scanline): Improve code. 2017-01-31 23:13:50 -05:00
Werner Lemberg 563ae78022 Update copyright year. 2017-01-04 20:16:34 +01:00
Werner Lemberg 24be60b5f1 */*: Use hex numbers for errors in tracing messages. 2017-01-01 08:20:38 +01:00
Werner Lemberg 4441f7b246 Replace `foo == NULL' and `foo != NULL' with `!foo' and `foo', resp.
Other minor formatting.
2016-12-26 17:08:17 +01:00
Werner Lemberg 1d28f697d2 [smooth] Revert previous commit. Already fixed with 6ca54c64. 2016-11-29 18:45:22 +01:00
Werner Lemberg d949a3db58 [smooth] Avoid conditional jump on uninitialized value (#49711).
* src/smooth/ftgrays.c (gray_raster_render): Initialize `worker'.
2016-11-29 12:09:56 +01:00
Alexei Podtelezhnikov b0aacff474 [smooth] Remove impossibility.
* src/smooth/ftgrays.c (TWorker): Rearrange fields.
(gray_convert_glyph): Remove impossible condition and clean up.
2016-10-01 12:55:33 -04:00
Werner Lemberg 45cad2e5e1 More FT_ZERO usage.
* src/gxvalid/gxvcommn.c (gxv_ClassTable_validate):
s/ft_memset/FT_MEM_ZERO/.

* src/psaux/t1decode.c (t1_decoder_parse_charstrings):
s/ft_memset/FT_ARRAY_ZERO/.

* src/raster/ftraster.c (FT_ZERO): Define.
(ft_black_new): Use it.
* src/raster/ftrend1.c (ft_raster1_get_cbox):
s/FT_MEM_ZERO/FT_ZERO/.

* src/smooth/ftgrays.c (FT_ZERO): Define.
(gray_raster_new): Use it.
* src/smooth/ftsmooth.c (ft_smooth_get_cbox):
s/FT_MEM_ZERO/FT_ZERO/.
2016-09-28 19:10:52 +02:00
Alexei Podtelezhnikov 53ae7a542d [smooth] Reduce divisions in the line renderer.
We don't need some divisions if a line segments stays within a single
row or a single column of pixels.

* src/smooth/ftgrays.c (gray_render_line) [FT_LONG64]: Make divisions
conditional.
2016-09-22 22:48:15 -04:00
Werner Lemberg c95b7652d8 s/0/NULL/ for function pointers; comments, formatting. 2016-09-17 17:12:50 +02:00
Alexei Podtelezhnikov d5f7533e8e * src/smooth/ftgrays.c (gray_sweep): Remove check for empty table. 2016-09-15 00:13:36 -04:00
Alexei Podtelezhnikov ad47550b80 [smooth] Another tiny speed-up.
* src/smooth/ftgrays.c (gray_find_cell): Merge into...
(gray_record_cell): ... this function.
2016-09-14 23:15:03 -04:00
Alexei Podtelezhnikov c38be52bf8 * src/smooth/ftgrays.c (gray_{find,set}_cell): Remove dubious code. 2016-09-11 22:44:44 -04:00
Alexei Podtelezhnikov 6ca54c6430 [smooth] Fix valgrind warning and reoptimize.
The algorithm calls `gray_set_cell' at the start of each new contour
or when the contours cross the cell boundaries. Double-checking for
that is wasteful.

* src/smooth/ftgrays.c (gray_set_cell): Remove check for a new cell.
(gray_convert_glyph): Remove initialization introduced by 44b172e88.
2016-09-11 16:00:52 -04:00
Alexei Podtelezhnikov a0b92bcb47 * src/smooth/ftgrays.c (gray_hline): Microptimize. 2016-09-07 23:19:57 -04:00
Alexei Podtelezhnikov 9d0a3bd848 [smooth] Operate in absolute bitmap coordinates.
Simpler bitmap addressing improves performance by 1.5%.

* src/smooth/ftgrays.c (gray_TWorker): Remove count fields.
(gray_dump_cells, gray_find_cell, gray_set_cell, gray_hline,
gray_sweep, gray_convert_glyph, gray_raster_render): Updated.
2016-09-06 23:59:33 -04:00
Alexei Podtelezhnikov 44b172e883 [smooth] Improve contour start (take 2).
* src/smooth/ftgrays.c (gray_move_to): Call `gray_set_cell' directly
instead of...
(gray_start_cell): ... this function, which is removed.
(gray_convert_glyph): Make initial y-coordinate invalid.
2016-09-06 23:24:17 -04:00
Alexei Podtelezhnikov 9773d5f721 * src/smooth/ftgrays.c (gray_move_to, gray_start_cell): Revert. 2016-09-05 23:33:35 -04:00
Alexei Podtelezhnikov 7effc279b0 [smooth] Improve contour start.
* src/smooth/ftgrays.c (gray_move_to): Call `gray_set_cell' directly
instead of...
(gray_start_cell): ... this function, which is removed.
2016-09-05 21:58:56 -04:00
Werner Lemberg 16583ccde9 * src/smooth/ftgrays.c (gray_hline): Fix clang compiler warnings. 2016-09-02 22:45:14 +02:00
Alexei Podtelezhnikov 11d3336af3 [smooth] Simplify span rendering more.
It turns out that there is significant cost associated with `FT_Span'
creation and calls to `gray_render_span' because it happerns so
frequently. This removes these steps from our internal use but leaves
it alone for `FT_RASTER_FLAG_DIRECT" to preserve API. The speed gain
is about 5%.

* src/smooth/ftgrays.c (gray_render_span): Removed. The code is
migrated to...
(gray_hline): ... here.
2016-09-01 22:56:24 -04:00
Alexei Podtelezhnikov f44ddfda45 [smooth] Streamline pixmap drawing a bit more.
Zero coverage is unlikely (1 out of 256) to warrant checking. This
gives 0.5% speed improvement in dendering simple glyphs.

* src/smooth/ftgrays.c (gray_hline, gray_render_span): Remove checks.
2016-08-30 23:21:23 -04:00
Alexei Podtelezhnikov e73055c791 [smooth] Streamline pixmap drawing.
This gives 2% speed improvement in rendering simple glyphs.

* src/smooth/ftgrays.c (TPixmap): Reduced pixmap descriptor with a
pointer to its bottom-left and pitch to be used in...
(gray_TWorker): ... here.
(gray_render_span): Move pixmap flow check from here...
(gray_raster_render): .. to here.
2016-08-29 23:15:35 -04:00
Alexei Podtelezhnikov 4d3f7ca8ce [smooth] Reduce stack of band boundaries.
* src/smooth/ftgrays.c (gray_TBand): Removed.
(gray_convert_glyph): Updated to stack band boundaries concisely.
2016-08-27 23:25:54 -04:00
Alexei Podtelezhnikov 9a444f0547 * src/smooth/ftgrays.c (gray_raster_render): Minor tweaks. 2016-08-25 22:36:01 -04:00
Alexei Podtelezhnikov cb4388783c [smooth] Simplify span rendering.
This removes unnecessary complexity of span merging and buffering.
Instead, the spans are rendered as they come, speeding up the
rendering by about 5% percents as a result.

* src/smooth/ftgrays.c [FT_MAX_GRAY_SPANS]: Macro removed.
(gray_TWorker): Remove span buffer and related fields.
(gray_sweep, gray_hline): Updated.

* include/freetype/ftimage.h: Remove documentation note about
`FT_MAX_GRAY_SPANS', which was never in `ftoption.h' and is now gone.
2016-08-22 23:06:45 -04:00
Peter Klotz 3b37bfc4b5 * src/smooth/ftgrays.c (gray_hline): Fix uninitialized access. 2016-08-10 22:38:08 -04:00
Alexei Podtelezhnikov 97718f3c91 [smooth] Minor refactoring.
* src/smooth/ftgrays.c (gray_render_scanline, gray_render_line):
Updated.
2016-08-05 23:36:16 -04:00
Werner Lemberg 971f10b63a Formatting. 2016-07-08 06:59:31 +02:00
Werner Lemberg 109d1662d4 Revert "Formatting."
This reverts commit a0f3a1f25a.
2016-07-08 06:58:46 +02:00
Werner Lemberg a0f3a1f25a Formatting. 2016-07-08 06:53:46 +02:00
Alexei Podtelezhnikov 4a2f8f1faf [smooth] Sub-banding protocol revision.
Rasterization sub-banding is utilized at large sizes while using
rather small fixed memory pool. Indeed it is possible to make an
educated guess how much memory is necessary at a given size for a
given glyph. It turns out that, for large majority of European glyphs,
you should store about 8 times more boundary pixels than their height.
Or, vice versa, if your memory pool can hold 800 pixels the band
height should be 100 and you should sub-band anything larger than
that. Should you still run out of memory, FreeType bisects the band
but you have wasted some time. This is what has been implemented in
FreeType since the beginning.

It was overlooked, however, that the top band could grow to twice the
default band size leading to unnecessary memory overflows there. This
commit fixes that. Now the bands are distributed more evenly and
cannot exceed the default size.

Now the magic number 8 is really suitable for rather simple European
scripts. For complex Chinese logograms the magic number should be 13
but that is subject for another day.

* src/smooth/ftgrays.c (gray_convert_glyph): Revise sub-banding
protocol.
2016-07-08 00:16:07 -04:00
Alexei Podtelezhnikov d1876e5832 [smooth] Variable type revision (part 2).
* src/smooth/ftgrays.c (TArea): Restore original definition as `int'.
(gray_render_line) [FT_LONG64]: Updated.
(gray_convert_glyph): 32-bit band bisection stack should be 32 bands.
(gray_convert_glyph_inner): Trace successes and failures.
2016-07-04 23:46:53 -04:00
Alexei Podtelezhnikov 597c69596c [smooth] Variable type revision (part 1).
This patch restores original `TCoord' definition as `int' so that the
rendering pool is used more efficiently on LP64 platforms (unix).

* src/smooth/ftgrays.c (gray_TWorker, TCell, gray_TBand): Switch some
fields to `TCoord'.
(gray_find_cell, gray_render_scanline, gray_render_line, gray_hline,
gray_sweep, gray_convert_glyph): Updated.
2016-07-01 23:27:41 -04:00
Alexei Podtelezhnikov ef0a3e7e65 [smooth] Minor clean-ups.
* src/smooth/ftgrays.c (gray_TWorker): Remove redundant `ycount'.
(gray_sweep, gray_convert_glyph, gray_dump_cells): Updated.
2016-06-28 22:56:22 -04:00
Alexei Podtelezhnikov c9cf359fd2 [smooth] Minor clean-ups.
* src/smooth/ftgrays.c (gray_convert_glyph): Do not use volatile
qualifier.
(gray_raster_render): Move span initializations from here.
(gray_sweep): ... to here and remove unused `target' argument.
2016-06-28 00:30:58 -04:00
Alexei Podtelezhnikov 25e82bc2b5 [smooth] Consolidate memory management.
* src/smooth/ftgrays.c (gray_init_cells): Remove function.
(gray_TWorker): Remove fields that become local variables.
(gray_raster_render): Move rendering buffer declaration from here.
(gray_convert_glyph): ... to here and update accordingly.
2016-06-23 23:17:39 -04:00
Alexei Podtelezhnikov e22334812f [smooth] Consolidate boundary checks.
Removing the checks from `gray_hline' shaves 1% off rendering speed.

* src/smooth/ftgrays.c [STANDALONE_]: Duplicate `FT_MIN' and `FT_MAX'.
(gray_TWorker): No need to store `clip_box'.
(gray_hline): Remove unnecessary boundary checks.
(gray_convert_glyph): Move boundary checks from here.
(gray_raster_render): ... to here and consolidate.
2016-06-22 23:14:26 -04:00
Alexei Podtelezhnikov 78e8fc0dad [smooth] Use `FT_Outline_Get_CBox'.
* src/smooth/ftgrays.c [STANDALONE_]: Duplicate `FT_Outline_Get_CBox'.
(gray_compute_cbox): Remove this function.
(gray_convert_glyph): Update to use `FT_Outline_Get_CBox'.
2016-06-22 00:04:08 -04:00
Werner Lemberg 20c6ef4c25 [smooth] Remove compiler warnings.
* src/smooth/ftgrays.c (gray_convert_glyph): Fix reports from clang.
2016-06-21 11:39:34 +02:00
Alexei Podtelezhnikov 3c64af98ff [smooth] Sanitize memory managenent.
* src/smooth/ftgrays.c (gray_convert_glyph): Cleaned up.
2016-06-20 00:01:55 -04:00
Alexei Podtelezhnikov 74fd251b4a [smooth] Remove `band_shoot' that never worked.
* src/smooth/ftgrays.c (gray_TWorker): Remove `band_shoot'.
(gray_convert_glyph): Updated.
2016-06-18 22:31:26 -04:00
Alexei Podtelezhnikov 3e1f7bc506 Fresh typos. 2016-06-18 22:13:23 -04:00
Alexei Podtelezhnikov 72a0653142 [raster, smooth] Handle FT_RENDER_POOL_SIZE better.
* src/raster/ftraster.c (FT_MAX_BLACK_POOL): New macro.
(ft_black_render): Updated.
* src/smooth/ftgrays.c (FT_MAX_GRAY_POOL): New macro.
(gray_raster_render): Updated.
2016-06-17 23:10:22 -04:00
Alexei Podtelezhnikov 7f569f4574 Move function. 2016-06-14 23:49:31 -04:00
Alexei Podtelezhnikov 32acceff83 * src/smooth/ftgrays.c (gray_hline): Optimize if-condition. 2016-06-14 23:38:17 -04:00
Alexei Podtelezhnikov 77180c7adc [smooth] Re-enable new line renderer on 64-bit archs.
* src/smooth/ftgrays (gray_render_line): Conditionally re-enable new
implementation, where it is safe from overflows.
2016-06-08 23:31:28 -04:00
Alexei Podtelezhnikov 9cf232ed66 [smooth] Minor clean-ups.
* src/smooth/ftgrays.c (gray_dump_cells): Move out of the way.
(gray_render_span): Remove spurious casts and streamline.
2016-06-08 23:19:41 -04:00
Alexei Podtelezhnikov e9f950938f [smooth] Shrink bisection stack.
The convergence of Bézier flatteners is fast with the deviation
from straight line being assymptotically cut 4-fold on each bisection.
This justifies smaller bisection stack size.

* src/smooth/ftgrays.c (gray_TWorker): Remove common `bez_stack'.
(gray_render_conic): Create and use conic `bez_stack'. Move back the
band analysis from...
(gray_conic_to): ... here.
(gray_render_cubic): Create and use cubic `bez_stack'. Move back the
band analysis from...
(gray_cubic_to): ... here.
(gray_move_to): Updated.
2016-05-26 23:46:38 -04:00
Alexei Podtelezhnikov 6e88087d69 [smooth] More efficient accounting of conic splits and draws.
A single decrement counter of segments to draw, instead of an array,
contains all the information necessary to decide when to split and
when to draw a conic segment. The number of splits before each draw is
equal to the number of trailing zeros in the counter.

* src/smooth/ftgrays.c (gray_TWorker): Remove `lev_stack'.
(gray_render_conic): Updated to use decrement counter of segments.
2016-05-05 23:41:03 -04:00
Alexei Podtelezhnikov 98967b77e5 Add comment. 2016-03-23 23:07:24 -04:00
Werner Lemberg 31f2dc1946 [raster, smooth] Directly test outline size (#47500).
This improves stand-alone compilation.

* src/base/ftoutln.c (FT_Outline_Render): Move cbox size test to...

* src/raster/ftraster.c (ft_black_render), src/smooth/ftgrays.c
(gray_raster_render): ...these functions.
2016-03-23 07:31:59 +01:00
Werner Lemberg e9181aba2c [raster, smooth] Fix some clang sanitizer runtime issues.
* src/raster/ftraster.c (ft_black_reset, ft_black_set_mode,
ft_black_render): Harmonize signatures with `ftimage.h'.

* src/smooth/ftgrays.c (gray_raster_render, gray_raster_reset):
Ditto.
2016-03-23 06:58:20 +01:00
Alexei Podtelezhnikov 3beccbdf39 [smooth] Partly revert recent changes.
* src/smooth/ftgrays.c (gray_conic_to, gray_cubic_to): Rework
conditions to fix rendering issues.
2016-03-21 00:07:47 -04:00
Alexei Podtelezhnikov 8e8bb126d1 [smooth] Minor refactoring and microoptimizations.
* src/smooth/ftgrays.c (gray_render_conic, gray_render_cubic): Move
band clipping from here.
(gray_conic_to, gray_cubic_to): ... to here.
(gray_rander_line, gray_render_scanline): Initialize variables closer
to their use.
2016-03-18 23:21:59 -04:00
Alexei Podtelezhnikov 84b2c63374 [smooth] Minor refactoring.
* src/smooth/ftgrays.c (gray_render_conic, gray_render_cubic): Move
upscaling from here...
(gray_conic_to, gray_cubic_to):... to here.
2016-03-17 00:53:09 -04:00
Alexei Podtelezhnikov 1865575a71 [smooth] Temporarily revert 6eb6158dd7 (#47114).
* src/smooth/ftgrays.c (gray_render_line): Old implementation.
2016-03-14 22:39:22 -04:00