Commit graph

8794 commits

Author SHA1 Message Date
M Joonas Pihlaja
df4b23ff74 subsurface: Fix crash when acquiring a source image.
The code is passing in the extra info received from
the target surface's acquire_source() method to
_cairo_surface_get_extents() rather than the acquired
source surface itself.
2010-08-27 20:26:06 +03:00
Andrea Canciani
2d146867dc subsurface: Correct cloning condition
72644c6df2 was using the wrong (inverted)
condition to check if the subsurface extents are contained in the
target extents.
2010-08-26 14:50:34 +02:00
Andrea Canciani
72644c6df2 subsurface: Avoid invalid accesses
Whenever subsurface extents are not contained in the target extents,
using the source image given by the target (with origin corrected by
using an appropriate offset in the data pointer) is not a valid
operation. Fallback to cloning in that case.
2010-08-26 14:38:34 +02:00
Andrea Canciani
df4465bdd1 subsurface: Silence compiler warnings
Commit d1c35f5e65 introduced two
unused variable warnings.
2010-08-26 14:23:04 +02:00
Benjamin Otte
d1c35f5e65 subsurface: Don't clip size to target size
This clipping would modify the origin of the subsurface and then the
creator has no easy way to figure this out.
2010-08-26 13:55:02 +02:00
Benjamin Otte
174fb5f16f subsurface: Don't apply device transform twice for source/mask 2010-08-26 13:21:04 +02:00
Benjamin Otte
e79acf47a5 subsurface: Make CAIRO_SURFACE_TYPE_SUBSURFACE public 2010-08-26 12:55:39 +02:00
Benjamin Otte
40459dacb5 subsurface: Don't crash when the device transform isn't integer
Apply the transform before rounding to integer coordinates, so we can
handle doubles easily.
2010-08-26 11:45:28 +02:00
Benjamin Otte
e19b213e84 subsurface: Make subsurfaces their own type
Do not try to hide being a subsurface.
This would cause confusion when users where calling surface-type
specific getters on subsurfaces.

FIXME: We still need public API to access a subsurface's target though.
2010-08-26 11:20:36 +02:00
Benjamin Otte
e65bf64c4a subsurface: Properly account for device offsets in the target 2010-08-26 11:20:36 +02:00
Chris Wilson
8e9c4ea589 Mark the context as invalid on the final cairo_destroy()
We initialise the context to a non-error state upon creation, but after
destroy there is a window of opportunity where the object is kept alive
inside the context pool and the user could mistakenly keep on passing
the zombie context into cairo functions. As all entry points need to
check error status, flagging the context as an error object upon the
final unreference prevents such misuse (until such as time as the
context is reallocated).
2010-08-11 12:18:53 +01:00
Andrea Canciani
cd52378ae6 test: Update linear-gradient-large ref image
Make linear-gradient-large ref image match xlib gradients (both on nvidia
and on macosx) and pixman gradients (when patched to compute the linear
gradients using floating point math).
2010-08-10 19:42:14 +02:00
Krzysztof Kosiński
a7762e3d65 tests: Add linear-gradient-large test
Shows large rounding errors in Pixman when computing gradients. Added as
a test to Cairo to catch similar issues in other backends.

https://bugs.freedesktop.org/show_bug.cgi?id=29470
2010-08-10 18:38:59 +02:00
Andrea Canciani
56ea51fdcc Replace insertion sort with mergesort in the scan converter
Insertion sort can take up to O(n^2), mergesort is guaranteed to run
in O(n*log(n)).
An example showing bad performance for insertion sort is:
   https://bugs.freedesktop.org/show_bug.cgi?id=28067

The mergesort has been engineered to be fast even when working on
cases where the insertion sort would have performed well and as
expected it shows no changes in the benchmark cairo traces.
2010-08-10 14:39:54 +02:00
Nicolaus L Hepler
a150371a5d ft-font: Make alpha mapping consistent
Vertical RGB mapping previously forced opaque pixels.
To be consistent with horizontal RGB/BGR and vertical BGR it
should use an alpha equal to the mid channel (green).
2010-08-10 09:40:46 +02:00
David Schleef
73470862cb perf: Fix README to say cairo-perf-micro 2010-08-10 02:37:38 +02:00
Benjamin Otte
df8f964234 build: Fudge the build system some more so it handles extra libs
Add NONPKGCONFIG_EXTRA_LIBS that are only put into the generated pc file
but not used when linking. This is now used to add -lcairo-gobject to
the cairo-gobject.pc file.
2010-08-10 01:24:30 +02:00
Benjamin Otte
01325ad767 gobject: Include the extra library in the pkgconfig file 2010-08-10 00:11:59 +02:00
M Joonas Pihlaja
8fb91dc3f6 script: Fix script backend build.
The flight data recorders were missing an include
of cairo-tee.h ever since cairo-tee.h became an optional
backend.
2010-08-10 00:53:53 +03:00
Andrea Canciani
7668323649 perf: Improve calibration
Make the loops count depend on the actual calibration_loops/calibration_time
instead of calibration_loops/calibration_max_time.
This avoids having some tests take much less/more than the wanted time per iteration
(I was having some tests taking about 1 second, other taking about 7 seconds when
the ms_per_iteration was 2000)

Spend 0.5-1 times the time wanted for each iteration in calibration, increase the
accuracy of loops count. Just making the loops count be the correct ratio doesn't
guarantee that the iteration time is accurate. By actually measuring iteration
times until it gets greater than 1/4 of the wanted time, the total sum is bound
to be <= the wanted iteration time and last calibration time is between 1/4 and
1/2 of the wanted time, so it should give a very accurate loop count.
2010-08-09 19:19:04 +02:00
Rich Walsh
046b642db0 os2: Restore surface type checking in the get_extents method. 2010-08-08 22:33:43 +03:00
Rich Walsh
78bdd87b75 os2: Fix clipping to bounds when blitting pixels.
The bounds checks on the rectangle to blit were done
after converting target/source to inclusive/noninclusive
coordinates rather than before, potentially causing an
off-by-one in the sizes, since the same logic was applied
to both inclusive and non-inclusive coordinates.  This
patch enforces bounds up front.

Thread "OS/2 surface fixes" on cairo-l:
http://lists.cairographics.org/archives/cairo/2010-July/020343.html
2010-08-08 22:29:40 +03:00
Rich Walsh
d0284687b3 os2: Tweak an inline declaration.
C99 and cairo prefers "static inline <return type>" rather
than "static <return type> inline".

Thread "OS/2 surface fixes" on cairo-l:
http://lists.cairographics.org/archives/cairo/2010-July/020343.html
2010-08-08 22:29:40 +03:00
Rich Walsh
cb30340064 os2: Consolidate error paths of cairo_os2_surface_create().
Use a single code path to release the resources acquired
for a surface that's been partially constructed, rather than
have multiple error exits which each release the resources
acquired so far.

Thread "OS/2 surface fixes" on cairo-l:
http://lists.cairographics.org/archives/cairo/2010-July/020343.html
2010-08-08 22:29:40 +03:00
Rich Walsh
66e3d650fe os2: Document ownership of OS/2 objects passed to surfaces.
Clarify the documentation for cairo_os2_surface_create()
and cairo_os2_surface_set_hwnd() to note that the ownership
of the presentation space and window respectively
remains with the caller.

Thread "OS/2 surface fixes" on cairo-l:
http://lists.cairographics.org/archives/cairo/2010-July/020343.html
2010-08-08 22:29:40 +03:00
Rich Walsh
0152527154 os2: Don't fake an Anchor Block when one isn't needed.
The code was being tricky about passing in a HAB to
DevOpenDC() even though one isn't needed at all under
OS/2.  Pass in NULL instead.

Thread "OS/2 surface fixes" on cairo-l:
http://lists.cairographics.org/archives/cairo/2010-July/020343.html
2010-08-08 22:29:40 +03:00
Rich Walsh
883d9725e0 os2: Fix buffer allocator behaviour on arithmetic overflow.
On arithmetic overflow the buffer allocator would attempt
to allocate zero bytes instead of failing the allocation.
Depending on the implementation of the underlying allocator
being proxied, this may result in an allocation of a zero
length buffer, causing all kinds of grief.  This patch
causes arithmetic overflows to explicitly fail the allocation.

Thread "OS/2 surface fixes" on cairo-l:
http://lists.cairographics.org/archives/cairo/2010-July/020343.html
2010-08-08 22:29:40 +03:00
Rich Walsh
b54037828c os2: Fix blitting 24 bpp pixel data.
There's a format mismatch between cairo's pixel formats
and OS/2 24 bpp data: the individual pixels in OS/2 take
only three bytes per pixel, but there needs to be padding
between lines to make the start of a line always be aligned
at a DWORD boundary.

This patch fixes the format conversion code to include
the required padding between rows.

Thread "OS/2 surface fixes" on cairo-l:
http://lists.cairographics.org/archives/cairo/2010-July/020343.html
2010-08-08 22:29:39 +03:00
Rich Walsh
5aadecb3ac os2: New API to create surfaces without a persistent HPS.
It's not always necessary to create a presentation space (HPS) for
surface tied to a window, as the user may have one already.  This patch
introduces three new functions to create a surface without an HPS
and let the user manage an HPS associated with the surface.

Thread "OS/2 surface fixes" on cairo-l:
http://lists.cairographics.org/archives/cairo/2010-July/020343.html

Mozilla Bugzilla:
https://bugzilla.mozilla.org/show_bug.cgi?id=557159
2010-08-08 22:29:39 +03:00
Benjamin Otte
9669faa936 gl: Handle errors from _cairo_gl_gradient_render()
Thanks Andrea for finding this.
2010-08-08 17:23:05 +02:00
Benjamin Otte
e31b56e020 configure: Fix gobject handling
1) Explicitly depend on glib, too.
2) Don't link gobject into libcairo proper (thanks Joonas for noticing).
2010-08-08 16:09:13 +02:00
Andrea Canciani
ae2b7b13cd pattern: Simplify degenerate linear pattern to solid colors
Degenerate linear patterns are considered clear if they have
EXTEND_NONE, the average of the first and the last stop if they are
EXTEND_PAD, the weighted average of the stops (based on the size of
the interpolation range in which they are active, just like integrating
over the whole interpolation range and taking the average) if they are
EXTEND_REPEAT or EXTEND_REFLECT.

Fixes degenerate-linear-gradient
2010-08-08 12:07:08 +02:00
Andrea Canciani
d54a5a9fc9 pattern: Add gradient degeneracy testing functions
Introduce two new (private) functions for testing the degeneracy of linear
and radial gradients and use them instead of verbose (and error-prone) tests.
2010-08-08 10:53:51 +02:00
Andrea Canciani
63434bc438 gstate: Correct comment 2010-08-08 10:53:51 +02:00
Andrea Canciani
28cd511fb9 Correct color stops comparison function
Two clear stops with different "underlying" colors must be considered
different, since when interpolated with non-clear colors they will
produce different results.
2010-08-08 10:53:44 +02:00
Andrea Canciani
f71a618bd2 Fix configuration if gobject is absent
Autodetect gobject and only use it if present.
Its absence is not to be considered a failure since it's not required.
2010-08-07 21:32:09 +02:00
Benjamin Otte
661f4859cd Add cairo-gobject library
This library is supposed to contain GType declarations for Cairo types.
It is also meant to support gobject-introspection binding creation.
2010-08-07 20:19:27 +02:00
Søren Sandmann Pedersen
fc4e8f0363 Update documentation to reflect that rgb565 is no longer deprecated. 2010-08-07 12:10:49 -04:00
Andrea Canciani
de606af5d6 quartz: improve backend detection
Quartz previously crashed with NULL backends and didn't check for
the backend type when getting a CGContext from a quartz surface,
returning meaningless data for subsurfaces.
2010-08-07 12:37:22 +02:00
Andrea Canciani
056ce165c4 quartz: fix solid masking fallback
Falling back when painting would ignore the alpha value (which is
needed to have the correct mask opacity).
_cairo_quartz_surface_paint_cg doesn't fallback, so the usual mask
fallback path is now taken, as expected.
2010-08-07 12:21:06 +02:00
Andrea Canciani
bdeade14ea quartz: fix stroking with unbounded operators
Self-intersecting strokes were drawn incorrectly when an unbounded
operator was used, since the fixup operation also cleared the
intersection.

Fixes clip-stroke-unbounded.
2010-08-06 20:24:52 +02:00
Andrea Canciani
8f38d2aa29 test: improve clip-*-unbounded tests
Merge clip-*-unbounded tests and add self-intersections to the paths
that are drawn. This exposes a bug in the unbounded fixup code in quartz.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-08-06 19:36:37 +02:00
Benjamin Otte
142df6f963 configure: Disable xml backend by default
We don't want to enable it by default when nobody uses it.
2010-07-30 22:27:28 +02:00
Benjamin Otte
9f33f8453b configure: Disable tee backend by default
We don't want to enable it by default when nobody uses it.
2010-07-30 22:27:27 +02:00
Benjamin Otte
9f4d677e2a tee: Move definitions into separate header 2010-07-30 22:27:08 +02:00
Kristian Høgsberg
14639e6b85 egl: Use EGL_KHR_surfaceless_opengl extension when available
This lets us avoid creating a throwaway pbuffer just to make the
context current.
2010-07-28 23:17:42 -04:00
Chris Wilson
b6fd673d37 version: 1.9.15 post-snapshot bump 2010-07-26 13:15:38 +01:00
Chris Wilson
ed8c6f4254 version: 1.9.14 snapshot 2010-07-26 12:53:44 +01:00
Chris Wilson
81094cf462 NEWS: 1.9.14 2010-07-26 12:52:56 +01:00
Andrea Canciani
c1fcbd0322 quartz: fix REFLECT radial gradients
The interpolation range of repeating radial gradients can safely be
reflected around any integer (previously 0), but for reflect-extended
radial gradients can only be reflected around odd integers if the
appearance is to be the same, thus reflecting around 1 is correct for both.

Fixes radial-gradient.
2010-07-26 11:39:27 +02:00