summaryrefslogtreecommitdiff
path: root/draw/draw_blend.c
AgeCommit message (Collapse)Author
2012-07-05Move to static inline functions from macros.Robin Watts
Instead of using macros for min/max/abs/clamp, we move to using inline functions. These are more typesafe, and should produce equivalent code on compilers that support inline (i.e. pretty much everything we care about these days). People can always do their own macro versions if they prefer.
2012-06-11Fix Bug 693102: Overflows in large pixmap indexing.Robin Watts
When we allocate a pixmap > 2G, but < 4G, the index into that pixmap, when calculated as an int can be negative. Fix this with various casts to unsigned int. If we ever move to support >4G images we'll need to rejig the casting to cast each part of the element to ptrdiff_t first.
2012-03-13Add ctx argument and rename fz_bound_pixmap to fz_pixmap_bbox.Tor Andersson
2012-03-13Rename some functions and accessors to be more consistent.Tor Andersson
Debug printing functions: debug -> print. Accessors: get noun attribute -> noun attribute. Find -> lookup when the returned value is not reference counted. pixmap_with_rect -> pixmap_with_bbox. We are reserving the word "find" to mean lookups that give ownership of objects to the caller. Lookup is used in other places where the ownership is not transferred, or simple values are returned. The rename is done by the sed script in scripts/rename3.sed
2012-03-06Split fitz.h/mupdf.h into internal/external headers.Robin Watts
Attempt to separate public API from internal functions.
2012-01-11Stylistic comment and whitespace fixes.Tor Andersson
2012-01-10Add fz_blend_pixel_function.Robin Watts
Inspired by Sumatras gdi devices need for such a function expose the blending functions. Note that we produce unsigned char's where Zenikos original produces ints, but it's otherwise identical. This requires us to make various knockon changes throughout the code from int to unsigned char, none of which should make any difference at all - I hope! We reserve the right to change/amend this function in future to operate on blocks of pixels (or pixels in different colorspaces) (or anything else we think of) in future.
2012-01-03Rework draw device stack handling.Robin Watts
As we create clips/transparency groups etc, we maintain a stack of draw device states. Here we change this from having a 'current' state, and storing changes on the stack to always keeping the complete current state on the head of the stack. This should make error cleanup easier, as well as being conceptually easier to follow (for me at least).
2011-12-30Blending improvementsRobin Watts
More work on MuPDFs blending support. This seems to get l16.pdf working pretty well. Fuller testing required to know if we get everything right, but the maths now makes as much sense as it ever has to me, and seems to track what gs does (more or less, in that we don't use group alpha and gs does).
2011-12-21Fix whitespace.Tor Andersson
2011-08-05More changes to blending of groups.Robin Watts
In an effort to solve bug 692377, examine what ghostscript does, and move mupdf into line with it. Firstly, it seems that rather than collecting a pure 'shape' plane ghostscript keeps a 'shape-with-alpha' plane. Only a tiny change is required to move mupdf to the do the same thing, so done here. Secondly, it seems that ghostscript 'uncomposites' the result of non-isolated groups, before applying the blend mode. It's not clear to me that this is entirely correct; this 'uncomposite' operation assumes that all compositing has been done internally with the 'normal' blend mode. Nonetheless, I do the same here, and it seems to work. This 'uncomposite' operation may yet turn out to be a source of bugs if I have muddled the use of premultiplied and non-premultiplied components, but it seems to work on the testfiles I have.
2011-08-01Fix bug 692377: Incorrect rendering of blending groups.Robin Watts
A combination of constant alpha and non-zero blending modes resulted in incorrect rendering. Various fixes seem to have made it work: * Allow for non-full alpha when blending non-isolated groups back. * Clamp blended pixels to allow for overflow. * Allow for alpha in the shape blending.
2011-07-13Non-isolated group support, and fix Bug 692336.Robin Watts
Firstly, this takes on some of Zenikos patch to correct the clip stack handling that was broken by the fix to bug 692287 (in commit 2c3bbbf). This bug should now be solved. We add a new 'shape' field to the draw device structure (and clip stack). When we are inside non-isolated groups, this is set to be a pixmap where we accumulate the 'shape' of the objects drawn. When we come to blend back, if we are blending a non-isolated group back, we have to use a different blending function that takes account of the shape. Various internal groups (the page group, and groups used to force blending) are set to be isolated to avoid carrying shape planes around when this is not required. All our rendering code now has to know how to maintain the shape plane as well as doing the basic rendering.
2011-04-10Make blendmode opaque.Tor Andersson
2011-04-08Remove inline keyword where it is not strictly necessary for performance.Tor Andersson
Also put the function on the same line for inline functions, so they stick out and are easy to find with grep.
2011-04-04Le Roi est mort, vive le Roi!Tor Andersson
The run-together words are dead! Long live the underscores! The postscript inspired naming convention of using all run-together words has served us well, but it is now time for more readable code. In this commit I have also added the sed script, rename.sed, that I used to convert the source. Use it on your patches and application code.
2011-04-04draw: Rename files in draw directory.Tor Andersson