Commit graph

8203 commits

Author SHA1 Message Date
Chris Wilson
b972669c9a boilerplate: Fix use after free from 3ae5723
If we want to access the surface during the cleanup, we must hold our
own reference to it. Make it so for the forced finish of the recording
surface.
2010-04-30 12:39:59 +01:00
Chris Wilson
905c345df1 recording: Check that we do not use a finished recording surface.
User paranoia - as the replay is exposed to the user it is convenient to
add the finish check in the core replay function so that we gain a
paranoia check for the internal paths as well.
2010-04-30 10:31:50 +01:00
Chris Wilson
5fe7c5842f pdf; Emit subsurface patterns natively.
Encode subsurface patterns into the PDF stream natively (when possible),
similar to the cairo-ps backend.
2010-04-30 10:16:24 +01:00
Chris Wilson
8ded35fd69 ps: Enable native encoding of subsurface patterns.
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.
2010-04-30 10:16:24 +01:00
Chris Wilson
5fc04bba9f paginated: Call surface finish explicitly on recording surface
During show_page() when we destroy the recording surface after emitting
the page, ensure that we actually call cairo_surface_finish() to dispose
of any self-referential reference leaks.
2010-04-30 10:16:23 +01:00
Chris Wilson
3ae5723464 boilerplate: Ensure that the recording surfaces are finished.
Be paranoid and explicitly call finish to cleanup self-referential leaks
when using paginated/recording surfaces.
2010-04-30 10:16:23 +01:00
Chris Wilson
f08cc311af boilerplate: Destroy the redundant image reference
When using a script surface to record the recording surface, we replace
the local reference to the image surface.
2010-04-30 10:16:23 +01:00
Chris Wilson
ab2776c9a1 snapshot: Attach the backend generated snapshot to the target
Cache the result of snapshotting using the backend vfunc in the normal
manner by attaching the snapshot to the target. This should reduce
resource usage in these cases.
2010-04-30 10:16:23 +01:00
Chris Wilson
07122f37d1 surface: Convert snapshots from an array to a double-linked list.
Saves the memory allocation for the array, and the overhead of
maintaining the area for both insertions and more importantly deletes.
2010-04-30 10:16:23 +01:00
Chris Wilson
4cb733c285 image: Simplify translation of pattern matrix for composite_trapezoids() 2010-04-30 10:16:23 +01:00
Chris Wilson
3940b0e91c subsurface: s/region/rectangle/
After a renewed discussion, it was pointed out that the API in Cairo was
not restrictive and by using doubles we would be consisted with the rest
of the API. Thus prompting the name change to

  cairo_surface_create_for_rectangle()

similar to cairo_rectangle().

And document the public API.
2010-04-30 10:16:06 +01:00
Chris Wilson
4b6fa8d5a7 test: Remove group-unaligned.*new.png
Entirely misleading, looks like PDF is behaving the same as image and
this remnant was thus giving the wrong impression.
2010-04-30 09:47:51 +01:00
Benjamin Otte
e3f990d841 test: Update reference images for last checkin
Both tests now pas on all backends I tested: test, image, xlib and
recording
2010-04-29 22:35:38 +02:00
Benjamin Otte
6d36f06751 image: Round down when rendering antialiased boxes
Matches Pixman's output when going via pixman_rasterize_trapezoid()
2010-04-29 22:34:28 +02:00
Benjamin Otte
95179a5de9 Remove excessive semicolons
s/;;/;/ basically
2010-04-29 20:45:23 +02:00
Benjamin Otte
5d07307b69 xlib: Don't modify variables that are needed later
In the XCopyArea region code, don't modify src_x/y when they are later
used in the unbounded fixup code.

Exposed by composite-integer-translate-source test.
2010-04-29 18:20:59 +02:00
Benjamin Otte
90160deb2a xlib: Constify some function arguments 2010-04-29 18:20:44 +02:00
Benjamin Otte
4da71d1a01 xlib: remove unused code 2010-04-29 18:11:54 +02:00
Benjamin Otte
758ffadcb1 fallback: Only do _fill/compsoite_rectangles on bounded source
For unbounded sources, these optimizations fail to take into account the
regions outside the source.
2010-04-29 16:54:09 +02:00
Benjamin Otte
6288ad719d fallback: translate extents regions properly
The extents clip regions that were created for unbounded operators were
not translated properly. This has been changed now.

This is a followup to 9ce8bef9d6.
2010-04-29 15:38:25 +02:00
Benjamin Otte
b0760826f3 test: Set have_result for image matches
Causes the log to contain information about the reference imagery used.
2010-04-29 12:12:51 +02:00
Benjamin Otte
8f85c2d77c image: translate source pattern in composite_trapezoids()
Fixes xlib fallback paths as exposed by the clip-push-group test.
2010-04-29 12:12:51 +02:00
Chris Wilson
aa495eac5a atomic: Tweak for compilation x86.
Missing definition of _cairo_atomic_ptr_get() used in the fallbacks.
2010-04-29 10:04:54 +01:00
Andrea Canciani
248af38b3e atomic: Add MacOSX atomic implementation
Enable atomic operation on MacOS X, using the functions provided by
libkern/OSAtomic.h

Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-04-29 10:52:48 +02:00
Andrea Canciani
56a367a162 atomic: Correct implementation of _atomic_fetch ()
_atomic_fetch() was expected to replace the content of a slot with
NULL and return the old content, but it incorrectly returned the
previous content even if it was unable to perform the exchange
(because of conflicts with other threads accessing the pool).

Fix suggested by Chris Wilson <chris@chris-wilson.co.uk>
2010-04-29 10:52:48 +02:00
Andrea Canciani
d66b1ca1cf atomic: Separate bool and old-value compare-and-exchange
Some implementations only offer one version of compare-and-exchange,
thus we expose both through cairo-atomic, implementing what is missing
through appropriate fallbacks.
*_cmpxchg() now return a boolean (this unbreaks _cairo_atomic_uint_cmpxchg)
*_cmpxchg_return_old() return the old value
Code is updated everywhere to reflect this, by using *_cmpxchg()
wherever the returned value was only tested to check if the exchange
had really taken place.

Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-04-29 10:52:47 +02:00
Andrea Canciani
a0bf424b82 atomic: Remove unused function _cairo_atomic_int_set()
_cairo_atomic_int_set() was only used in the definition of
CAIRO_REFERENCE_SET_VALUE, which was never used.

Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-04-29 10:52:47 +02:00
Benjamin Otte
9ce8bef9d6 fallback: Propagate extents properly
Otherwise unbounded operators will clear the full surface.
Improves the score for the unbounded-operator test, in particular the
output for the test-fallback case.
2010-04-28 20:25:56 +02:00
Benjamin Otte
91fd97ae7c fallback: Pass the correct extents for unbounbded operations 2010-04-28 20:25:52 +02:00
Benjamin Otte
06e9caf861 image: pixman_image_fill_rectangles() => pixman_image_fill_boxes() 2010-04-28 20:14:55 +02:00
Benjamin Otte
bc49df3227 pixman_image_composite => pixman_image_composite32
Fix up the remaining callers
2010-04-28 20:14:55 +02:00
Benjamin Otte
393da364a7 fallback: Sanitize code that queries surface extents
The previous code was setting extents.is_bounded, but that value has a
completely different meaning.
2010-04-28 18:18:15 +02:00
Benjamin Otte
1391403956 test: run xlib-expose-event test unconditionally 2010-04-28 13:15:09 +02:00
Benjamin Otte
2ce1afa322 test-suite: add image_diff_is_failure() function
This cleans the code and fixes a boolean logic error where this check
was done manually.
2010-04-28 13:15:09 +02:00
Benjamin Otte
2a91d42508 fallback: Fix clip_region handling in mask creation
Fixes the xlib-expose-event test.
2010-04-28 13:15:09 +02:00
Chris Wilson
bb853916f3 image: Generate clear/white/black images when !HAS_ATOMIC_OPS
Andrea reported that b74cc0f broke compilation without atomic ops.
2010-04-28 11:37:59 +01:00
Chris Wilson
45d4c6e0b2 script: Replace the missing " " after pop
I accidentally deleted the whitespace after popping the recording
surface, thus causing the scripts to be broken.
2010-04-28 10:01:06 +01:00
Chris Wilson
6a99e83c50 subsurface: Mark the image as !clear after copying. 2010-04-28 09:55:20 +01:00
Chris Wilson
ca3df75e8f script: Reconstruct subsurfaces. 2010-04-28 09:54:56 +01:00
Chris Wilson
0f0d349a40 trace: Wrap cairo_surface_create_for_region() 2010-04-28 09:54:37 +01:00
Chris Wilson
80fc2a8e49 test: Expand xlib-expose-event to cover all backends
Use a similar surface to create an equivalent backing surface for
any backend, thus enabling the test to run against any target.

The comment about forcing fallbacks has long since been false.
2010-04-28 09:50:49 +01:00
Chris Wilson
d3c4349730 test: Mark surfaces as finished if the data goes out of scope.
The issue being that as the on-stack data is being referenced via a
zero-copy snapshot outside of the functions scope as the surface is only
finished and the source written long after the draw() returns. The
correct procedure is that the user must call cairo_surface_finish()
prior to any surface becoming inaccessible. In this case, this triggers
the snapshot to preserve a copy of the data whilst it is still valid.
2010-04-28 08:39:21 +01:00
Chris Wilson
a5f54e48e3 snapshot: The snapshot masquerades as the target surface type.
Not wholly convinced this is a good idea, but it matches the behaviour
of the other internal surface types.
2010-04-28 08:39:21 +01:00
Chris Wilson
4a678afdf7 snapshot: Simply memcpy if the cloned image matches the original. 2010-04-28 08:39:21 +01:00
Chris Wilson
b74cc0f6d5 image: Convert 1x1 samples into solid colors.
If the sampled extents of the operation on an image surface is just a
single pixel, we can safely convert to a solid color.
2010-04-28 08:39:21 +01:00
Chris Wilson
f5cf131a9d surface: skip OVER is the source is clear.
If the source has no alpha, the OVER operation becomes DST, i.e. a
no-op.
2010-04-27 18:56:23 +01:00
Chris Wilson
453b1cba11 test: Update image ref images, and used fonts in README 2010-04-27 16:47:31 +01:00
Chris Wilson
70656bba81 test: Add image16 refs 2010-04-27 14:19:22 +01:00
Andrea Canciani
ebe6f2ac69 quartz: Assert success of path creation
Path creation can only fail because of the callbacks, but in quartz
they all return CAIRO_STATUS_SUCCESS. Therefore we can just assert
that path creation was successful and simplify calling functions
(as they don't have to handle potential errors anymore).
2010-04-27 12:24:43 +02:00
Andrea Canciani
f67b600927 quartz: Simplify path creation
If paths are created before changing the ctm (when stroking) no
multiplication is needed in the path construction code.
2010-04-27 12:24:43 +02:00