summaryrefslogtreecommitdiff
path: root/source/fitz/geometry.c
AgeCommit message (Collapse)Author
2018-07-06Fix stray consts.Robin Watts
2018-07-05Add fz_transform_page helper function.Tor Andersson
Create a matrix that transforms a page with resolution and rotation, and grid fits the resulting bounding box.
2018-07-05Pass rect and matrix by value in geometry functions.Tor Andersson
Several things irk me about passing values as const pointers: * They can be NULL, which is not a valid value. * They require explicit temporary variables for storage. * They don't compose easily in a legible manner, requiring weird pointer passing semantics where the variable being assigned is hidden as an argument in the innermost function call. * We can't change the value through the pointer, requiring yet more local variables to hold copies of the input value. In the device interface where we pass a matrix to a function, we often find ourselves making a local copy of the matrix so we can concatenate other transforms to it. This copying is a lot of unnecessary busywork that I hope to eventually avoid by laying the groundwork with this commit. This is a rather large API change, so I apologize for the inconvenience, but I hope the end result and gain in legibility will be worth the pain.
2018-07-04Add fz_is_point_inside_rect utility function.Tor Andersson
2018-06-22Don't pollute namespace with our 'restrict' macro. Use FZ_RESTRICT instead.Tor Andersson
2018-06-22Add fz_quad type.Tor Andersson
2018-02-27Fix fz_expand_rect in presence of empty rectangles.Tor Andersson
2018-02-27Add fz_expand_irect function.Tor Andersson
2018-02-27Add fz_translate_rect helper function.Tor Andersson
2017-05-31Avoid double literals causing casts to float.Sebastian Rasmussen
2017-05-29Make PI/RADIAN/SQRT2/LN2 global single precision float constants.Sebastian Rasmussen
2017-04-27Include required system headers.Tor Andersson
2016-10-24Bug 697234: Fix slow rendering.Robin Watts
fz_contains_rect was improperly implemented (the logic in the final test was reversed). This was causing us to use the font bbox for some t3 glyphs, resulting in massive bboxes, that could never be cached. Rerendering these each time was taking ages, even though there was nothing actually in them.
2016-09-13Bug 696984: Type 3 fonts bbox fixes.Robin Watts
The upshot of debugging this is that: 1) We can't trust the FontBBox. Certainly it appears that no one else trusts it. 2) We can't trust the d1 values in all cases, as it can lead to use rendering glyphs far larger than we'd want to. So we have the compromise used here. 1) We never clip to the FontBBox. 2) If the FontBBox is invalid, then we calculate the bbox from the contents of the data streams. 3) If the FontBBox is valid, and the d1 rectangle given does not fit inside it, then we calculate the bbox from the contents of the data streams. This could theoretically produce problems with glyphs that have much more content than they actually need, and rely on the d1 rect to clip it down to sanity. If the FontBBox is invalid in such fonts, we will go wrong. It's not clear to me that this will actually work in Acrobat/ Foxit/gs etc either, so we defer handling this better until we actually have an example. Tested with bug 694952, and bug 695843 which were the last 2 in this area.
2016-04-28Partial image decode.Robin Watts
Update the core fz_get_pixmap_from_image code to allow fetching a subarea of a pixmap. We pass in the required subarea, together with the transformation matrix for the whole image. On return, we have a pixmap at least as big as was requested, and the transformation matrix is updated to map the supplied area to the correct place on the screen. The draw device is updated to use this as required. Everywhere else passes NULLs in, and so gets unchanged behaviour. The standard 'get_pixmap' function has been updated to decode just the required areas of the bitmaps. This means that banded rendering of pages will decode just the image subareas that are required for each band, limiting the memory use. The downside to this is that each band will redecode the image again to extract just the section we want. The image subareas are put into the fz_store in the same way as full images. Currently image areas in the store are only matched when they match exactly; subareas are not identified as being able to use existing images.
2015-03-30Bug 695556: Use doubles when inverting matrices.Robin Watts
When inverting matrices, use doubles for inversion calculations. This prevents floats over/underflowing and causing stroked content to go missing.
2015-02-24fz_irect_from_rect; don't make a non empty irect from an empty rect.Robin Watts
This avoids up problems with a forthcoming commit.
2014-02-17Add fz_transform_point_xy to simplify transforming a point.Tor Andersson
Many times, the idiom p.x = x; p.y = y; fz_transform_point() is used. This function should simplify that use case by both initializing and transforming the point in one call.
2013-09-30Bug 694526: Spot non-invertable matrices and bale before strokingRobin Watts
The bug fix added in the previous commit fails to work in this case (hang-9527.pdf) because the matrix is not invertible and hence the clipping rectangle ends up infinite. Spot this case here and return early.
2013-06-20Rearrange source files.Tor Andersson