[prev in list] [next in list] [prev in thread] [next in thread] 

List:       freedesktop-xorg
Subject:    XRender, clip region and transformations
From:       Olivier Fourdan <fourdan () gmail ! com>
Date:       2015-02-09 8:56:39
Message-ID: CACxMwBg2wzeRO_QT9-89YqdZAOu+JcKsucvLsqHfA11ncQ2Q1Q () mail ! gmail ! com
[Download RAW message or body]

Hi

I am trying to scale down a (possibly shaped) window using XRender to a pixmap.

The transform matrix is the usual matrix for scaling, i.e:

   1.0  0.0  0.0
   0.0  1.0  0.0
   0.0  0.0  scale

My code does exactly this:

    pa.subwindow_mode = IncludeInferiors;
    srcPicture = XRenderCreatePicture (dpy, window_id, render_format,
CPSubwindowMode, &pa);
    XRenderSetPictureFilter (dpy, srcPicture, FilterBest, NULL, 0);

    region = XFixesCreateRegionFromWindow (dpy, window_id,
WindowRegionBounding);
    XFixesSetPictureClipRegion (dpy, srcPicture, 0, 0, region);
    XFixesDestroyRegion (dpy, region);

    render_format = XRenderFindStandardFormat (dpy, PictStandardARGB32);
    destPicture = XRenderCreatePicture (dpy, pixmap, render_format, 0, NULL);
    XRenderFillRectangle (dpy, PictOpSrc, destPicture, &c, 0, 0,
dest_w, dest_h);

    XRenderSetPictureTransform (dpy, srcPicture, &transform);
    XRenderComposite (dpy, PictOpOver, srcPicture, None, destPicture,
0, 0, 0, 0, 0, 0, dest_w, dest_h);

The scaling works as expected, but the problem is that the clipping
region set on the source picture is applied *after* the transformation
and not before (thus possibly ruining the result when the window is
shaped), and I fail to understand why.

Could someone help me understanding what I'm doing wrong here?

Cheers,
Olivier.
_______________________________________________
xorg@lists.x.org: X.Org support
Archives: http://lists.freedesktop.org/archives/xorg
Info: http://lists.x.org/mailman/listinfo/xorg
Your subscription address: %(user_address)s
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic