summaryrefslogtreecommitdiffstats
path: root/libass/ass_render.c
Commit message (Collapse)AuthorAgeFilesLines
* Match first occurence of \fade, \fad, \an and \a tagsGrigori Goronzy2011-05-301-0/+1
| | | | | Track if we already parsed a fade or a alignment tag and ignore all further tags.
* VSFilter compat: don't render shadow when glyph/border invisibleGrigori Goronzy2011-04-091-0/+5
| | | | | Yet another VSFilter idiosyncracy: when the glyph fill is invisible (alpha 0xFF) and there is no border, do not render any shadow.
* Simplify word wrapping and fix possible endless loopGrigori Goronzy2011-02-091-14/+5
| | | | | | | | | | | | | | | | | | wrap_lines_smart() got stuck if there was a long line without spaces followed by a hard linebreak. When the loop got to the '\n' character the hard linebreak was not handled because the line was already over wrap length and soft linebreak handling had precedence. Then at the end of the loop body the code noted that the hard linebreak hadn't yet been handled, and the same glyph needed to be reprocessed for that. However, the soft linebreak code hadn't actually done anything because there was no space to break at, and thus the loop repeated from the exact same state forever. Handle this by removing the check for an additional hard linebreak after a soft linebreak, which stepped back by one char. This is a very marginal case and shouldn't really matter in practice. Original patch and parts of this message by uau.
* Relicense to ISCGrigori Goronzy2010-09-281-12/+10
| | | | | | In hope to make libass as useful as possible, relicense libass to ISC, a simplified 2-clause BSD license. All contributors who provided non-trivial changes have granted their permission for this.
* Only word wrap on spacesGrigori Goronzy2010-08-121-7/+3
| | | | | | It looks like VSFilter only ever wraps on spaces, even if the line length is going to overflow. We should do that as well. Fixes a pretty confusing problem with scrolling vertical text.
* Get rid of NULL checks for freeGrigori Goronzy2010-08-091-5/+4
| | | | | The useless "if (foo) free(foo)" idiom is all over the place, just get rid of it finally...
* Fix drawing leakage: delay glyph allocationGrigori Goronzy2010-08-091-2/+1
| | | | | | Delay allocation of the "faux" glyph until a drawing is parsed. This helps with fixing a (pretty bad) memory leak and also reduces frame overhead a little.
* Check vector clip mask bounding box sizeGrigori Goronzy2010-08-011-5/+13
| | | | | | Similar to regular glyphs, check the bounding box of the clip mask and refrain from rendering humongous masks, which can take up considerably memory.
* Fix TextInfo reallocationGrigori Goronzy2010-08-011-1/+1
|
* Don't initialize bitmap hash key with bogus valuesGrigori Goronzy2010-08-011-2/+0
|
* refactor: extract glyph hash key fillGrigori Goronzy2010-08-011-24/+34
|
* refactor: move transformation/projection functionsGrigori Goronzy2010-08-011-80/+75
| | | | Gets rid of another forward declaration.
* Cosmetics: various cleanups in ass_render.cGrigori Goronzy2010-08-011-43/+36
| | | | | Cosmetical simplifications, fix whitespace where useful, remove deprecated comments.
* Handle allocation failure of clipped bitmapsGrigori Goronzy2010-08-011-0/+2
|
* Check ASS_Image allocationGrigori Goronzy2010-08-011-7/+13
|
* refactor: remove unneeded includesGrigori Goronzy2010-08-011-15/+1
| | | | These are included by ass_render.h already.
* refactor: move ASS_Renderer getters/setters/etc into separate fileGrigori Goronzy2010-08-011-125/+1
|
* refactor: extract bitmap hash key fillGrigori Goronzy2010-08-011-96/+80
|
* refactor: extract cache check/managementGrigori Goronzy2010-08-011-20/+27
|
* Limit (bitmap) glyph cache sizeGrigori Goronzy2010-08-011-4/+6
| | | | | | | | | | Now that bitmap glyphs (for vector clip masks) are stored in the glyph cache, make sure it cannot grow indefinitely easily. Similar to the bitmap cache, track approximate size of the cached elements and reset if the cache exceeds a certain limit. Also, reduce default bitmap cache size to 30 MB as we have essentially two bitmap caches now. That's still plenty in all use cases where caching matters.
* Parse vector clip mask only after cache missGrigori Goronzy2010-07-291-2/+23
|
* Cache vector clip masksGrigori Goronzy2010-07-221-11/+31
| | | | | Cache pre-rasterized vector clip masks, big speedup if vector clipping is used extensively.
* refactor: move position translation functionsGrigori Goronzy2010-07-221-55/+51
| | | | Gets rid of a few forward declarations.
* Better PAR correctionGrigori Goronzy2010-07-221-29/+48
| | | | | | | | | | PAR correction so far merely applied a horizontal scaling factor to glyphs right after loading. This screws up transformed text, unfortunately. It's a much better approach to typeset text without correction and scale everything at the very end. In MPlayer, an EOSD rendering now looks exactly the same as a video filter rendering (except for more sharpness in the EOSD case).
* Drawing cache: include scale factor in hash keyGrigori Goronzy2010-07-141-1/+5
|
* Avoid unnecessary conditional and initializationsGrigori Goronzy2010-07-141-4/+3
|
* Simple optimizations to memory handlingGrigori Goronzy2010-06-271-4/+2
|
* Reduce number of glyph copiesGrigori Goronzy2010-06-271-16/+18
| | | | | | | | | Do not copy glyphs when it isn't really needed. Profiling with valgrind's callgrind showed that FT_Glyph_Copy takes a big fraction of the rendering time (~40%) for "simple styled softsubs" cases. It turned out that glyphs are duplicated much more often than is necessary. Reducing the number of copies cuts down the rendering time for the "simple styled softsubs" case by about 70%!
* Add fixups for various font defectsGrigori Goronzy2010-06-261-82/+0
| | | | | | | | Reverse "outside" contours with wrong winding correction, require that a contour is "inside" for considering its removal; Move this hack into ass_font.c, where it belongs. Initial patch by uau.
* Fix off-by-one error in cbox calculationGrigori Goronzy2010-06-071-1/+1
| | | | | The last point wasn't included in cbox calculation, sometimes triggering removal of inside contours when it wasn't needed.
* Move frame size setup into ass_reconfigureGrigori Goronzy2010-02-121-16/+15
| | | | It isn't needlessly run every frame this way. Also it's cleaner.
* Use font scaling coefficient 1.0 by defaultGrigori Goronzy2010-02-061-0/+2
|
* Do not try to render if fonts have not been configuredGrigori Goronzy2010-02-061-0/+3
|
* Skip border generation if glyph is collapsedGrigori Goronzy2010-01-211-2/+3
| | | | | | | | | If a character is completely collapsed in x or y direction (\fscx0, \fscy0), the rasterizer will not generate any visible pixels. This also means vsfilter will never draw any border in this case, since it works on the pixel data. FreeType's stroker OTOH happily draws a border around a character, no matter how collapsed it is. Emulate vsfilter's behavior by skipping border generation if the glyph is collapsed.
* Adjust a few message levels and message textsGrigori Goronzy2010-01-191-4/+4
|
* Use conversion functions to generate cache keysGrigori Goronzy2010-01-071-6/+6
| | | | | Use the fixed-point conversion functions instead of (slightly incorrect) manual conversion.
* Improve rotation cache accuracyGrigori Goronzy2010-01-071-3/+3
| | | | | | In some cases 16.16 precision is not good enough. Instead use 10.22 and use modulo 360.0 on the angles to make overflows impossible and improve cache hit ratio sometimes.
* Reset clip_mode on new eventsGrigori Goronzy2010-01-051-0/+1
| | | | | | | Make sure that the clip mode is reset to regular on new events. Otherwise events after an event that used inverse clip will also use inverse clip. Ouch! Usually the symptom is that subtitles become invisible as the whole screen is clipped.
* Fix libass w/o fontconfigGrigori Goronzy2009-10-111-1/+2
| | | | | | | | | Make sure that libass does not crash even if no default font is provided. Additionally, fix crashes related to drawings in this and possibly other unusual cases. Document the default_path and default_family parameters of ass_set_fonts.
* Refactor: effect parsing should be in ass_parse.cGrigori Goronzy2009-09-161-76/+0
| | | | | Move the function apply_transition_effects, which parses event-global effects and adjusts a few state variables, into ass_parse.c.
* Disable kerning by default and make it configurableGrigori Goronzy2009-09-081-1/+2
| | | | | | | | | | | | | | | | | | Kerning causes problems with many (broken) fonts. VSFilter doesn't use kerning so these problems won't be apparant, while libass uses kerning by default. For compatibility reasons, disable kerning by default. In addition, make it configurable through style overrides and the Script Info header. I.e. put "Kerning: yes" into the Script Info header to enable kerning. With MPlayer, using "-ass-force-style Kerning=yes" will always enable kerning. This also includes a minor ABI change for tracking the kerning boolean. As this only affects code that creates or modifies ASS_Tracks manually, and I'm not aware of anyone doing that, the SONAME will not be bumped.
* Refactor: move event parsing code into separate fileGrigori Goronzy2009-09-011-843/+2
| | | | | Move all code related to parsing event lines and processing override tags into a separate file (ass_parse.c).
* Fix underrun in slant pen correctionGrigori Goronzy2009-09-011-1/+2
|
* Handle illegal \a tags like VSFilterGrigori Goronzy2009-09-011-1/+2
| | | | Treat the illegal \a value 8 like 5 for compatibility with VSFilter.
* opaque box: do not subtract glyph from borderGrigori Goronzy2009-09-011-1/+2
| | | | | Similar to VSFilter, do not subtract the glyph bitmap from the border bitmap when BorderStyle 3 is used.
* Calculate glyph slant width correctlyGrigori Goronzy2009-08-311-4/+7
| | | | | | If a glyph is wider than its advance width for italic to non-italic style changes, assume it was obliqued by FreeType's FT_GlyphSlot_Oblique function and offset the next glyph accordingly.
* Fix order of pen advance assignmentsGrigori Goronzy2009-08-231-3/+3
|
* Fix opaque box sizing againGrigori Goronzy2009-08-231-7/+20
| | | | | | | | | Another try to get it to work like in VSFilter. Hopefully it's behaving the same now (except in some cases, since VSFilter layouts word-based, but libass is glyph-based). Additionally, make sure horizontal letter spacing (\fsp) is scaled according to ScaleX.
* Fix glyph overlap blendingGrigori Goronzy2009-08-231-14/+13
| | | | | | | | | | Use the bitmap pointer for the cache hash key. This preserves the blending history, which fixes occasional corruptions due to previous replacements not being dealt with correctly. It also simplifies the hash key a lot and thus speeds up cache lookups. Additionally, change the blending equation from max(a, b) to min(a + b, 0xff), i.e. a saturating addition. Usually this looks a lot better.
* Scale kerning according to x font scaling factorGrigori Goronzy2009-08-221-2/+4
|
* Trim whitespace after line wrappingGrigori Goronzy2009-08-221-6/+85
| | | | | Mark leading and trailing spaces on lines and adjust layouting code to respect these marks and skip the spaces.
* Clip vector blending: do not copy last row paddingGrigori Goronzy2009-08-201-1/+1
| | | | | | Do not copy the padding on the last row into the new buffer since we cannot rely on the padding actually existing; might fix a segfault in some obscure cases.
* Adjust shearing behavior to match VSFilterGrigori Goronzy2009-08-201-9/+15
| | | | | | | | Make horizontal shearing (\fax) shear from top to bottom of a glyph; scale shearing factors with horizontal and vertical scaling factors. This makes the shearing operations similar to VSFilter, except for \fay in some cases, but this is not unexpected. Vertical shearing is implemented different on purpose.
* VSFilter quirk: double-scale widths of opaque boxesGrigori Goronzy2009-08-201-0/+5
| | | | | | | VSFilter double-scales the widths of the opaque box in X direction, which gives much wider boxes than expected (or much less wider boxes) if ScaleX != 100. Emulate this behavior, even if it is unbelievably stupid and no doubt a bug in VSFilter.
* Fix caching of underlined/striked out glyphsGrigori Goronzy2009-08-151-0/+2
|
* Implement wrap style 1Grigori Goronzy2009-08-141-5/+4
| | | | | Skip application of the algorithm that moves words between the lines to equalize line length for wrap style 1.
* Cosmetics: ass_render.c formattingGrigori Goronzy2009-08-141-19/+18
|
* Use event bbox for collision detectionGrigori Goronzy2009-08-131-6/+24
| | | | | | Consider the bounding box of an event for collision detection instead of only its vertical position and height. This allows multiple events per line if they don't overlap.
* Scale ascender/descender for opaque boxesGrigori Goronzy2009-08-131-0/+4
|
* Do not draw opaque box if border size zeroGrigori Goronzy2009-08-121-1/+3
| | | | This follows VSFilter's behavior.
* BorderStyle cache integrationGrigori Goronzy2009-08-121-0/+4
| | | | | Add new fields to the cache hash key for BorderStyle 3 (glyph cache and bitmap cache).
* Always parse colors as hex for ASS tracksGrigori Goronzy2009-08-121-3/+6
| | | | | | According to the ASS specification, colors can only be specified in hex. Modify the color parsing accordingly; this especially means that colors where the hex sigil (the "H") is missing can now be parsed.
* Fix italic to non-italic space handlingGrigori Goronzy2009-08-121-4/+6
| | | | | | Scan backwards in the glyph array for a glyph with some actual points when correctin glyph spacing after italic to non-italic style changes. This is mostly useful in case a space ends italicized text.
* Support \q override tagGrigori Goronzy2009-08-121-2/+10
| | | | | | Parse \q override tag and set a new state variable to its value. The line wrapping code still needs improvements; wrap style 0/3 are not entirely correctly implemented and style 1 is not implemented.
* Implement BorderStyle 3Grigori Goronzy2009-08-121-3/+48
| | | | | | | The "opaque box" border style renders an opaque box in the glyph area instead of rendering a regular stroked border. This implementation replaces the glyph outline by an outline that contains only one rectangle with the size of the glyph, plus optional extra border.
* Fix advance for italic to non-italic style changesGrigori Goronzy2009-08-121-0/+9
| | | | | | | | | After a italic to non-italic style change the space between the glyphs is sometimes wrongly calculated, especially if the font doesn't have an italic version and FreeType falls back to oblique glyphs. In such cases, add additional space to the glyph's advance to make up for the slant of the glyph; the amount is calculated from the glyph's bbox.
* Factor out renderer types into separate fileGrigori Goronzy2009-08-071-216/+1
|
* Rename typedefs (breaks API)Grigori Goronzy2009-08-061-219/+222
| | | | | | Rename all typedefs from the convention foo_bar_t, which can possibly conflict with POSIX types, to FooBar (and ASS_FooBar for public API typedefs). Fix formatting and stray comments while at it.
* Fix typoGrigori Goronzy2009-08-051-1/+1
|
* Clarify the AR parameter meaningsGrigori Goronzy2009-08-051-7/+7
| | | | Use the correct terms (SAR/DAR) for the aspect ratio parameters.
* Get rid of MAX_EVENTS limitGrigori Goronzy2009-07-301-3/+3
| | | | | Allocate the maximum possible number of used events in fix_collisions dynamically, eliminating the MAX_EVENTS limit.
* Do not round karaoke timing coordinatesGrigori Goronzy2009-07-291-2/+2
| | | | | | Do not round the coordinates of the glyph bbox (when converting 26.6 fixed-point to integer); they are used for timing karaoke. Doing so can sometimes make \k and \ko karaoke not apply correctly.
* Fix \k and \ko tagsGrigori Goronzy2009-07-281-2/+2
| | | | | | The timing calculations for \k and \ko were off and still assumed int values for a bbox, while it now uses a d6 representation. This essentially made duration about 64 times as long as it should be.
* Clean up typedefs/structsGrigori Goronzy2009-07-281-15/+15
| | | | | Remove useless _s suffix from struct names and remove struct name where not needed (only the typedef'd struct is used). Clean up API headers.
* Remove shift vector in ass_render_eventGrigori Goronzy2009-07-251-9/+3
| | | | | | | The shift is not calculated when fetching a glyph anymore. Instead, it is calculated right before rasterizing a glyph. Remove the shift vector and make get_outline_glyph, the glyph cache and ass_font_set_transform work without supplying a shift vector.
* Assume 4:3 AR when calculating missing PlayResX/YGrigori Goronzy2009-07-251-7/+2
| | | | | In case only one PlayResX/Y component is specified, calculate the other component by assuming a 4:3 aspect ratio. This is similar to vsfilter.
*