有問題,我有這些函數調用:與XPutImage
OSPImgBlit(&img->_obj, &win1->_obj, 0, 0, 0, 0, 640, 480);
OSPRun(&win1->_obj, OSPWND_SWAP);
這些實現:
void OSPwnd_swap(OSPobj *obj, va_list arg) {
OSPwindow *wnd = (OSPwindow *) obj;
XdbeSwapInfo swpifo;
swpifo.swap_window = wnd->_wnd;
swpifo.swap_action = XdbeUndefined;
// XdbeSwapBuffers returns true on success, we return 0 on success.
if(XdbeSwapBuffers(wnd->_dpy->_dpy, &swpifo, 1)) {
OSPrint(1, "OSPwnd_swap : Window %d swapped "
"on connection %d",
wnd->_wnd, XConnectionNumber(wnd->_dpy->_dpy));
/* XFlush(wnd->_dpy->_dpy); */
}
else {
OSPrint(1, "OSPwnd_swap : Unable to swap window %d "
"on connection %d",
wnd->_wnd, XConnectionNumber(wnd->_dpy->_dpy));
}
}
void OSPImgBlit(OSPobj *orig, OSPobj *dest, int x_orig, int y_orig,
int x_dest, int y_dest, unsigned int width, unsigned int height) {
OSPimage *orig_as_image = (OSPimage *) orig;
OSPwindow *orig_as_window = (OSPwindow *) orig;
OSPimage *dest_as_image = (OSPimage *) dest;
OSPwindow *dest_as_window = (OSPwindow *) dest;
enum {
image_to_image = 0,
image_to_window = 1,
window_to_image = 2,
window_to_window = 3
} mode = image_to_window;
switch(mode) {
case image_to_window:
XPutImage(dest_as_window->_dpy->_dpy, dest_as_window->_bbf,
dest_as_window->_gc, orig_as_image->_img,
x_orig, y_orig, x_dest, y_dest, width, height);
default:;
}
}
整個代碼是在這裏:https://github.com/DJTECKING/OSPOOC.git
我的應用程序可以正常啓動,但是當我嘗試關閉我創建的窗口,它隨機發生以下行爲之一: - 段錯誤 - X_PutI上的BadDrawable法師 - 無(不工作的關閉窗口關閉按鈕) - 正確地關閉窗口和應用
我想類似的東西我使用的是已經關閉窗口或釋放圖像, 但在整個代碼我不明白這是怎麼發生的,有什麼想法?
此外,XPutImage僅在正方形 ,而我試圖複製整個窗口。
還有一個問題,可能這個話題的分離, 我繼續臉色難看撕裂的效果,甚至Xdouble緩衝擴展, 是不是這個擴展應該避免這種情況?
我沒有10美譽所以這裏是直接的圖像鏈接: http://i.stack.imgur.com/AnlMo.png