mapnik/mapnik — pull request #2107 by zerebubuth (2013-12-10 12:35:23+00:00)
Title: Refactor common renderer fields and methods

There's a lot of commonality between the various renderers; AGG, Grid, Cairo & SVG. These changes are an attempt to extract that commonality without affecting the functionality of the code - more on that later.

The first set of changes extract common fields shared between renderers, and these are in `renderer_common.hpp`. The common fields are about font management, collision detection and extent / projection settings, and were extracted to a composed object rather than an inherited one. The choice was just down to the common fields not really constituting a renderer in themselves, and so the "is-a" relationship did not seem appropriate. It should be simple enough to change if people feel differently.

The second set of changes builds on this to extract commonality between the renderer implementations of the various `process()` methods. These are all conceptually doing the same thing, so we should expect to be able to share a large amount of their code and be able to implement new features or fix bugs in only one place. Some renderers support features that others do not (e.g: AGG's gamma support), which complicates the issue. The implementation of the text and shield symbolizers has been shared for a long time, but these changes increase sharing of code between the building, markers, point, polygon and raster symbolizers. The line, line pattern and polygon pattern symbolizers had larger differences and I did not think it would be possible to increase sharing of the code with these without causing test failures.

When testing, the exact same tests fail on the `expr-v2` branch as at the tip of this PR, which should mean that I've not added any extra failures. If one of those existing failures (due, perhaps, to harfbuzz library version differences) is masking a new failure, please let me know.