views:

34

answers:

1

Hi,

I'm writing some low level code for X11 platform. To achieve best data copying performance I use XFixes/XDamage extensions.

How can I clear the contents of XFixes region after one refresh cycle? Or do they clean themselves after I use XFixesSetPictureClipRegion?

My code is something like that:

Display xdpy;
XShamPixmap pixmap_;
XFixesRegion region_;

damage_event_callback(damage_geometry_t geometry, XDamage damage,...) {
    unsigned curr_region = XFixesCreateRegion(xdpy, 0, 0);
    XDamageSubtract(xdpy, damage, None, curr_region);
    XFixesTranslateRegion( xdpy, curr_region, geometry.left(), geometry.top() );
    XFixesUnionRegion (xdpy, region_, region_, curr_region);
    }    

process_damage_events(...) {
    XFixesSetPictureClipRegion( xdpy, pixmap_, 0, 0, region_);
    XCopyArea (xdpy, window_->id(),
               pixmap_, XDefaultGC(xdpy, XDefaultScreen(xdpy)),
               0,0,width(),height(),0,0);
    /*Should clear region_ here 
    */

    ...
    }

Currently I clear the region by deleting and recreating, but I guess it's not the best way to do that.

+1  A: 

I'm not sure what you mean by clearing the region; you mean unsetting the clip on your picture, or freeing the region?

To unset the clip my guess is you'd set the clip region to None

To free the region XFixesDestroyRegion()

To make the region empty you can probably XFixesSetRegion(dpy, region, NULL, 0) but I'm not sure that will change the clip on the picture unless you XFixesSetPictureClipRegion again.

Havoc P