summaryrefslogtreecommitdiff
path: root/source/fitz/draw-glyph.c
AgeCommit message (Collapse)Author
2016-01-21Drop the const on fz_font.Tor Andersson
The font is an immutable opaque structure, no need to add the const keyword since users aren't expected or expecting to change it.
2016-01-13Add lots of consts.Robin Watts
In general, we should use 'const fz_blah' in device calls whenever the callee should not alter the fz_blah. Push this through. This shows up various places where we fz_keep and fz_drop these const things. I've updated the fz_keep and fz_drops with appropriate casts to remove the consts. We may need to do the union dance to avoid the consts for some compilers, but will only do that if required. I think this is nicer overall, even allowing for the const<->no const problems.
2015-02-17Add ctx parameter and remove embedded contexts for API regularity.Tor Andersson
Purge several embedded contexts: Remove embedded context in fz_output. Remove embedded context in fz_stream. Remove embedded context in fz_device. Remove fz_rebind_stream (since it is no longer necessary). Remove embedded context in svg_device. Remove embedded context in XML parser. Add ctx argument to fz_document functions. Remove embedded context in fz_document. Remove embedded context in pdf_document. Remove embedded context in pdf_obj. Make fz_page independent of fz_document in the interface. We shouldn't need to pass the document to all functions handling a page. If a page is tied to the source document, it's redundant; otherwise it's just pointless. Fix reference counting oddity in fz_new_image_from_pixmap.
2013-11-27fix regression from da277059b37380d57028ff79a636f4d725c96e8fSimon Bünzli
The changes to fz_render_glyph cause the scissor rectangle to no longer match the transformation matrix which causes Type 3 glyphs to be clipped at larger resolutions.
2013-09-13Fix various compile warnings spotted by the cluster.Robin Watts
2013-09-02Expose subpixel glyph adjustment calculations.Robin Watts
Pull subpixel glyph adjustment calculations into fz_subpixel_adjust. This reduces the repetition of code, and will be helpful for the OpenGL device.
2013-09-02Add glyph rendering routines that return fz_pixmaps rather than fz_glyphs.Robin Watts
These do no caching, and are intended to be useful for the opengl device.
2013-09-02Be smarter when quantising sub pixel positions for glyphs.Robin Watts
For large glyphs, sub pixel positioning is supremely unimportant. Even for smaller glyphs, we don't need 5*5 possible sub pixel positions. Base the degree of sub pixel quantisation on the size of the glyphs. This should result in better cache use. We push all the glyph sub positioning logic into fz_render_glyph (and fz_render_stroked_glyph). This simplifies the calling code. We also tweak fz_render_glyph so that it updates the transform it is called with to reflect the sub pixel positioning. This solves various problems: Firstly, we can round positions both up and down to achieve a smaller net displacement (e.g. (0.99, 0.99) can go to (1,1) rather than (0.75, 0.75) if we have a subpixel position resolution of 1/4 pixels). Secondly, glyphs that are drawn from outlines will have exactly the same subpixel changes applied. This is unlikely to be noticable, but it does mean that baselines should avoid having any shifts in them. Finally, it enables us to avoid lots of unnecessary copying of matrices, hopefully reducing overhead.
2013-08-30Use RLE coding scheme for glyph bitmaps.Robin Watts
Rather than generating fz_pixmaps for glyphs, we generate fz_glyphs. fz_glyphs can either contain a pixmap, or an RLEd representation (if it's a mask, and it's smaller). Should take less memory in the cache, and should be faster to plot.
2013-08-28Dump glyph cache size as part of mudraw -MRobin Watts
2013-08-26Fix memory leak in new glyph cache code.Robin Watts
Forgot to drop the font.
2013-08-22Rework glyph cache to enable partial eviction.Robin Watts
The current code uses a hash table with linear probing. This means that when the cache fills up, we have no alternative but to bin the whole thing (or do an expensive rebuild). Change to using a simple hash table with linked lists of bucket chains, and additional LRU lists. This way we can ditch the oldest glyphs as we need more space.
2013-06-27Bug 694382: Fix problems arising from recent pdf_obj changes.Robin Watts
Thanks to zeniko for spotting these problems. When we close a document, purge the glyph cache to ensure that no type3 glyphs hang around with pointers to pdf_obj's that are now gone. Pass doc to pdf_new_obj_from_str rather than NULL. We believe that the reason this needed to be NULL is no longer valid. Also, revert to using an int for ref counts. In a quick test of our regression suite we only found 2 files that ever made a refcount > 256 (and they never got larger than 768), but the potential is there for issues. Reverting to an int until we can think of a better idea.
2013-06-20Rearrange source files.Tor Andersson