[cairo] [PATCH] PDF: alpha-gradients+stroking/non-stroking
operators separated; cairo_paint_with_alpha
krh at bitplanet.net
Wed Aug 2 14:44:09 PDT 2006
On 7/27/06, Miklós Erdélyi <erdelyim at gmail.com> wrote:
> These are two patches (as requested by Kristian) which are separated
> from the previous bigger patch which introduced not properly
> implemented reused patterns. Mainly the image reusing method was
> problematic with the previous patch.
Looking through the gradients patch, it looks to me like there's a lot
of duplicated code between emit_linear_pattern and emit_radial_pattern
- everything after creating transparency group stream looks identical.
I'd suggest moving it out into a shared function (something like
_cairo_pdf_write_transparency_group ()). That way you also wont have
to #define TRANS_GROUP_DICTIONARY and the other #defines. Did you
look into using cairo_hash_table_t for storing the function sets?
For the paint_with_alpha patch, it looks like the surface_alpha could
be a parameter to emit_pattern instead. It's only set briefly while
calling emit_pattern and then set back to 1.0, so it's really better
done as a parameter.
Btw, from the whitespace in your patches, I'm guessing your editor is
set to display tabs as 4 spaces. In that case the cairo source code
will look weird, but if you set it to 8 spaces it should be easy
enough to follow the cairo code convention (see CODING_STYLE).
Did you look into the surface serial number approach for reusing the images?
Keep up the good work,
More information about the cairo