*CtrlCore: ImageX11 fix, DHCtrl fix

git-svn-id: svn://ultimatepp.org/upp/trunk@2873 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
cxl 2010-11-28 18:42:31 +00:00
parent 7ed1ac9106
commit 9d83b6cafa
2 changed files with 16 additions and 11 deletions

View file

@ -287,6 +287,8 @@ ImageDraw::operator Image() const
{
GuiLock __;
XImage *xim = XGetImage(Xdisplay, dw, 0, 0, max(size.cx, 1), max(size.cy, 1), AllPlanes, ZPixmap);
if(!xim)
return Null;
Visual *v = DefaultVisual(Xdisplay, Xscreenno);
RasterFormat fmt;
@ -345,17 +347,19 @@ ImageDraw::operator Image() const
}
XDestroyImage(xim);
if(has_alpha) {
xim = XGetImage(Xdisplay, alpha.dw, 0, 0, size.cx, size.cy, AllPlanes, ZPixmap);
const byte *s = (const byte *)xim->data;
t = ib;
Buffer<RGBA> line(size.cx);
for(int y = 0; y < size.cy; y++) {
fmt.Read(line, s, size.cx, palette);
for(int x = 0; x < size.cx; x++)
(t++)->a = line[x].r;
s += xim->bytes_per_line;
xim = XGetImage(Xdisplay, alpha.dw, 0, 0, max(size.cx, 1), max(size.cy, 1), AllPlanes, ZPixmap);
if(xim) {
const byte *s = (const byte *)xim->data;
t = ib;
Buffer<RGBA> line(size.cx);
for(int y = 0; y < size.cy; y++) {
fmt.Read(line, s, size.cx, palette);
for(int x = 0; x < size.cx; x++)
(t++)->a = line[x].r;
s += xim->bytes_per_line;
}
XDestroyImage(xim);
}
XDestroyImage(xim);
}
Premultiply(ib);
return ib;

View file

@ -155,7 +155,8 @@ bool DHCtrl::Init()
);
} else {
XReparentWindow(Xdisplay, hwnd, GetParentWindow(), r.left, r.top);
XMoveResizeWindow(Xdisplay, hwnd, r.left, r.top, r.Width(), r.Height());
XResizeWindow(Xdisplay, hwnd, r.Width(), r.Height());
XChangeWindowAttributes(Xdisplay, hwnd, ValueMask, &winAttributes);
}
// Frees VisualInfo