summaryrefslogtreecommitdiffstats
path: root/libass/ass_render.c
Commit message (Collapse)AuthorAgeFilesLines
* fontselect: simplify cmap lookup for embedded fontsGrigori Goronzy2015-07-101-2/+2
| | | | | FreeType can do it for us and is probably more efficient. Also fixes deinitialization order of ASS_Renderer to make this work.
* Custom font matching and font sourcesGrigori Goronzy2015-07-101-4/+7
| | | | | | | Implement a simple font sorter (FontSelector) and an interface to deal with multiple font sources (FontProvider). Unfinished business, but works for the most part. Currently the only implemented FontProvider uses fontconfig.
* Implement cascade gaussian blurDr.Smile2015-07-041-10/+2
| | | | | | | | | | That's complete version with SSE2/AVX2 assembly. Should be much faster than old algorithm even in pure C. Algorithm description can be found in this article (PDF): https://github.com/MrSmile/CascadeBlur/releases Close #9
* Switch to virtual function tableDr.Smile2015-06-261-75/+35
| | | | | | | | | | Use one pointer to table of functions instead of scattered bunch of function pointers. Different versions of these tables can be constructed in compile time. Also, bitmap memory alignment now depends only on SSE2/AVX2 support and is constant for every width. That simplifies code without noticeable performance penalty.
* Merge pull request #160 from astiob/beGrigori Goronzy2015-06-231-1/+1
|\ | | | | \be fixes including clipping and value range
| * Add enough padding for \be to avoid clippingOleg Oshmyan2015-02-101-1/+1
| | | | | | | | | | To avoid making bitmaps unnecessarily large, use just the necessary amount of padding for the given \be value.
* | Fix crash when stroked outline overflows SHRT_MAXDr.Smile2015-06-141-1/+1
| |
* | Do not apply ass_set_line_position() to positioned eventswm42015-06-111-3/+4
| | | | | | | | | | Even if we wanted this, the result would be inconsistent if e.g. \clip is used.
* | Remove several dead storesGrigori Goronzy2015-06-071-6/+4
| | | | | | | | Reported by clang scan-build static analysis.
* | Check possible NULL dereferenceGrigori Goronzy2015-06-071-1/+1
| | | | | | | | | | | | Reported by clang scan-build static analysis. This cannot happen with the current code, but the check might make this more robust in case anything changes.
* | Strictly clip non-dialog events against the video rectanglewm42015-05-251-0/+13
| | | | | | | | | | | | Only normal dialog lines are allowed to appear outside. Fixes #177.
* | Apply fade only when the fade alpha is positive (like VSFilter)Oleg Oshmyan2015-05-251-2/+4
| |
* | Fix memory leak with drawingswm42015-05-101-1/+6
| | | | | | | | | | | | What. Closes #175.
* | Remove RenderContext.drawingwm42015-05-101-19/+19
| | | | | | | | | | This really didn't make a lot of sense. This is a simplification, and should not affect actual program behavior.
* | Don't use margins for events that should not be overriddenwm42015-03-161-0/+12
| | | | | | | | | | | | | | libass already does not use the margins for events using \pos. This is not quite complete: there are other tags that we consider as "not dialogue", and which should not be overridden. These tags do not use EVENT_POSITIONED, and thus use the margins, which can mess up rendering.
* | Reorder functionswm42015-03-161-12/+12
| | | | | | | | Just move the *_pos ones about the variants without this postfix.
* | Fix BorderStyle=3 with zero Outline and ShadowDr.Smile2015-03-061-1/+5
| |
* | Prevent selective style overrides with scrollingwm42015-03-061-2/+3
| | | | | | | | Similar to xy-VSFilter.
* | Refine list of tags that prevent selective style overrideswm42015-03-061-1/+1
| | | | | | | | | | | | | | Somewhat stolen from: https://github.com/Cyberbeing/xy-VSFilter/blob/xy_sub_filter_rc3/src/subtitles/RTS.cpp#L2004 (xy-VSFilter started work on this in commit 014da6d9766417d7886eb867c9f2c14038f2a226)
* | Allow more fine grained control over style overrideswm42015-02-261-28/+69
| | | | | | | | | | | | | | | | Add tons of ASS_OVERRIDE_ flags, which control whether certain ASS_Style fields are copied when doing selective style overrides with ass_set_selective_style_override_enabled(). This comes with some cleanup. It should be fully backwards-compatible.
* | Change what fields are overridden with style overridewm42015-02-261-1/+1
| | | | | | | | | | | | | | | | "Bold" should obviously be taken from the script's style, like it's done with StrikeOut and Underline. treat_fontname_as_pattern is specific to the font, and thus should be taken from the same style as the font (the override style).
* | Always use the new style with \r and style overrideswm42015-02-261-6/+6
|/ | | | | | I don't know why it was done this way, but some fields were always taken from the event's style, instead of the (possibly different) \r style. Undo this, as it seems like an unnecessary complication.
* Fix incorrect memsetDr.Smile2015-01-291-1/+1
|
* Remove unused function is_skip_symbolRodger Combs2015-01-291-4/+0
|
* Clean up bitmap combiningDr.Smile2015-01-281-306/+202
| | | | | | | | | | Now pre- and post-combining operations are clearly separated, many parameters in cache keys are no longer necessary due to that. Also an ambiguous (in case of multiple fonts) text string is replaced with a list of direct bitmap references in composite cache key. Fixes #153. Fixes #82.
* Replace FT_Outline with ASS_OutlineDr.Smile2014-11-231-49/+91
|
* More malloc checkingwm42014-11-181-12/+27
| | | | In both cases, fallback to doing nothing if alloc fails.
* More malloc checkingwm42014-11-171-1/+4
| | | | | | | | | | Use strndup() instead of malloc+copy. Make all code deal with the possibility that ASS_Drawing.text can be NULL (which can happen on allocation failure). Skip fix_collisions() on malloc failure - the lines will overlap, but at least libass won't crash.
* Split some parts of ass_render_event into functionswm42014-11-151-276/+332
| | | | | The split doesn't necessarily follow any logic; for the most part it just moves each processing loop into its own function.
* Move apply_blur() to ass_bitmap.cwm42014-11-131-71/+3
| | | | Put all code into one place, which makes it easier to follow.
* Check against some overflows and allocation failures on blurwm42014-11-111-2/+1
| | | | This still doesn't catch all cases.
* Check more allocationsRodger Combs2014-11-081-1/+7
| | | | Part of #146
* Fix subpixel shadow shiftDr.Smile2014-11-061-15/+15
|
* Provide slightly more fine-grained control over style overrideswm42014-10-171-5/+15
|
* Fix caching of combined bitmaps after complex shapingOleg Oshmyan2014-09-051-8/+10
|
* Check FT_Outline_New return valuewm42014-08-311-1/+6
| | | | | Makes #131 not crash. The function likely fails because the number of points exceeds SHRT_MAX.
* Simplify drawing text assignmentOleg Oshmyan2014-06-061-2/+2
|
* Use ass_drawing_add_chars for vector drawingsOleg Oshmyan2014-06-061-28/+20
| | | | | | This not only provides a performance improvement but also conveniently fixes the following issue: we used to interpret backslash-escapes in vector drawings, but we shouldn't.
* Require closing '}' for override tagsOleg Oshmyan2014-06-061-15/+10
| | | | | | | | Like VSFilter. '{' without a following '}' is just text, though in vector drawing mode it still delimits individual drawings. This also lets us nicely avoid '\0' hacks in the \t override tag handler in parse_tag.
* Add a mechanism for selective style overrideswm42014-06-051-21/+80
| | | | | | | | | | | | | | | This adds 2 new API functions: ass_set_selective_style_override() ass_set_selective_style_override_enabled() They can be used to force dialog text to use a specific ASS_Style. It uses a fuzzy heuristic for that, and the quality of results may vary. It does style overriding selectively and tries not to override things that need explicit styling. The heuristic for that isn't set in stone either, and can change with future libass versions. Closes libass#88.
* Merge pull request #100 from astiob/strokeGrigori Goronzy2014-06-021-1/+8
|\ | | | | Use FT_Outline_EmboldenXY
| * Use FT_Outline_EmboldenXY if availableOleg Oshmyan2014-05-301-1/+8
| |
* | Add BorderStyle=4, background color for textwm42014-06-011-0/+20
| | | | | | | | | | | | | | | | This is somewhat similar to BorderStyle=3, but with a number of differences. Mainly, this new BorderStyle doesn't create overlaps within an event. Closes #105.
* | Fix change detection when text is clipped to screenwm42014-06-011-3/+7
| | | | | | | | | | | | The glyphs are clipped before combining, so the combined bitmap can always have the same position, size, and address. This breaks the change detection. Or at least I think that's what happens.
* | Remove bitmap restridingwm42014-06-011-24/+0
|/ | | | It turns out we don't need this.
* shaper: add FriBidi error handlingGrigori Goronzy2014-05-291-1/+11
| | | | | | It is unlikely, but FriBidi might not process a string correctly, and we should handle that. Tested by making it fail always. This should also fix some compiler warnings.
* Implement fast quad-tree rasterizer in C and x86/SSE2/AVX2Dr.Smile2014-04-291-5/+41
| | | | Signed-off-by: Rodger Combs <rodger.combs@gmail.com>
* Fix premature parser exit on }{ in drawing modeOleg Oshmyan2014-04-271-1/+1
| | | | Fixes #75.
* Initialize \pbo for each eventOleg Oshmyan2014-04-101-0/+1
| | | | | Regression in commit 1f5eb5eb. Fixes issue #74.
* Fix change detection in presence of vector clipswm42014-03-061-1/+4
| | | | | | | | | | | | | | | | | Fixes this test case: Dialogue: 0,0:00:00.00,0:00:02.00,,,0,0,0,,{\fs50\pos(250,250)\iclip(m 0 0 l 400 0 l 400 220 l0 220)}Hello Dialogue: 0,0:00:02.00,0:10:00.00,,,0,0,0,,{\fs50\pos(250,250)\iclip(m 0 0 l 400 0 l 400 230 l0 230)}Hello The problem here is that the rendered output bitmap list itself does not change, only its contents (due to the different vector clip). ass_render_frame() will not set *detect_change correctly, and an application using this flag (like mplayer or mpv) will not update the screen as needed. Fix this with a very cheap hack: always report a full change if there's a vector clip. This is basically an emergency fix until we have a proper way to detect the change.
* Assume SSE2 on x86_6411rcombs2014-02-281-6/+3
|
* Don't include skipped glyphs in combined bitmapsOleg Oshmyan2014-02-121-3/+7
| | | | | | | Make sure to correctly handle situations where glyphs have info->linebreak and info->skip set at the same time. Fixes libass#44.
* Don't reset wrap_style on \rGrigori Goronzy2014-02-111-1/+1
| | | | This isn't part of a style. Fixes libass#45, GC#116.
* Use cluster advance in compute_string_bbox to account for \fspOleg Oshmyan2014-02-111-7/+4
| | | | Fixes libass#16 (the remaining sub-issue).
* Use a function for aligned memory allocationswm42014-02-021-14/+9
| | | | ...instead of doing this manually.
* Fix subpixel jumping of rotated glyph runsOleg Oshmyan2014-01-291-1/+5
| | | | | Rotation origin was not taken into account when caching glyph run bitmaps.
* Make apply_blur and make_shadow_bitmap static; remove an unneeded local variable11rcombs2014-01-251-94/+92
|
* Make sure to release each event's vector clip maskOleg Oshmyan2014-01-261-9/+6
| | | | | | | | Events with a clip mask but no text such as just Dialogue: ...,{\clip(m 47 32 )} had their clip masks carried over to the next event. Fixes GitHub issue #22.
* Simplify storage size handlingOleg Oshmyan2014-01-261-2/+2
| | | | No functional changes.
* Parser: don't increment render_priv->state.bm_run_id (unnecessary)11rcombs2014-01-251-1/+0
|
* Added x86 ASM functions11rcombs2014-01-251-4/+29
|
* Combine bitmaps before applying blur and shadow11rcombs2014-01-251-224/+521
|
* Remove some ass_msg() callswm42014-01-241-13/+0
| | | | | | | These aren't very useful for debugging due to the high volume of the log output in problem cases. In fact, all they do is making the code slower (the message callback can easily appear in the profiler output, even if the callback doesn't actually print the messages).
* Don't ignore trailing empty lineOleg Oshmyan2014-01-151-4/+5
| | | | | Trailing \N is effectively ignored, but \N\N should still yield an empty line.
* Do not reset \pbo and \p values after each drawingOleg Oshmyan2014-01-081-3/+5
| | | | Confirmed with VSFilter. This complements the previous commit.
* Terminate drawings on {Oleg Oshmyan2014-01-081-7/+8
| | | | | This brings us in line with VSFilter and also fixes Google Code issue #101.
* Distinguish cached glyphs with different hspacing when border_style == 3Oleg Oshmyan2014-01-081-0/+6
| | | | hspacing affects opaque box borders.
* Fix \fsp: use orig_scale_x, not post-fix_glyph_scaling scale_xOleg Oshmyan2014-01-081-1/+1
|
* Don't try to remove end-of-line \fspOleg Oshmyan2014-01-081-4/+0
| | | | | | | | VSFilter does not do this. The code being removed was already buggy: i > 0 should have been "got any non-skipped glyphs since last_break?", and hspacing should have been taken from glyphs[i-1].
* Scale distance to screen plane like blur radiusOleg Oshmyan2014-01-081-1/+2
| | | | | VSFilter forgets to scale this distance, just like it forgets to scale blur radius.
* A whole bunch of parsing and default value fixesOleg Oshmyan2014-01-071-1/+2
| | | | Obtained by reading the xy-VSFilter source code.
* Reset text origin on \fay changes for VSFilter compatibilitywm42013-10-241-2/+9
| | | | | | | | | | | | | | | | | | | | Comparing this rendering of this line: {\fnTahoma\c&H000000&\fs100\an7\fay0.115\pos(240,250)}——————–>{\fay0.0}——> To this line: {\fnTahoma\c&H000000&\fs100\an7\fay0.0\pos(240,250)}——————–>{\fay0.0}——> The second arrow is in the same place for both lines when using VSFilter, but the origin of the second shear is different when using libass. After every change in \fay or a newline, the vertical offset resets to 0. Fixes issue #80. Bug report and patch by BwackNinja (BwackNi...@gmail.com) (this commit corresponds to the patch issue_80_3.patch)
* Cosmetics: remove repetitionwm42013-09-261-38/+35
|
* Fix Hinting againwm42013-09-261-21/+43
| | | | | | | | | | | | Commit 05eb520 missed some duplicated bits in ass_shaper.c. <wm4> oh crap <zgreg> oh crap indeed Instead of duplicating the logic in ass_shaper.c, just change the glyphs before they even get into processing. This way, all code reading the font size etc. is affected. This essentially reverts commit c207000c, because it's not needed anymore.
* Skip both newline and carriage return.Reimar Döffinger2013-09-25</