how to clear XFixes regions
- by ~buratinas
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.