Age | Commit message (Collapse) | Author |
|
|
|
Create a matrix that transforms a page with resolution and rotation,
and grid fits the resulting bounding box.
|
|
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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.
|
|
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.
|
|
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.
|
|
When inverting matrices, use doubles for inversion calculations. This
prevents floats over/underflowing and causing stroked content to go
missing.
|
|
This avoids up problems with a forthcoming commit.
|
|
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.
|
|
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.
|
|
|