Commit graph

7233 commits

Author SHA1 Message Date
Uli Schlachter
25a55822b4 xcb: Fix _put_image_boxes() if no SHM is available
This function tries to use _cairo_xcb_connection_put_image() to do the actual
work. However, that function can only be used for images with "native" stride.
If we only want to upload a rectangle from within an image, the function
_cairo_xcb_connection_put_subimage() has to be used. This function makes sure
that the correct information is sent to the X11 server.

No unit test for this, because we currently do not test the !SHM case
automatically. Perhaps we should?

Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-10-14 14:26:47 +02:00
Uli Schlachter
d31dc73f9b xcb: Fix _put_shm_image_boxes if no SHM available
This function always returned CAIRO_INT_STATUS_SUCCESS, even if it didn't do
anything. This commit makes the function return CAIRO_INT_STATUS_UNSUPPORTED
instead.

No unit test for this, because we currently do not test the !SHM case
automatically. Perhaps we should?

Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-10-14 14:26:32 +02:00
Adrian Johnson
0537479bd1 ps: merge emit_recording surface and emit_recording_subsurface into one function
Most of each function was identical.
2015-10-05 16:10:02 +10:30
Rodrigo Rivas Costa
e5d4f520aa win32-print: fix transparent images have black background
Bug 91835
2015-09-30 23:53:23 +09:30
Adrian Johnson
495362279b scaled-font-subsets: if glyph 0 used for rendering, remap to different index
Some broken pdfs use glyph 0 in embedded fonts for rendering instead of .notdef.
The cmap we use for embedding latin fonts does not allow rendering glyph 0. Ensure
if glyph 0 is used, it is mapped to a non 0 glyph in the subset.

Bug 89082
2015-09-27 09:34:37 +09:30
Bryce Harrington
6f7a9b4f03 Ensure null-terminated result from strncpy() 2015-09-10 11:18:08 -07:00
Adrian Johnson
b353d1f1b1 cff: opentype fonts always use gid to lookup glyph
Bug 91902
2015-09-07 22:20:08 +09:30
Sahil Vij
f6c46d9473 gl: Fix bug in _cairo_gl_pattern_texture_setup()
The memory allocated to "image" at line 298 is not freed before moving to label fail at line 305 and 314.
This patch takes care of this memory leak in above mentioned cases.

Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=91537
Signed-off-by: Sahil Vij <sahil.vij@samsung.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2015-08-07 18:02:07 -07:00
Bryce Harrington
e0963f6c8e gitignore: Ignore .trs (test results) 2015-07-31 17:56:54 -07:00
Bryce Harrington
576bb3ffee If more than one trap is passed in then it's guaranteed that the
returned traps will have their left edge to the left of their right
edge, but if only one trap is passed in then the function always returns
without doing anything.  This results in incorrect rendering of SVG
paths with more than one subpath.

Currently calls to _cairo_bentley_ottmann_tessellate_rectangular_traps
are guarded by traps.has_intersections checks, so this is only a
theoretical bug.  But we'll eliminate the potential of the bug by
making the left side to be left of the right side, similar to what was
done in _cairo_bentley_ottmann_tessellate_boxes (commit 11b6c49c).

Patch authored by Tom Klein for Mozilla.

Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=90984
Ref: https://bugzilla.mozilla.org/show_bug.cgi?id=853889
Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
2015-07-27 18:20:07 -07:00
Bryce Harrington
c7cf0dfd60 Revert "cairo-gl: Fix compiler warning if CAIRO_HAS_*_FUNCTIONS is not defined."
This reverts commit c8b6c6066a.

An undefined macro is evaluated as 0.
The preference is to use #if MACRO_NAME rather than #ifdef.

Conflicts:
	src/cairo-gl.h
2015-07-27 14:15:11 -07:00
Andrea Canciani
66bc7b8cb0 quartz: be more strict about the behavior of blend operators
Some blend operators have a (small, but potentially noticeable)
different behaviour in Quartz and pixman. Use the Quartz ones only for
the operators which match pixman except for rounding errors.

Fixes:
 - extended-blend
 - extended-blend-alpha
 - extended-blend-mask
 - extended-blend-alpha-mask
 - extended-blend-solid
 - extended-blend-solid-alpha
2015-07-27 12:46:00 +02:00
Andrea Canciani
6210e34771 quartz: Align filtering quality with image backend
The Quartz framework provides several quality settings, but they were
not used. Now the translation of cairo_filter_t to Quartz filtering
modes tries to match the quality settings from image as much as
possible.

Specifically, CAIRO_FILTER_GOOD and CAIRO_FILTER_BILINEAR are now
converted to kCGInterpolationLow, which seems to be a bilinear filter.

Fixes:
 - pixman-downscale-bilinear-24
 - pixman-downscale-bilinear-95
 - pixman-downscale-good-24
 - pixman-downscale-good-95
 - pthread-same-source
 - recording-surface-extend-none
 - recording-surface-extend-reflect
 - recording-surface-extend-repeat
 - recording-surface-over
 - recording-surface-source
 - surface-pattern-big-scale-down
 - surface-pattern-scale-down
 - surface-pattern-scale-down-extend-none
 - surface-pattern-scale-down-extend-reflect
 - surface-pattern-scale-down-extend-repeat
2015-07-27 12:46:00 +02:00
Bryce Harrington
6951fb4238 Revert "pattern: allow for a floating one pixel rounded difference."
While this fixed a real bug, in testing this patch was found to fail a
number of tests and thus needs further work.

This reverts commit e7acf4b6dc.
2015-07-17 12:07:18 -07:00
Arpit Jain
edd321c2f5 gl: Fix incorrect size of expression
The sizeof operator now applied to the correct variable "ctx->glyph_cache",
instead of its pointer address, in function "_cairo_gl_composite_flush".

Fixes:  https://bugs.freedesktop.org/show_bug.cgi?id=91321
Signed-off-by: Arpit Jain <jain.arpit@samsung.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2015-07-14 01:44:33 -07:00
Ashim
498fc2fbe3 Fix out of bound access in struct pattern->type
The pattern structure is hardcoded to hold 7 elements, yet the
pattern_names array in cairo-surface-observer.c is initialized with 8
strings.  This causes a crash in print_array at line 1587 when it tries
to access the 8th member.

Hence changed the 'type' array from type[7] to type[8] to avoid out of
bound access.

Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=91266
Signed-off-by: Ashim <ashim.shah@samsung.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2015-07-09 13:50:35 -07:00
Bryce Harrington
ad45e8f99f truetype: Drop redundant check of truetype struct
Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=29010
2015-07-07 18:20:30 -07:00
Chris Wilson
dced42a680 xlib: Avoid using uninitialised variable on impossible error path
In commit f6843d5cbb
Author: Arpit Jain <jain.arpit@samsung.com>
Date:   Mon Jul 6 14:13:06 2015 -0700

    xlib: Fix deferencing of uninitialised 'display'

the common error + clenaup path was clumsily fixed to use the right
variable after the error didn't set the local display variable.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2015-07-06 22:28:20 +01:00
Chris Wilson
84b8d76576 Revert "xlib: Fix deferencing of uninitialised 'display'"
This reverts commit f6843d5cbb.
2015-07-06 22:28:20 +01:00
Arpit Jain
f6843d5cbb xlib: Fix deferencing of uninitialised 'display'
Initialising 'display' to NULL and checking before deferencing during display->base.
This patch will check the deferencing of uninitialised 'display' in case,
_cairo_xlib_display_acquire does not return CAIRO_STATUS_SUCCESS.

Fixes:  https://bugs.freedesktop.org/show_bug.cgi?id=87893
Signed-off-by: Arpit Jain <jain.arpit@samsung.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2015-07-06 14:13:24 -07:00
Bryce Harrington
06a2696d5f cairo-gl: Still check the value of the macros
Just because they're defined doesn't mean they've been enabled.
2015-07-06 14:11:57 -07:00
Koop Mast
c8b6c6066a cairo-gl: Fix compiler warning if CAIRO_HAS_*_FUNCTIONS is not defined.
Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=88050

[Updated to also still check the value of the macros]

Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
2015-06-27 01:14:22 -07:00
Bryce Harrington
bf4f5f3a90 cairo-script: Return a cairo_status_t error, not FALSE
This typo results in certain paths being incorrectly recorded with
script surfaces.

Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=91054
Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
2015-06-26 16:30:06 -07:00
John Lindgren
bb24f165ff Avoid indiscriminate use of VALGRIND_MAKE_MEM_NOACCESS.
Marking stack-allocated objects as no-access creates false positives,
which distract from finding real memory errors.

Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=52548

Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2015-06-26 16:12:33 -07:00
Bryce Harrington
1bcce43629 cairo-recording-surface: Fix loss of alpha when clipping
Commit 8020e0bc introduced a regression due to a typo when copying a
mask for a cairo recording surface.  It should copy the source and mask
members from the command source to the recording surface, but instead it
copies the source twice.

Fix suggested by Massimo.

Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=73038
Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=73901
2015-06-25 18:54:23 -07:00
Bryce Harrington
c1c3028a0c cairo-script: Fix sp. "directoriy"
Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
2015-06-25 17:42:27 -07:00
Uli Schlachter
f82ae573fe XCB: Don't attach uploaded surfaces as snapshots
When you draw (part of) a surface to an XCB surface, the XCB backend will safe
the uploaded part as a snapshot to the input surface. This allows to re-use this
picture in case the same surface is later used again as a source.

However, other backends do not do this and this has caused and/or highlighted
numerous bugs. Just skipping the snapshot fixes or hides these bugs.

Papers-over: https://bugs.freedesktop.org/show_bug.cgi?id=67505
Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-06-20 10:59:52 +02:00
Alban Browaeys
e7acf4b6dc pattern: allow for a floating one pixel rounded difference.
That is if the difference between the origin and the end is bigger than
.5 round up regardless of the coordinates.

Round the difference of the floats instead of rounding the floats then
diff them.

Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=84396

Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2015-06-18 16:07:40 -07:00
Fredrik Fornwall
11b6c49c10 Fix cairo_get_locale_decimal_point() on Android 2015-06-05 20:53:11 -07:00
Massimo Valentini
1ed318ce13 polygon-intersection: Delete misleading comments and dead-code
den_det is positive because intersect_lines is called
only after _slope_compare returned > 0 and slope_compare
is returning the sign of den_det

The quadratic-time intersection finder is #if 0-ed out
in src/cairo-bentley-ottman.c, but is unusable even there
since the second commit to that file.

Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=74779
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2015-06-04 15:02:01 -07:00
Massimo Valentini
63f59ea896 polygon-intersection: Try not to invoke undefined behaviour
Optimizing compilers aggressively remove code that is executed only
after an undefined behaviour occurred.

Also, the difference of two (non char) pointers hides an integer
division that, because the divisor is known at compile time, is
transformed into a multiplication by a pseudo-reciprocal, and in this
case the difference is not always a multiple of the divisor, resulting
in an invalid comparison predicate.

Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=74779
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2015-06-04 15:01:57 -07:00
Massimo Valentini
a3c022bb98 polygon-intersection: Include approximation in intersection points
In Hobby's paper it is proved that INTERSECTION events can be
processed in any order by ignoring intersections between edges
non-adjacent in the active edges list.
But with respect to START/STOP events they must be processed in
order. Because START/STOP events have always exact y, it is
sufficient to know whether an integer y intersection is a
default/excess approximation of the exact to properly sort events.

Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=74779
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2015-06-04 15:01:35 -07:00
Massimo Valentini
9f2bbfa41f polygon-intersection: Do not discard intersection exactly at top edge
Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=74779
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2015-06-04 15:00:58 -07:00
Nathan Froyd
5d150ee111 Support new-style __atomic_* primitives
Recent versions of GCC/clang feature a new set of compiler intrinsics
for performing atomic operations, motivated by the operations needed to
support the C++11 memory model.  These intrinsics are more flexible than
the old __sync_* intrinstics and offer efficient support for atomic load
and store operations.

Having the load appear atomic to the compiler is particular important
for tools like ThreadSanitizer so they don't report false positives on
memory operations that we intend to be atomic.

Patch from Nathan Froyd <froydnj@mozilla.com>
2015-06-04 13:25:23 -07:00
Adrian Johnson
d1dda5eeb2 cff: ensure glyph widths are positive when font matrix yy is negative
Bug 90538
2015-05-21 22:40:01 +09:30
Zan Dobersek
f52f0e2feb Manually transpose the matrix in _cairo_gl_shader_bind_matrix()
To maintain compatibility with OpenGL ES 2.0, the matrix in
_cairo_gl_shader_bind_matrix() should be manually transposed,
and GL_FALSE passed as the transpose argument to the
glUniformMatrix3fv() call as it is the only valid value for
that parameter in OpenGL ES 2.0.

Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
Acked-by: "Henry (Yu) Song" <henry.song@samsung.com>
2015-05-18 15:03:29 -07:00
Bryce Harrington
8b798c320f Fix broken canvas text font size in Inkscape
An earlier fix to bug 84324 added a regression in the font size of
canvas text in Inkscape when compiled with the Quartz backend.

Patch from Andrea Canciani

Fixes:  https://bugs.freedesktop.org/show_bug.cgi?id=84324
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2015-04-24 18:23:46 -07:00
Behdad Esfahbod
d5ffe67008 Remove debug printf; ouch! 2015-04-23 14:26:14 -07:00
Behdad Esfahbod
853e822c9c Oops, fixup previous commit 2015-04-21 14:31:53 -07:00
Behdad Esfahbod
bb01fd8794 [ft] Return CAIRO_STATUS_FILE_NOT_FOUND if font file can't be opened
A common source of error when people are setting up pango on a new
device is when font files don't have the right permissions and cannot
be opened.  Cairo was returning out-of-memory before, making the
Pango error message useless.

With this change, cairo will return file-not-found, and pango prints
that out.  It's still not ideal; a ENOACCESS equivalent would have
been better.
2015-04-21 14:29:41 -07:00
江頭幸路
040ae0ce19 Avoid appending an empty slot to an user data array when user_data is NULL.
Otherwise, calling cairo_set_user_data(cr, key, 0, 0) many times
causes a long user data array, almost all of whose slots are empty.
It leads to unnecessarily much memory consumption and long execution time of
cairo_set_user_data(cr, key, 0, 0) and cairo_get_user_data(cr, key) after
it.

This issue probably happens since the commit
http://cgit.freedesktop.org/cairo/commit/?id=9341c254a

Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2015-04-20 17:16:18 -07:00
Руслан Ижбулатов
16898ba11b win32: Add cairo API to set up a Win32 surface for an HDC with an alpha channel.
Signed-off-by: Руслан Ижбулатов <lrn1986@gmail.com>
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2015-04-13 17:43:28 -07:00
Bryce Harrington
2cf2d8e340 Fix spellings descibed, indicies, stange 2015-04-04 15:49:18 -07:00
Bryce Harrington
904f1fdc1d surface: Clarify flush documentation 2015-03-18 15:49:41 -07:00
Bryce Harrington
3a7d411539 Revert "xlib: Remove queued event from _XReadEvents"
This reverts commit e7fc8f405b.
2015-03-06 23:35:34 -08:00
Bryce Harrington
246d5c1d47 doc: Drop extraneous para's
These may have been required in the past, but just trip up distcheck
today.  The generated docs still look fine.
2015-03-06 19:19:13 -08:00
Henry (Yu) Song
e7fc8f405b xlib: Remove queued event from _XReadEvents
Following patch fixes a memory leak in xlib surface.

Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2015-03-05 17:27:14 -08:00
Michael Haubenwallner
4e680ff4bb headers: fix include order for AIX, bug#89354
also for cairo-xcb-private.h
2015-03-05 17:03:32 -08:00
Michael Haubenwallner
733de40e87 headers: fix include order for AIX, bug#89354 2015-03-05 17:03:28 -08:00
Michael Haubenwallner
ac75ab9f30 fix conflicting types for 'sync' on AIX, bug#89338 2015-03-05 12:00:48 -08:00