summaryrefslogtreecommitdiff
path: root/src/cairo-surface-wrapper.c
Commit message (Collapse)AuthorAgeFilesLines
* Fix shared use of recording surface with paginated targetsAdrian Johnson2023-01-151-57/+73
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | The problem is _cairo_recording_surface_replay_and_create_regions() stores the cairo_recording_region_type_t in the same structure as the recording commands. This does not work well when the recording surface is used as source by multiple surfaces Fix this by moving the cairo_recording_region_type_t into a separate struct cairo_recording_regions_array_t. This struct is stored in a list that allows multiple create regions results to be store in the surface. The new function _cairo_recording_surface_region_array_attach() is used to create a new cairo_recording_regions_array_t, attach it to the recording surface and return a unique region id. The _cairo_recording_surface_replay_and_create_regions() and _cairo_recording_surface_replay_region() functions use this region id to identify the cairo_recording_regions_array_t. To handle nested recording surfaces, when replaying a recording, the region id is passed to the target as an extra parameter in the surface pattern. The wrapper surface makes a temporary copy of the pattern to ensure the snapshot pattern in the recording surface is not modified. cairo_recording_regions_array_t has a reference count so the target can hold on to the cairo_recording_regions_array_t after the paginated surface has called _cairo_recording_surface_region_array_remove().
* Fix user-font with foreground in group failures on image, PDF, and PSAdrian Johnson2023-01-031-33/+0
|
* Allow user fonts to use the foreground colorAdrian Johnson2021-09-181-0/+33
|
* Remove all gstate from _cairo_surface_tagAdrian Johnson2021-07-181-36/+2
| | | | | The gstate is not required and was causing some tag operations to be ignored.
* Add tag functions to recording surface and surface-wrapperAdrian Johnson2016-10-011-0/+47
|
* pdf: fix record-replay-extend test failuresAdrian Johnson2016-06-051-2/+5
|
* Fix test failures when recording surface extents has negative x,yAdrian Johnson2016-06-051-6/+0
| | | | | Fixes record-neg-bounded-extents (image only) and recording-ink-extents.
* ps: fix subsurface recordingsAdrian Johnson2015-10-171-3/+3
|
* surface: Merge scratch construction into _cairo_surface_create_scratchAlexander Larsson2013-09-051-2/+2
| | | | | | | | | | | We merge _cairo_surface_create_similar_scratch and _cairo_surface_create_similar_solid into a single function named _cairo_surface_create_scratch, to avoid confusion with cairo_surface_create_similar which now will have a different behaviour wrt the sizes and the device-scale. _create_scratch assumes the width and height are in backend coordinates, while create_similar does not.
* gstate: Move device-scale font scaling to gstateAlexander Larsson2013-09-051-3/+2
| | | | | | | | | | If we do this in surface it will be applied twice then we chain to a different surface, like e.g. a subsurface. We also remove a hack in cairo-surface-wrapper where it compensated for the device scale not being applied. v2: Compute the backend CTM in ensure_scaled_font().
* Split cairo-clip-privates into struct+inlinesChris Wilson2012-04-191-0/+1
| | | | | References: https://bugs.freedesktop.org/show_bug.cgi?id=48577 Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
* surface-wrapper: Only apply the wrapped transform to the scaled-fontChris Wilson2012-03-061-3/+5
| | | | | | | And not the device_transform of the target. This smells fishy, but appears to make the test suite happy. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
* surface-wrapper: Apply the scaled-font ctm and non-default font-optionsChris Wilson2012-02-281-2/+16
| | | | | | Improves record*-text-transform. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
* surface-wrapper: Apply replay transforms to scaled fontChris Wilson2012-02-271-1/+11
| | | | | Improves: record2x-select-font-face, record2x-text-transform Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
* surface-wrapper: Transform the clip by the device-transform correctlyChris Wilson2012-02-221-6/+2
| | | | | | Fixes paginated fallbacks. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
* Wrapper: Don't translate clips extents' originUli Schlachter2012-02-101-4/+0
| | | | | | | | | | | If a bounded recording surface doesn't have its extents .x and .y at the surface's origin, this code was translating all clips to make up for that. However, the clip already is in device space. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=41583 Signed-off-by: Uli Schlachter <psychon@znc.in> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
* wrapper: transform the clip into device spaceChris Wilson2011-09-201-7/+1
| | | | | | We need more than just mere translation! Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
* wrapper: intersect with target extentsChris Wilson2011-09-171-19/+30
| | | | | | | Treat the target extents as an implicit clip for computing the maximal operation extents. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
* Introduce a new compositor architectureChris Wilson2011-09-121-2/+4
| | | | | | | | | | | | | | | | | | Having spent the last dev cycle looking at how we could specialize the compositors for various backends, we once again look for the commonalities in order to reduce the duplication. In part this is motivated by the idea that spans is a good interface for both the existent GL backend and pixman, and so they deserve a dedicated compositor. xcb/xlib target an identical rendering system and so they should be using the same compositor, and it should be possible to run that same compositor locally against pixman to generate reference tests. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> P.S. This brings massive upheaval (read breakage) I've tried delaying in order to fix as many things as possible but now this one patch does far, far, far too much. Apologies in advance for breaking your favourite backend, but trust me in that the end result will be much better. :)
* record: Offset the clip by the replay transformation as wellChris Wilson2011-08-141-4/+11
| | | | | | | | Fixes push-group-offset which reduces to a replay of a recording surface inside a recording surface and forgot to offset the clip imposed by the extents of the first recording surface into device space. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
* wrapper: Use the backend->snapshot functionChris Wilson2011-08-141-1/+4
| | | | | | Create the snapshot now, rather than a new lazy snapshot surface. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
* surface-wrapper: Initialise clip to NULLChris Wilson2011-08-131-1/+2
| | | | Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
* script: Compile fixChris Wilson2011-08-101-2/+5
| | | | Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
* wrapper: translate the clip by the device transformChris Wilson2011-07-261-0/+6
| | | | | | | | | A stepping stone, the translation was accidentally dropped when changing the clipping to be performed first. Fixes twin. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
* wrapper: target to recording needs the inverse transformChris Wilson2011-07-261-2/+23
| | | | | | | Gah, I thought about this and noted that I need the inverse of the normal transformation, yet failed to remember to actually use it. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
* record: Check the operation against the target device extents.Chris Wilson2011-07-261-0/+44
| | | | Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
* recording: Combine the clip to the recording + target surface extentsChris Wilson2011-07-241-8/+7
| | | | Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
* wrapper: Correct translation of clip for wrapper extentsChris Wilson2011-07-241-15/+8
| | | | Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
* wrapper: show-text-glyphs can now operate on constant array of glyphsChris Wilson2011-07-241-2/+2
| | | | Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
* wrapper: Use the stack for small glyph allocationsChris Wilson2011-07-241-10/+15
| | | | Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
* wrapper: Factor out the common clip handlingChris Wilson2011-07-241-158/+73
| | | | Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
* recording: Move the glyph allocation into the wrapper after checking clip statusChris Wilson2011-07-241-29/+59
| | | | Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
* surface-wrapper: Fix use of uninitialised variableChris Wilson2011-07-231-2/+2
| | | | | | | | | | | | Introduced recently in a30a7402f73485dabdb6a016178247f9844017a1, ==32234== Conditional jump or move depends on uninitialised value(s) ==32234== at 0x6BCA326: _cairo_surface_wrapper_needs_device_transform (cairo-surface-wrapper.c:549) ==32234== by 0x6BCB47D: _cairo_surface_wrapper_set_inverse_transform (cairo-surface-wrapper.c:579) ==32234== by 0x6BCB55A: _cairo_surface_wrapper_init (cairo-surface-wrapper.c:621) ==32234== by 0x6BB87A6: _cairo_recording_surface_replay_internal (cairo-recording-surface.c:854) Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
* image: replay the recording surface directly onto the targetChris Wilson2011-07-231-79/+111
| | | | | | | | | | | | | | 백현기 reported a use-case where he was recording an entire web-page onto the recording surface, in order to facilitate panning. In this scenario, where there may be lots of similar surfaces within the recording we generate thousands of unused snapshot-images bloating memory usage and impairing performance. Under the right conditions we can replay directly onto the destination which not only bypasses the snapshots but also skips the following resampling. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
* clip: Rudimentary support for clip-polygon extractionChris Wilson2011-07-191-164/+64
| | | | | | | Step 1, fix the failings sighted recently by tracking clip-boxes as an explicit property of the clipping and of composition. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
* pattern: Add observer hooksChris Wilson2011-07-151-0/+1
| | | | | | | | | In order for custom context to automatically track when a pattern is modify after being set on the context (and before it is used in an operator), we need for there to be a callback when the pattern is modified. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
* Fix regression in fallback-resolution testAdrian Johnson2010-11-211-12/+0
| | | | | a2254e56 caused the fallback-resolution test to display empty fallback images for to push_group/pop_group part of the test.
* ps: Enable native encoding of subsurface patterns.Chris Wilson2010-04-301-57/+257
| | | | | | | | | | Carefully handle subsurfaces of a recording surface through the analysis and paginated surfaces so that we can generate a native pattern for the vector backends, demonstrated by the PostScript backend. Nothing remarkable, just a lot of bookkeeping to track the wrapped surface types and to apply the correct offsets when generating the subsurface pattern.
* Update FSF addressAndrea Canciani2010-04-271-1/+1
| | | | | | | | | | | I updated the Free Software Foundation address using the following script. for i in $(git grep Temple | cut -d: -f1 ) do sed -e 's/59 Temple Place[, -]* Suite 330, Boston, MA *02111-1307[, ]* USA/51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA/' -i "$i" done Fixes http://bugs.freedesktop.org/show_bug.cgi?id=21356
* clip: Remove the redundant _cairo_clip_init_rectangle()Chris Wilson2010-03-231-9/+5
| | | | | | | | | | | | As _cairo_clip_init_rectangle() is equivalent and more importantly more clearly written as: _cairo_clip_init(&clip); if (status = _cairo_clip_rectangle(&clip, &rect)) { _cairo_clip_fini(&fini); return status; } perform the transformation and in the process catch a few mistakes along error paths.
* wrapper: Apply device transform inverse as appropriate.Chris Wilson2010-03-211-58/+31
| | | | | Fixes many failures of the paginated surfaces as they replayed through the recording surfaces.
* Constify stroke style and matrices.Chris Wilson2010-01-221-6/+6
| | | | | | As a simple step to ensure that we do not inadvertently modify (or at least generate compiler warns if we try) user data, mark the incoming style and matrices as constant.
* Move _cairo_error() to a standalone headerChris Wilson2010-01-221-0/+1
| | | | | A pending commit will want to include some utility code from cairo and so we need to extricate the error handling from the PLT symbol hiding.
* surface-wrapper: Avoid copying patterns and clips unless transformed.Chris Wilson2010-01-221-59/+75
| | | | | | An older variant of the fixes for moving the device transformation out of the surface layer, but languished in a side branch. The only benefit of this patch is that it avoids the copy where possible.
* Apply device transform in surface wrapperBenjamin Otte2009-11-271-10/+46
|
* [wrapper] Avoid a void return gccism.M Joonas Pihlaja2009-09-011-1/+1
| | | | | Returning void using the pattern "return func_returning_void(...)" is a gccism not supported by Sun Studio 12.
* [wrapper] Always copy clipChris Wilson2009-08-291-16/+44
| | | | | We always need to make a local copy of the clip as the backends are free to modify it as they process the operation.
* Introduce cairo_tee_surface_tChris Wilson2009-08-291-0/+7
| | | | | | | Add a new surface type that multiplies it input onto several output surfaces. The only limitation is that it requires a master surface that is used whenever we need to query surface options, such as font options and extents.
* [script] Wrap snapshot.Chris Wilson2009-08-291-0/+6
| | | | Use the snapshot of our target surface if available.
* Remove clip handling from generic surface layer.Chris Wilson2009-07-231-0/+449
Handling clip as part of the surface state, as opposed to being part of the operation state, is cumbersome and a hindrance to providing true proxy surface support. For example, the clip must be copied from the surface onto the fallback image, but this was forgotten causing undue hassle in each backend. Another example is the contortion the meta surface endures to ensure the clip is correctly recorded. By contrast passing the clip along with the operation is quite simple and enables us to write generic handlers for providing surface wrappers. (And in the future, we should be able to write more esoteric wrappers, e.g. automatic 2x FSAA, trivially.) In brief, instead of the surface automatically applying the clip before calling the backend, the backend can call into a generic helper to apply clipping. For raster surfaces, clip regions are handled automatically as part of the composite interface. For vector surfaces, a clip helper is introduced to replay and callback into an intersect_clip_path() function as necessary. Whilst this is not primarily a performance related change (the change should just move the computation of the clip from the moment it is applied by the user to the moment it is required by the backend), it is important to track any potential regression: ppc: Speedups ======== image-rgba evolution-20090607-0 1026085.22 0.18% -> 672972.07 0.77%: 1.52x speedup ▌ image-rgba evolution-20090618-0 680579.98 0.12% -> 573237.66 0.16%: 1.19x speedup ▎ image-rgba swfdec-fill-rate-4xaa-0 460296.92 0.36% -> 407464.63 0.42%: 1.13x speedup ▏ image-rgba swfdec-fill-rate-2xaa-0 128431.95 0.47% -> 115051.86 0.42%: 1.12x speedup ▏ Slowdowns ========= image-rgba firefox-periodic-table-0 56837.61 0.78% -> 66055.17 3.20%: 1.09x slowdown ▏