summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--otk/focuslabel.cc2
-rw-r--r--otk/label.cc2
-rw-r--r--otk/rendertest.cc2
-rw-r--r--otk/surface.cc1
-rw-r--r--otk/truerendercontrol.cc4
-rw-r--r--otk/widget.cc14
-rw-r--r--otk/widget.hh2
7 files changed, 16 insertions, 11 deletions
diff --git a/otk/focuslabel.cc b/otk/focuslabel.cc
index 79d68b09..6869d231 100644
--- a/otk/focuslabel.cc
+++ b/otk/focuslabel.cc
@@ -67,7 +67,7 @@ void FocusLabel::renderForeground(void)
}
display->renderControl(_screen)->
- drawString(_surface, *ft, x, 0, *text_color, t);
+ drawString(*_surface, *ft, x, 0, *text_color, t);
}
}
diff --git a/otk/label.cc b/otk/label.cc
index 8c429dba..b536451e 100644
--- a/otk/label.cc
+++ b/otk/label.cc
@@ -61,7 +61,7 @@ void Label::renderForeground(void)
}
display->renderControl(_screen)->
- drawString(_surface, *ft, x, 0, *style()->getTextUnfocus(), t);
+ drawString(*_surface, *ft, x, 0, *style()->getTextUnfocus(), t);
}
}
diff --git a/otk/rendertest.cc b/otk/rendertest.cc
index 33b1db36..d6e3dbfc 100644
--- a/otk/rendertest.cc
+++ b/otk/rendertest.cc
@@ -13,7 +13,7 @@ int main(int argc, char **argv)
otk::AppWidget foo(&app);
foo.resize(600, 500);
- otk::RenderColor color(0, 0xff, 0x20, 0x20);
+ otk::RenderColor color(0, 0, 0xff, 0xff);
otk::RenderTexture tex(false,
otk::RenderTexture::Flat,
false,
diff --git a/otk/surface.cc b/otk/surface.cc
index 4f6ef386..70acf70a 100644
--- a/otk/surface.cc
+++ b/otk/surface.cc
@@ -39,7 +39,6 @@ void Surface::setPixmap(const RenderColor &color)
void Surface::setPixmap(XImage *image)
{
- printf("SET PIXMAP\n");
assert(image->width == _size.x());
assert(image->height == _size.y());
diff --git a/otk/truerendercontrol.cc b/otk/truerendercontrol.cc
index 786a3b09..078cde5b 100644
--- a/otk/truerendercontrol.cc
+++ b/otk/truerendercontrol.cc
@@ -132,5 +132,7 @@ void TrueRenderControl::drawBackground(Surface& sf,
delete [] im->data;
im->data = NULL;
- XDestroyImage(im);}
+ XDestroyImage(im);
+}
+
}
diff --git a/otk/widget.cc b/otk/widget.cc
index 9f574ee9..d32cb624 100644
--- a/otk/widget.cc
+++ b/otk/widget.cc
@@ -25,7 +25,7 @@ Widget::Widget(Widget *parent, Direction direction)
_stretchable_horz(false), _texture(0), _bg_pixmap(0), _bg_pixel(0),
_bcolor(0), _bwidth(0), _rect(0, 0, 1, 1), _screen(parent->screen()),
_fixed_width(false), _fixed_height(false),
- _surface(parent->screen(), _rect.size()),
+ _surface(0),
_event_dispatcher(parent->eventDispatcher())
{
assert(parent);
@@ -46,7 +46,7 @@ Widget::Widget(EventDispatcher *event_dispatcher, Style *style,
_stretchable_vert(false), _stretchable_horz(false), _texture(0),
_bg_pixmap(0), _bg_pixel(0), _bcolor(0), _bwidth(0), _rect(0, 0, 1, 1),
_screen(style->getScreen()), _fixed_width(false), _fixed_height(false),
- _surface(style->getScreen(), _rect.size()),
+ _surface(0),
_event_dispatcher(event_dispatcher)
{
assert(event_dispatcher);
@@ -261,12 +261,16 @@ void Widget::render(void)
if (!_texture) return;
printf("RENDER\n");
- _surface = Surface(_screen, _rect.size());
- display->renderControl(_screen)->drawBackground(_surface, *_texture);
+ Surface *s = _surface; // save the current surface
+
+ _surface = new Surface(_screen, _rect.size());
+ display->renderControl(_screen)->drawBackground(*_surface, *_texture);
renderForeground();
- XSetWindowBackgroundPixmap(**display, _window, _surface.pixmap());
+ XSetWindowBackgroundPixmap(**display, _window, _surface->pixmap());
+
+ delete s; // delete the old surface *after* its pixmap isn't in use anymore
}
void Widget::adjust(void)
diff --git a/otk/widget.hh b/otk/widget.hh
index 7d183c28..c7fc713b 100644
--- a/otk/widget.hh
+++ b/otk/widget.hh
@@ -167,7 +167,7 @@ protected:
bool _fixed_width;
bool _fixed_height;
- Surface _surface;
+ Surface *_surface;
EventDispatcher *_event_dispatcher;
};