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>
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>
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
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>
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>
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
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
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
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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.
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>