bitmap masks return!

This commit is contained in:
Dana Jansens 2003-01-23 02:08:04 +00:00
parent e64d90be4d
commit b99508df01
2 changed files with 13 additions and 13 deletions

View file

@ -57,8 +57,8 @@ RenderStyle::RenderStyle(int screen, const std::string &stylefile)
true, true,
RenderTexture::Vertical, RenderTexture::Vertical,
false, false,
0x858687, 0x96ba86,
0x373a3f, 0x5a724c,
0x181f24, 0x181f24,
0x0); 0x0);
_label_unfocus = new RenderTexture(_screen, _label_unfocus = new RenderTexture(_screen,
@ -174,7 +174,7 @@ RenderStyle::RenderStyle(int screen, const std::string &stylefile)
_max_mask->w = _max_mask->h = 8; _max_mask->w = _max_mask->h = 8;
{ {
char data[] = { 0x7e, 0xff, 0xc3, 0xc3, 0xc3, 0xc3, 0xff, 0x7e }; char data[] = { 0x7e, 0xff, 0xc3, 0xc3, 0xc3, 0xc3, 0xff, 0x7e };
_max_mask->mask= _max_mask->mask =
XCreateBitmapFromData(**display, XCreateBitmapFromData(**display,
display->screenInfo(_screen)->rootWindow(), display->screenInfo(_screen)->rootWindow(),
data, 8, 8); data, 8, 8);
@ -183,18 +183,18 @@ RenderStyle::RenderStyle(int screen, const std::string &stylefile)
_icon_mask = new PixmapMask(); _icon_mask = new PixmapMask();
_icon_mask->w = _icon_mask->h = 8; _icon_mask->w = _icon_mask->h = 8;
{ {
char data[] = { 0x00, 0x00, 0xc3, 0xe7, 0x7e, 0x3c, 0x18, 0x00 }; unsigned char data[] = { 0x00, 0x00, 0xc3, 0xe7, 0x7e, 0x3c, 0x18, 0x00 };
_icon_mask->mask= _icon_mask->mask =
XCreateBitmapFromData(**display, XCreateBitmapFromData(**display,
display->screenInfo(_screen)->rootWindow(), display->screenInfo(_screen)->rootWindow(),
data, 8, 8); (char*)data, 8, 8);
} }
_stick_mask = new PixmapMask(); _stick_mask = new PixmapMask();
_stick_mask->w = _stick_mask->h = 8; _stick_mask->w = _stick_mask->h = 8;
{ {
char data[] = { 0x00, 0x00, 0x18, 0x3c, 0x3c, 0x18, 0x00, 0x00 }; char data[] = { 0x00, 0x00, 0x18, 0x3c, 0x3c, 0x18, 0x00, 0x00 };
_icon_mask->mask= _stick_mask->mask =
XCreateBitmapFromData(**display, XCreateBitmapFromData(**display,
display->screenInfo(_screen)->rootWindow(), display->screenInfo(_screen)->rootWindow(),
data, 8, 8); data, 8, 8);
@ -204,7 +204,7 @@ RenderStyle::RenderStyle(int screen, const std::string &stylefile)
_close_mask->w = _close_mask->h = 8; _close_mask->w = _close_mask->h = 8;
{ {
char data[] = { 0xc3, 0xe7, 0x7e, 0x3c, 0x3c, 0x7e, 0xe7, 0xc3 }; char data[] = { 0xc3, 0xe7, 0x7e, 0x3c, 0x3c, 0x7e, 0xe7, 0xc3 };
_icon_mask->mask= _close_mask->mask =
XCreateBitmapFromData(**display, XCreateBitmapFromData(**display,
display->screenInfo(_screen)->rootWindow(), display->screenInfo(_screen)->rootWindow(),
data, 8, 8); data, 8, 8);

View file

@ -113,6 +113,7 @@ void ButtonWidget::renderForeground()
assert(false); // there's no other button widgets! assert(false); // there's no other button widgets!
} }
assert(pm->mask);
if (pm->mask == None) return; // no mask for the button, leave it empty if (pm->mask == None) return; // no mask for the button, leave it empty
width = _rect.width(); width = _rect.width();
@ -121,14 +122,13 @@ void ButtonWidget::renderForeground()
_style->buttonUnfocusColor()); _style->buttonUnfocusColor());
// set the clip region // set the clip region
int x = (width - pm->w) / 2, y = (width - pm->h) / 2;
XSetClipMask(**otk::display, color->gc(), pm->mask); XSetClipMask(**otk::display, color->gc(), pm->mask);
XSetClipOrigin(**otk::display, color->gc(), XSetClipOrigin(**otk::display, color->gc(), x, y);
(width - pm->w)/2, (width - pm->h)/2);
// fill in the clipped region // fill in the clipped region
XFillRectangle(**otk::display, _window, color->gc(), XFillRectangle(**otk::display, _surface->pixmap(), color->gc(), x, y,
(width - pm->w)/2, (width - pm->h)/2, x + pm->w, y + pm->h);
(width + pm->w)/2, (width + pm->h)/2);
// unset the clip region // unset the clip region
XSetClipMask(**otk::display, color->gc(), None); XSetClipMask(**otk::display, color->gc(), None);