[Pixman] Source clipping: how-to and tests
Pekka Paalanen
ppaalanen at gmail.com
Mon Mar 2 04:47:01 PST 2015
Hi,
I've been trying to use source clipping in Weston's Pixman-renderer,
and I found something that seems strange.
The scenario is that I have:
- source clip in source image coordinates
- transformation (matrix)
- destination clip in destination coordinates
- potentially a mask (to apply global alpha
Then call pixman_image_composite32() to render.
Apart from the source clip everything works fine. Some special cases
really need a source clip, so I'm looking into that. I finally realized
I need all three to actually get any effect:
pixman_image_set_clip_region32(ps->image, &buffer_region);
pixman_image_set_source_clipping(ps->image, 1);
pixman_image_set_has_client_clip(ps->image, 1);
It seems that is as designed, that's ok.
The strange thing is that the source clip seems to be done in
the destination, not in the source. Is this expected?
Using source clip looks like it replaces the destination clip, instead
of clipping in the source image coordinate space. I'm testing with
Pixman 0.32.4.
I would really need clipping both before and after the transformation.
Is there a way to achieve that, or do I have to start looking into
trapezoids or something? (I suppose I will next look into creating a
mask image.)
Another question is, since source clipping really needs both
set_source_clipping and set_has_client_clip, do some of the tests have
a bug in that respect?
Grepping Pixman master, these do use set_has_client_clip:
test/glyph-test.c
test/stress-test.c
These use set_source_clipping, but do not use set_has_client_clip:
test/affine-test.c
test/composite-traps-test.c
test/scaling-test.c
Unless I'm mistaken, nothing is testing the correctness of source
clipping? Except maybe the glyph test?
Thanks,
pq
More information about the Pixman
mailing list