Xrender cursor performance / double buffering?
Bert Freudenberg
bert at freudenbergs.de
Tue Apr 17 06:21:09 EDT 2007
Hi folks,
for drag'n'dropping an image between an activity and the sugar frame
I thought it would be nice to just set it as cursor. This way, it
gets rendered on top of both the activity and the frame.
This works nicely on my desktop machine. It also works nicely on the
XO, as long as there is nothing animating behind the cursor. If there
is, however, some animation still going while dragging, the
background and cursor image gets redrawn constantly. Even if the
cursor is as small as 100x100 pixels this is very visible, apparently
there is no double-buffering. So, the following is my code to set the
cursor image - should I do something differently?
//input: cursorBits (32bit ARGB premul), extentX, extentY,
offsetX, offsetY
XImage *image = XCreateImage(stDisplay, DefaultVisual(stDisplay,
DefaultScreen(stDisplay)),
32, ZPixmap, 0, cursorBits, extentX,
extentY, 32, 0);
Pixmap pixmap = XCreatePixmap (stDisplay, DefaultRootWindow
(stDisplay), extentX, extentY, 32);
GC gc = XCreateGC(stDisplay, pixmap, 0, 0);
XPutImage(stDisplay, pixmap, gc, image, 0, 0, 0, 0, extentX,
extentY);
image->data = 0; //otherwise, XDestroyImage tries to free this
XRenderPictFormat *pictformat = XRenderFindStandardFormat
(stDisplay, PictStandardARGB32);
Picture picture = XRenderCreatePicture(stDisplay, pixmap,
pictformat, 0, 0);
Cursor cursor = XRenderCreateCursor(stDisplay, picture, offsetX,
offsetY);
XDefineCursor(stDisplay, stWindow, cursor);
Ideas appreciated - or will the LX make this work magically? This is
a B2.
- Bert -
More information about the Devel
mailing list