how to clear XFixes regions

Posted by ~buratinas on Stack Overflow See other posts from Stack Overflow or by ~buratinas
Published on 2010-04-17T19:08:09Z Indexed on 2010/04/17 19:13 UTC
Read the original article Hit count: 275

Filed under:
|

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.

© Stack Overflow or respective owner

Related posts about x11

Related posts about extensions