There is no need to expose it since it can be accessed by passing
non-axis aligned quads. Move existing tests to the quad clipper.
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
The added complexity is unnecessary, it is limited to polygons of
length less than or equal to 8, there is currently no use for that
feature nor any plans to use it and tests are non-existent.
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
The non-zero area check of clipper_quad_clip() is incorrect for quads
initialized with a polygon starting with a vertical edge. In order to
handle polygons starting with an horizontal edge and polygons starting
with a vertical one, it must check opposite vertices for equality.
The test previously described as "Box intersects entire smaller
aligned quad" is now described as "Clockwise winding and top/left
initial vertex". This test keeps the same values as before but all
combinations of winding order and first edge orientations are
also tested. The QUAD() macro isn't used anymore to do so.
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
Add quad clipping tests checking intersections at all edges and
corners of axis-aligned and unaligned quads with negative and positive
values.
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
Extract quad bounding box initialization from the GL renderer and move
it to a dedicated initialization function in the clipper. It's used by
both the renderer and the clipping test client, which further reduces
code duplication.
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
Simplify clip_transformed() by replacing its context parameter with a
clipping box parameter. The context struct is still used internally to
pass data around.
Since clip_transformed() doesn't take a context anymore, the clipping
boxes are now declared per test and stored along with the other vertex
data. That prepares the ground to add new tests using different boxes.
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
Carry on the common vertex representation front by making boxes use
the clip_vertex struct.
A new function clip_quad_box32() is added to clearly separate the main
function taking a clip_vertex struct from the utility function taking
a pixman_box32 struct.
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
Pass a clip_vertex struct and a size to clip_transformed() instead of
a polygon8 struct to simplify the clipper API by sticking to a common
vertex representation.
Simmplify vertex-clip test since clip_transformed() now works on a
copy of the polygon (commit edd5d1cc09).
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
clip_simple() isn't used anymore outside of the clipper. This commit
removes it to simplify the clipper API. Its implementation is moved
straight to the axis-aligned quad clipping path of clip_transformed().
Signed-off-by: Loïc Molinari <loic.molinari@collabora.com>
Calling clip_transformed() 4 times in a row with the same polygon8 in
commit a4d31fa8bd introduced a bug
because the surf input is modified each time. This is fixed by working
on a local copy. The input parameter is marked constant to reflect the
change on the function prototype.
Fixes#764
Signed-off-by: Loïc Molinari <loic.molinari@gmail.com>
clip_quad() is a dedicated clipping function for quads that doesn't
depend on any GL renderer internal structures. It can be moved out to
the clipper to be called by both the renderer and the clipping test
client without having to duplicate code.
Signed-off-by: Loïc Molinari <loic.molinari@gmail.com>
Move vertex clipper back to single-precision floating point
intermediates. Since positions are sent down the graphics hardware as
single-precision values, this prevents useless conversions between
single and double precision values and lets compilers fit twice as
much data into vector registers. It also removes a copy by letting the
clipper store vertices directly into the vertex buffer.
This is mostly reverting the conversion to double-precision that
happened along with the switch to the weston_coord struct for vertex
coordinates (commit 10e70bf23c).
Signed-off-by: Loïc Molinari <loic.molinari@gmail.com>
Remove the independent x, y floats from the clipping code and replace them
with struct weston_cord. This includes the polygon8 structure as well.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
This is probably the simplest case to demonstrate how to use
WESTON_EXPORT_FOR_TESTS.
Previously, vertex-clip test re-built vertex-clipping.c for itself. Now
it directly links in gl-renderer.so instead as that is where
vexter-clipping.c gets built into for actual use. This probably will not
work for any installed program, but luckily tests are never installed,
so Meson makes sure the DSO is found.
Unfortunately we cannot remove the definition of dep_vertex_clipping
yet, because clients/cliptest.c needs it.
This makes vertex-clip test depend on GL-renderer, but that is where the
code is really used.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
This clarifies what is supposed to be the libweston code.
v2: screen-share.c is already in compositor/ instead.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Yong Bakos <ybakos@humanoriented.com>
Acked-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Tested-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Tested-by: Benoit Gschwind <gschwind@gnu-log.net>
Acked-by: Benoit Gschwind <gschwind@gnu-log.net>
[Pekka: rebased]