Commit graph

31 commits

Author SHA1 Message Date
suzuki toshiya
10760d29d1 xml: fix unclosed <scaled-font> element
a closing tag </scaled-font> has been missing,
mistakenly an opening tag <scaled-font> has been emitted.

See discussion in:
https://lists.cairographics.org/archives/cairo/2018-December/028822.html
https://lists.cairographics.org/archives/cairo/2019-January/028828.html
2019-04-08 03:06:06 +00:00
Adrian Johnson
1998239387 Use _cairo_malloc instead of malloc
_cairo_malloc(0) always returns NULL, but has not been used
consistently.  This patch replaces many calls to malloc() with
_cairo_malloc().

Fixes:  fdo# 101547
CVE: CVE-2017-9814 Heap buffer overflow at cairo-truetype-subset.c:1299
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2018-05-07 16:35:51 -07:00
Bryce Harrington
a8571a3030 xml: Typo in comment 2018-02-06 12:06:48 -08:00
Adrian Johnson
aa1323f04c Fix some surfaces missed in b1192bea 2015-10-17 22:02:11 +10:30
Bryce Harrington
19f412bb1f xml: constify source objects for emit routines
This quells the following warnings:

  src/cairo-xml-surface.c:576:5: warning: passing argument 2 of
  ‘_cairo_xml_surface_emit_clip_boxes’ discards ‘const’ qualifier from
  pointer target type
  src/cairo-xml-surface.c:462:1: note: expected ‘struct cairo_clip_t
  *’ but argument is of type ‘const struct cairo_clip_t *’

Most of the cairo_xml*emit* routines const their source objects;
these should follow suit.

Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-02-25 12:13:56 -08:00
Bryce Harrington
dc8ca191f5 xml: Drop unused variable
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
2014-02-25 12:13:50 -08:00
Chris Wilson
5589e80e2b xml: Handle clip-boxes in the updated cairo_clip_t
Edward Zimmerman pointed out that the xml surface had bitrotted slightly
and no longer understand the new clip layout - in particular that we can
have clips without a path, but just with boxes instead.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-06-21 12:01:32 +01:00
Chris Wilson
8653c2692e Split cairo-recording-surface-private into struct+inlines
References: https://bugs.freedesktop.org/show_bug.cgi?id=48577
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-04-19 12:46:34 +01:00
Chris Wilson
2061cd81f2 Replace the ad-hoc surface unwrappers with a function pointer
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-02-09 13:01:17 +00:00
Andrea Canciani
d883775f69 xml: Fix backend structure
The xml backend structure was being initialized with the wrong
functions, resulting in multiple "initialization from incompatible
pointer type" warnings.
2011-11-09 13:49:45 +01:00
Chris Wilson
70cd3b473d api: Extend cairo_antialias_t to include performace/quality hints
The existing API only described the method to be used for performing
rasterisation and unlike other API provided no opportunity for the user
to give a hint as to how to trade off performance against speed. So in
order to no be overly prescriptive, we extend the NONE/GRAY/SUBPIXEL
methods with FAST/GOOD/BEST hints and leave the backend to decide how
best to achieve those goals.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-08-30 15:17:38 +01:00
Chris Wilson
eed1f2efdf xml: Include 'cairo-image-surface-private.h'
Reported-by: James Cloos <cloos@jhcloos.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-08-14 21:02:08 +01:00
Chris Wilson
a69335a84e API: map-to-image and create-similar-image
A common requirement is the fast upload of pixel data. In order to
allocate the most appropriate image buffer, we need knowledge of the
destination. The most obvious example is that we could use a
shared-memory region for the image to avoid the transfer cost of
uploading the pixels to the X server. Similarly, gl, win32, quartz...

The other side of the equation is that for manual modification of a
remote surface, it would be more efficient if we can create a similar
image to reduce the transfer costs. This strategy is already followed
for the destination fallbacks and this merely exposes the same
capability for the application fallbacks.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-07-26 14:55:58 +01:00
Chris Wilson
b132fae5e8 clip: Rudimentary support for clip-polygon extraction
Step 1, fix the failings sighted recently by tracking clip-boxes as an
explicit property of the clipping and of composition.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-07-19 21:14:34 +01:00
Chris Wilson
83bfd85a13 Implement cairo_backend_t
Allow a backend to completely reimplement the Cairo API as it wants. The
goal is to pass operations to the native backends such as Quartz,
Direct2D, Qt, Skia, OpenVG with no overhead. And to permit complete
logging contexts, and whatever else the imagination holds. Perhaps to
experiment with double-paths?

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-07-15 11:05:19 +01:00
Andrea Canciani
200e147322 pattern: Use double precision for gradient extreme objects
Using double precision for gradient extreme objects ensures that they
are preserved as specified when constructing the gradient pattern.

Fixes huge-linear, huge-radial.

Fixes part of https://bugs.freedesktop.org/show_bug.cgi?id=32215
2011-01-02 18:33:14 +01:00
Andrea Canciani
a8ae8759f5 path: Always interpret in forward direction
Path are always interpreted in forward direction, so the ability of
interpreting in the opposite direction (which is very unlikely to be
useful at all) can be removed.
2010-12-10 10:58:51 +01:00
Adrian Johnson
12b1cbb07e Fix xml-surface use of load_truetype_font 2010-11-23 23:20:25 +10:30
Kouhei Sutou
4cf5260e99 xml: fix a typo to correct the indentation after <path></path>
Signed-off-by: Kouhei Sutou <kou@cozmixng.org>
2010-09-12 10:07:09 +01:00
Benjamin Otte
92d7b1eee9 device: Make flush vfunc return a cairo_status_t
Mirror the behavior of the surface flush vfunc: Make it return a status
and if it's an error set it on the device.
2010-06-07 13:37:48 +02:00
Andrea Canciani
b8a7f8621a Update FSF address
I updated the Free Software Foundation address using the following script.

for i in $(git grep Temple | cut -d: -f1 )
do
  sed -e 's/59 Temple Place[, -]* Suite 330, Boston, MA *02111-1307[, ]* USA/51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA/' -i "$i"
done

Fixes http://bugs.freedesktop.org/show_bug.cgi?id=21356
2010-04-27 11:13:38 +02:00
Chris Wilson
7ab350378e Silence enumeration warnings following addition of RGB16_565 2010-03-30 18:31:34 +01:00
M Joonas Pihlaja
5b7f4bb241 api: Introduce CAIRO_FORMAT_INVALID formally in the API.
We were exposing the actual value of CAIRO_FORMAT_INVALID
through API functions already, so it makes sense to just
go ahead and put it in the cairo_format_t enum.
2010-03-01 01:21:31 +02:00
Chris Wilson
3acd520c9d xml: Port to cairo_device_t 2010-01-22 23:01:50 +00:00
Chris Wilson
f617d5fc98 Add cairo_device_t
The device is a generic method for accessing the underlying interface
with the native graphics subsystem, typically the X connection or
perhaps the GL context. By exposing a cairo_device_t on a surface and
its various methods we enable finer control over interoperability with
external interactions of the device by applications. The use case in
mind is, for example, a multi-threaded gstreamer which needs to serialise
its own direct access to the device along with Cairo's across many
threads.

Secondly, the cairo_device_t is a unifying API for the mismash of
backend specific methods for controlling creation of surfaces with
explicit devices and a convenient hook for debugging and introspection.

The principal components of the API are the memory management of:

  cairo_device_reference(),
  cairo_device_finish() and
  cairo_device_destroy();

along with a pair of routines for serialising interaction:

  cairo_device_acquire() and
  cairo_device_release()

and a method to flush any outstanding accesses:

  cairo_device_flush().

The device for a particular surface may be retrieved using:

  cairo_surface_get_device().

The device returned is owned by the surface.
2010-01-22 23:01:50 +00:00
Chris Wilson
cfd204824f Constify stroke style and matrices.
As a simple step to ensure that we do not inadvertently modify (or at least
generate compiler warns if we try) user data, mark the incoming style
and matrices as constant.
2010-01-22 23:01:49 +00:00
Chris Wilson
c50c8b90c0 Move _cairo_error() to a standalone header
A pending commit will want to include some utility code from cairo and
so we need to extricate the error handling from the PLT symbol hiding.
2010-01-22 22:30:43 +00:00
M Joonas Pihlaja
43a775f60d [meta] Rename cairo_meta_surface_t to cairo_recording_surface_t.
The new name is more descriptive than the rather opaque meta surface.
Discussed with vigour on the mailing list and #cairo:

http://lists.cairographics.org/archives/cairo/2009-July/017571.html
2009-10-22 02:29:47 +03:00
Benjamin Otte
6809e12161 [API] Make _cairo_meta_surface_replay() private again
Replaying a meta surface can be achieved by using it as a source for a
cairo_paint() so exporting a separate API is unnecesary and confusing.
So after consulting Chris and Carl, we decided to remove the function
again.
2009-09-30 08:58:19 +02:00
Chris Wilson
4f880deeab Compiler warnings
Add an impossible default condition to avoid a compiler warning. And tweak
the code to avoid mismatching signed/unsigned comparisons.
2009-09-01 14:24:59 +01:00
Chris Wilson
425b0e35e2 Add xml surface
A very simple surface that produces a hierarchical DAG in a simple XML
format. It is intended to be used whilst debugging, for example with the
automatic regression finding tools of cairo-sphinx, and with test suites
that just want to verify that their code made a particular Cairo call.
2009-08-29 17:07:34 +01:00