Commit graph

5424 commits

Author SHA1 Message Date
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
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
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
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
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
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
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
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
Chris Wilson
3898e46d1d image: Compensate mask origins for glyph clipping
Fixes the regression in bitmap-font and large-font pointed out by Andrea
Canciani since ef067933.
2010-07-23 09:44:00 +01:00
Karl Tomlinson
108b1c7825 clip: consider gstate target extents in _cairo_gstate_copy_clip_rectangle_list
Fixes https://bugs.freedesktop.org/show_bug.cgi?id=29125

To be consistent with _cairo_gstate_clip_extents, the context's clip
should be intersected with the target surface extents (instead of only
using them when there is no clip).

Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-07-17 11:32:02 +01:00
Karl Tomlinson
b79ea8a6ca clip: consider all_clipped in _cairo_clip_get_extents
If the gstate clip in _cairo_gstate_int_clip_extents() has all_clipped
set (and path NULL), then it returns the gstate target extents instead of
an empty rectangle.  If the target is infinite, then it says the clip is
unbounded.

Fixes https://bugs.freedesktop.org/show_bug.cgi?id=29124
Tested-by test/get-clip

Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-07-17 11:30:51 +01:00
Karl Tomlinson
f2fa15680e clip: return empty clip from _cairo_clip_copy_rectangle_list when all_clipped
Fixes https://bugs.freedesktop.org/show_bug.cgi?id=29122
Tested by test/get-clip

Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-07-17 11:29:54 +01:00
Benjamin Otte
51b0c21f02 build: Add explicit dependcy to cxx lib
Otherwise the build will fail because it doesn't add the dependency
manually.

https://bugs.freedesktop.org/show_bug.cgi?id=29114
2010-07-16 19:49:53 +02:00
Oleg Romashin
6b92d5a0f9 qt: Use native glyph rendering.
Remove the hack of using the xlib surface to do glyph rendering and use
the new interface introduced with Qt4.7, or else fallback to image
rendering with freetype.

Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
[2 files changed, 35 insertions(+), 140 deletions(-) \o/]
2010-07-16 09:49:42 +01:00
Chris Wilson
f53f072a22 clip: Do the NULL check before the dereference.
Breakage introduced in the commit earlier today.
2010-07-12 18:53:29 +01:00
Chris Wilson
ef0679333d image: Manually clip against bounds when rendering directly
This is path is slightly peculiar in that it explicitly avoid the
intermediate mask and the geometry is not pre-clipped.

This in conjunction with the previous commit fixes:

  Clip doesn't work for text
  https://bugs.freedesktop.org/show_bug.cgi?id=29008

which is captured in test/partial-clip-text.
2010-07-12 16:33:42 +01:00
Chris Wilson
679e5a600b Differentiate between reducing clip to composite extents and a rectangle
This is required for handling glyphs when rendering directly to the
surface.
2010-07-12 16:33:38 +01:00
Chris Wilson
459b8ae660 Make distcheck happy. 2010-07-12 11:05:57 +01:00
M Joonas Pihlaja
0152db263b build: Sync up autogenerated win32 build files. 2010-07-12 10:39:18 +03:00
Eric Anholt
06ffb7df71 gl: Only use a mat3 for the transformation for gradients coordinates.
No point in passing in a column of zeroes that we multiply by zero, or
the row that we drop on the floor.  We could do even better by just
passing in a 3x2, at the expense of adding a language version
dependency (or just pass in 2 vectors).

No significant performance difference.
2010-07-11 21:56:55 -07:00
Benjamin Otte
dd6026b613 doc: Make the necessity of flush/mark_dirty more obvious 2010-07-11 23:32:12 +02:00