Commit graph

11709 commits

Author SHA1 Message Date
George Matsumura
bb84bb650d cogl: Ensure onscreen framebuffers have an alpha component if required
Prior to this change, cogl often queried GLX so that it returned
a framebuffer that could not support an alpha component.

Signed-off-by: George Matsumura <gmmatsumura01@bvsd.org>
2020-08-25 02:30:58 -06:00
George Matsumura
02371a714e cogl: Improve support for hardware without mirrored repeating
Signed-off-by: George Matsumura <gmmatsumura01@bvsd.org>
2020-08-25 02:30:58 -06:00
George Matsumura
916408481f cogl: Move framebuffer creation functionality out of boilerplate
In order to be more consistent with backends such as gl, support for
creating a surface from content, width, and height parameters was
moved into the backend itself. The option to pass cairo-cogl a
framebuffer to create a texture from still exists, just now it is
not the only option.

Signed-off-by: George Matsumura <gmmatsumura01@bvsd.org>
2020-08-25 02:30:58 -06:00
George Matsumura
9248ba1419 cogl: Properly support unbounded operators
This makes it so that operators requiring transparent values to be
used outside of the bounds of the source and/or mask textures will
trigger a second rendering of transparent pixels.

Signed-off-by: George Matsumura <gmmatsumura01@bvsd.org>
2020-08-25 02:30:58 -06:00
George Matsumura
b258f0203c cogl: Handle negative stride images correctly
This adds correct support for negative stride images by uploading
them to a texture in their upside-down orientation and then
vertically inverting the matrix with which they are read, which
is required because OpenGL (and therefore cogl) cannot pack pixels
with a negative stride.

Signed-off-by: George Matsumura <gmmatsumura01@bvsd.org>
2020-08-25 02:30:58 -06:00
George Matsumura
20cc7ad16e cogl: Avoid duplicate representations of the path
Signed-off-by: George Matsumura <gmmatsumura01@bvsd.org>
2020-08-25 02:30:58 -06:00
George Matsumura
9e473db58d cogl: Flush the path before calling functions that require it
Prior to this change, API functions like path_exents returned
incorrect results if the cogl-specific representation of rectangular
paths was being used.

Signed-off-by: George Matsumura <gmmatsumura01@bvsd.org>
2020-08-25 02:30:58 -06:00
George Matsumura
b7e1551814 cogl: Fix rectangular filling fast path
Prior to this, the rectangular filling fast path passed arguments to
_cairo_cogl_journal_log_rectangle as if they represented the
coordinates of two opposite points on the rectangle, when the arguments
actually represent a rectangle with the x and y coordinates of one
point and the width and height of the rectangle.

Signed-off-by: George Matsumura <gmmatsumura01@bvsd.org>
2020-08-25 02:30:58 -06:00
George Matsumura
1bb048af24 cogl: Support raster sources
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>
2020-08-25 02:30:58 -06:00
George Matsumura
f3d2623046 cogl: Fix very small surfaces in boilerplate
Prior to this change, the boilerplate code crashed when given surface
dimensions less than 1. This fixes such behaviour by rounding the
dimensions up to 1, which is also done by the boilerplate code for
several other backends.

Signed-off-by: George Matsumura <gmmatsumura01@bvsd.org>
2020-08-25 02:30:58 -06:00
George Matsumura
8f0f371b87 cogl: Use less memory during recording surface replaying
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>
2020-08-25 02:30:57 -06:00
George Matsumura
641ea48b66 cogl: Support more unbounded operators
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>
2020-08-25 02:30:57 -06:00
George Matsumura
e2e494b9ff cogl: Fix rectangle filling conditions
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>
2020-08-25 02:30:57 -06:00
George Matsumura
bb02ea2b4f cogl: Correct usage of clip boxes
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>
2020-08-25 02:30:57 -06:00
George Matsumura
7319feb642 cogl: Support CAIRO_EXTEND_NONE correctly
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>
2020-08-25 02:30:57 -06:00
George Matsumura
98eaa778b7 cogl: Support combinations of mask and source patterns correctly
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>
2020-08-25 02:30:57 -06:00
George Matsumura
97a98d9145 cogl: Fix aliased vertex buffer offset
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>
2020-08-25 02:30:57 -06:00
George Matsumura
3e810fe2d1 cogl: Fix handling of translated pattern matrices
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>
2020-08-25 02:30:57 -06:00
George Matsumura
1dce0112ef cogl: Trailing whitespace fix
Signed-off-by: George Matsumura <gmmatsumura01@bvsd.org>
2020-08-25 02:30:57 -06:00
George Matsumura
fc8e68b37a cogl: Fix crash when specifying only mask surface
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>
2020-08-25 02:30:57 -06:00
George Matsumura
75d843208c cogl: Move context, device, and surface members to most fitting places
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>
2020-08-25 02:30:57 -06:00
George Matsumura
a3233bc5df cogl: Handle recording surface sources properly
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>
2020-08-25 02:30:57 -06:00
George Matsumura
97c766f8fe cogl: Convert int to fixed-point in rectangle painting fallback
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>
2020-08-25 02:30:57 -06:00
George Matsumura
ceffa65fb0 cogl: Account for new representations of framebuffer types
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>
2020-08-25 02:30:57 -06:00
George Matsumura
1ada7c9aa6 cogl: Fix push_group and pop_group context functions
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>
2020-08-25 02:30:57 -06:00
George Matsumura
d1dec1b384 cogl: Fix passing wrong type to _cairo_cogl_clip_push_box
Signed-off-by: George Matsumura <gmmatsumura01@bvsd.org>
2020-08-25 02:30:57 -06:00
George Matsumura
bda0f90d6e cogl: Correct behavior of boilerplate surface finishing functions
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>
2020-08-25 02:30:57 -06:00
George Matsumura
78b00a3213 cogl: Handle framebuffer formats better in case contents are unknown
Signed-off-by: George Matsumura <gmmatsumura01@bvsd.org>
2020-08-25 02:30:57 -06:00
George Matsumura
fd6de9820e cogl: Accommodate new context functions
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>
2020-08-25 02:30:57 -06:00
George Matsumura
09092bf884 cogl: Add dependency on cogl-path
The path functions in the cogl API have now been split into a
separate one which builds from the same codebase. In order to
compile with this change, the new library has to be added as
an explicit dependency.

Signed-off-by: George Matsumura <gmmatsumura01@bvsd.org>
2020-08-25 02:30:57 -06:00
George Matsumura
6250e1a843 cogl: Use new separate functions for offscreen and onscreen framebuffers
The old boilerplate code no longer worked due to the deprecation of
functions for swapping the buffers that it used.

Signed-off-by: George Matsumura <gmmatsumura01@bvsd.org>
2020-08-25 02:30:57 -06:00
George Matsumura
7135ca2091 cogl: Futher changes to match new cogl-experimental public API
These are more changes required to match the new backwards-incompatible
API of cogl-experimental.

Signed-off-by: George Matsumura <gmmatsumura01@bvsd.org>
2020-08-25 02:30:57 -06:00
George Matsumura
418ad9db62 cogl: Update to match changed cogl-experimental public API
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>
2020-08-25 02:30:57 -06:00
Tim-Philipp Müller
88d773e627 meson: add summary and flip some options to disabled by default
.. to match autotools.
2020-08-14 14:22:27 +00:00
Tim-Philipp Müller
89d4c22140 meson: update fontconfig wrap and add gperf wrap
Update fontconfig wrap to upstream now that it's been merged.
Add gperf wrap which is needed for fontconfig, same as in the
upstream fontconfig repo (this can't be put into wrapdb yet
because it requires changes to source files).
2020-08-07 12:13:10 +01:00
Tim-Philipp Müller
7cb362d586 meson: fix cairo-script-interpreter library name
Fixes #418
2020-08-07 00:18:17 +01:00
Nirbheek Chauhan
efc508bdb9 meson: Fix win32 libs in cairo-win32*.pc files
Fixes https://gitlab.freedesktop.org/cairo/cairo/-/issues/419
2020-08-06 02:06:45 +05:30
Mathieu Duponchelle
596a82f2d1 Add meson build definitions
Co-Authored by:
Nirbheek Chauhan <nirbheek@centricular.com>
lb90 <luca.bacci982@gmail.com>
Tim-Philipp Müller <tim@centricular.com>
2020-07-31 12:21:50 +01:00
Mathieu Duponchelle
a75f8df957 Fix build on Windows with recent versions of MSVC
- 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
2020-07-31 01:21:01 +01:00
Uli Schlachter
91b5761acd Merge branch 'master' of gitlab.freedesktop.org:sgerwk/cairo 2020-07-20 18:42:01 +02:00
Uli Schlachter
b55e491d67 Merge branch 'invalid-free-crash' of gitlab.freedesktop.org:psychon/cairo 2020-07-20 18:33:46 +02:00
Uli Schlachter
4777f9cd5f Merge branch 'fix-build-rule-for-font-variations' of gitlab.freedesktop.org:mpsuzuki/cairo 2020-07-20 18:32:33 +02:00
Uli Schlachter
e0f9db9459 Merge branch 'master' of gitlab.freedesktop.org:ffontaine/cairo 2020-07-20 18:30:45 +02:00
Uli Schlachter
bf12199196 Merge branch 'master' of gitlab.freedesktop.org:trofi/cairo 2020-07-20 18:29:39 +02:00
Mathieu Duponchelle
c4fd00c2c4 script-surface: Fix unitialized variable compiler warning
gcc doesn't warn about this because status is potentially
initialized in a loop.
2020-07-18 19:43:43 +00:00
Mathieu Duponchelle
bfa00bc3d7 cairo-qt-surface: fix arguments of _cairo_surface_init()
This is broken since b1192beac7 (2015!)
2020-07-18 19:43:43 +00:00
Mathieu Duponchelle
1676935768 raster-source: fix when builddir != srcdir
When the build dir is different from the source dir,
"png.png" is not a valid path. As we can't dispose of
an allocated filename, we add an atexit handler.
2020-07-18 19:47:27 +01:00
Mathieu Duponchelle
4645ecf3f8 record tests: fix when builddir != srcdir
When builddir != srcdir, cairo_test_create_pattern_from_png
needs a non-NULL ctx to work with.
2020-07-18 19:47:17 +01:00
Sergei Trofimovich
23b6e8bb57 build/aclocal.float.m4: detect 'strings' with AC_CHECK_TOOL
This way all binutils tools are detected with $CHOST prefix
if exist. And strings is allowed to be substituted with
STRINGS environment override, so 'llvm-strings' (or other)
alternative can be used.

Bug: https://bugs.gentoo.org/726200
Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
2020-06-14 09:58:52 +01:00
Uli Schlachter
aee96d175d Initialize mutexes in _cairo_ft_unscaled_font_map_lock()
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>
2020-02-27 17:01:07 +00:00