This adds supporte for raster sources using the same method that
is used to support radial gradient and mesh sources.
Signed-off-by: George Matsumura <gmmatsumura01@bvsd.org>
Many of the tests in the test suite do many replays of different
small parts of a single surface. When combined with the cogl backend's
journaling mechanism, this consumes very large amounts of memory, as
the entire surface is allocated for each replay. This changes this
behaviour so that only the portion of the surface that will be used
is allocated.
Signed-off-by: George Matsumura <gmmatsumura01@bvsd.org>
Due to recent changes, all unbounded Porter-Duff compositing operators
can be properly supported in addition to IN.
Signed-off-by: George Matsumura <gmmatsumura01@bvsd.org>
Prior to this change, the context functions were using the accelerated
rectangle-filling path even if there was a preexisting rectangular path,
producing incorrect results.
Signed-off-by: George Matsumura <gmmatsumura01@bvsd.org>
This changes the interpretation of multiple boxes in the clip from
using the intersection of the multiple boxes to using the union of
the multiple boxes, which corrects many results in the test suite.
Signed-off-by: George Matsumura <gmmatsumura01@bvsd.org>
Prior to this change, CAIRO_EXTEND_NONE was handled the same way as
CAIRO_EXTEND_PAD, which produced incorrect results in many tests.
This fixes such behaviour by created a per-source and per-mask clip
that is applied so that areas outside the bounds of the source or
mask textures are not sampled during drawing.
Signed-off-by: George Matsumura <gmmatsumura01@bvsd.org>
Prior to this change, the set of template pipelines did not
properly apply to the full combination of mask and source patterns,
which could be either textures or solids.
Signed-off-by: George Matsumura <gmmatsumura01@bvsd.org>
This fixes a bug in which the texture coordinate attributes were
being read from the wrong location in the mapped buffer, due to a
typo in the original code.
Signed-off-by: George Matsumura <gmmatsumura01@bvsd.org>
Due to how cairo matrix math works, the x0 and y0 elements of the
texture matrix were not being normalized, leading to incorrect
results in several tests.
Signed-off-by: George Matsumura <gmmatsumura01@bvsd.org>
Cogl enters into an infinite recursion if a texture is specified
for layer 1 of a pipeline but no texture is specified for layer 0.
This works around the bug by setting the mask texture on layer 0
if there is no source texture.
Signed-off-by: George Matsumura <gmmatsumura01@bvsd.org>
The buffer stack was moved from the surface to the device, as
mapped buffers are shared across all surfaces using the device
and more than one surface may be doing so. Stemming from this, if
a surface tries to map a buffer without first unmapping one that
has been mapped by another surface, it will trigger an error.
The parent backend functions were moved from the device to the
context, as it is possible that the context creation function could
be passed a non-cogl device. Prior to this change, many of the
subsurface tests segfaulted.
Signed-off-by: George Matsumura <gmmatsumura01@bvsd.org>
Previously, if an unbounded recording surface was given as the
source, the program triggered an assertion failure in the recording
surface code, as acquire_source_image cannot be used on the surface
in this case. This adds a new path to deal with such an unbounded
source surface.
Signed-off-by: George Matsumura <gmmatsumura01@bvsd.org>
Previously, the rectangle fallback path in surface_paint was
incorrectly passing and int to a function that required a
fixed-point number.
Signed-off-by: George Matsumura <gmmatsumura01@bvsd.org>
With the new cogl API, casting the framebuffer into offscreen
and onscreen types with the provided macros is a deprecated
behavior.
Signed-off-by: George Matsumura <gmmatsumura01@bvsd.org>
Before this change, there was the possibility of context functions
only meant for the cogl surface backend being used on a non-cogl
surface.
Signed-off-by: George Matsumura <gmmatsumura01@bvsd.org>
Without this, a buffer-swapping function only usable on onscreen
framebuffers would have been used on offscreen framebuffers.
Signed-off-by: George Matsumura <gmmatsumura01@bvsd.org>
In order to satisfy the runtime check that accounts for new
API functions that modify the transformation matrix, the new
functions for translation from backend to user coordinates must
be accounted for.
Signed-off-by: George Matsumura <gmmatsumura01@bvsd.org>
These are more changes required to match the new backwards-incompatible
API of cogl-experimental.
Signed-off-by: George Matsumura <gmmatsumura01@bvsd.org>
This is the first part of updates to match the backwards-incompatible
changes that have been made in the cogl-experimental public API
since this backend last worked.
Signed-off-by: George Matsumura <gmmatsumura01@bvsd.org>
- vsnprintf and snprintf are available since vs2015
- define ISREG if not provided
- guard unistd.h include with HAVE_UNISTD_H
- isnan() is available after vs2010
This function is reachable via cairo_ft_font_face_create_for_ft_face()
-> _cairo_ft_unscaled_font_create_from_face() ->
_cairo_ft_unscaled_font_create_internal() ->
_cairo_ft_unscaled_font_map_lock(). Thus, it could happen that nothing
initialized mutexes before this code runs.
Signed-off-by: Uli Schlachter <psychon@znc.in>
We can't just move around the contents of the
passed-in string, we need to make a copy. This
was showing up as memory corruption in pango.
See https://gitlab.gnome.org/GNOME/pango/issues/346
Support subpixel positioning with a 4x4 subpixel grid.
When compositing glyphs in the image compositor,
we store the subpixel phases in the high bits of the
glyph index. The _cairo_scaled_glyph_index() macro
has been updated to discard these bits. By storing
the phases in the glyph index, the glyph cache just
keeps working. When loading a glyph, the Freetype
font backend shifts the outline according to the
phases.
FT_PIXEL_MODE_BGRA is an enum member, not a define, so it always appears
as 0 in the preprocessor conditions added in commit c0ed8ce1a1.
There is an existing define for color font support, use that instead.
Commits cb871c6c made the function _cairo_clip_reduce_to_boxes()
actually do something instead of being a no-op. This exposed a latent
bug in cairo that was so far just not hit due to luck.
The function _cairo_clip_steal_boxes() removes the boxes from a clip and
gives them to a cairo_boxes_t. _cairo_clip_unsteal_boxes() undoes this
operation. For efficiency reasons, cairo_clip_t contains an embedded
cairo_box_t that is used when the clip has only one box to avoid a
memory allocation. Thus, _cairo_clip_unsteal_boxes() must be called on
the same clip that was given to _cairo_clip_steal_boxes(), or otherwise
a clip could end up to the embedded box of another instance of
cairo_clip_t. This is exactly what was happening here.
For example, cairo-xcb can replace extents->clip with another clip via
the call chain _cairo_xcb_render_compositor_paint() (which is where
boxes are stolen) -> _clip_and_composite_boxes() ->
trim_extents_to_traps() ->
_cairo_composite_rectangles_intersect_mask_extents(). This function
replaced the clip with the result of _cairo_clip_reduce_for_composite()
and frees the old clip. At this point, the boxes that were stolen
previously become invalid / become a dangling pointer. The crash later
on is just one of the side effects of this.
This commit fixes this problem by treating embedded boxes specially in
_cairo_clip_steal_boxes() and _cairo_clip_unsteal_boxes(): The
cairo_boxes_t instance also has embedded boxes. An embedded box on the
clip is copied to these other embedded boxes. When unstealing, the
embedded box of the clip is used again. Thus, it does not matter anymore
that another instance of _cairo_clip_t is used for unstealing.
Fixes: https://gitlab.freedesktop.org/cairo/cairo/issues/358
Signed-off-by: Uli Schlachter <psychon@znc.in>
Found via `codespell -i 3 -w -I ../cairo-word-whitelist.txt -L tim,ned,uint`
Follow up of 12cb59be7d
Reviewed-by: Bryce Harrington <bryce@bryceharrington.org>
The indentation of this line suggests it is a typo. In any case it
causes the function to unconditionally return immediately, thereby
shortcircuiting it entirely, which does not appear to be the intended
behavior.
Fixes: https://gitlab.com/cairo/cairo/issues/2