fix bug that graphics::make({0, 0}) behaves differently between Windows

and Linux
This commit is contained in:
Jinhao
2017-07-17 22:31:29 +08:00
parent 130ba79705
commit 64dbd2100c
2 changed files with 12 additions and 2 deletions

View File

@@ -291,6 +291,12 @@ namespace paint
{
if(impl_->handle == nullptr || impl_->size != sz)
{
if (sz.empty())
{
release();
return;
}
//The object will be delete while dwptr_ is performing a release.
drawable_type dw = new nana::detail::drawable_impl_type;
//Reuse the old font
@@ -342,7 +348,7 @@ namespace paint
Display* disp = spec.open_display();
int screen = DefaultScreen(disp);
Window root = ::XRootWindow(disp, screen);
dw->pixmap = ::XCreatePixmap(disp, root, (sz.width ? sz.width : 1), (sz.height ? sz.height : 1), DefaultDepth(disp, screen));
dw->pixmap = ::XCreatePixmap(disp, root, sz.width, sz.height, DefaultDepth(disp, screen));
dw->context = ::XCreateGC(disp, dw->pixmap, 0, 0);
#if defined(NANA_USE_XFT)
dw->xftdraw = ::XftDrawCreate(disp, dw->pixmap, spec.screen_visual(), spec.colormap());