fix bug that graphics::make({0, 0}) behaves differently between Windows
and Linux
This commit is contained in:
parent
130ba79705
commit
64dbd2100c
@ -91,7 +91,11 @@ namespace nana
|
||||
const void* pixmap() const;
|
||||
const void* context() const;
|
||||
|
||||
void make(const ::nana::size&); ///< Creates a bitmap resource that size is width by height in pixel
|
||||
/// Creates a graphics/drawable resource
|
||||
/**
|
||||
* @param sz The dimension of the graphics to be requested. If sz is empty, it performs as release().
|
||||
*/
|
||||
void make(const ::nana::size& sz);
|
||||
void resize(const ::nana::size&);
|
||||
void typeface(const font&); ///< Selects a specified font type into the graphics object.
|
||||
font typeface() const;
|
||||
|
||||
@ -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());
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user