save some memory

This commit is contained in:
fluxgen 2004-01-09 01:19:48 +00:00
parent a48d734251
commit 08f6ca0514
2 changed files with 15 additions and 9 deletions

View file

@ -19,7 +19,7 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE. // DEALINGS IN THE SOFTWARE.
// $Id: GContext.cc,v 1.5 2003/11/28 22:50:55 fluxgen Exp $ // $Id: GContext.cc,v 1.6 2004/01/09 01:19:48 fluxgen Exp $
#include "GContext.hh" #include "GContext.hh"
@ -31,27 +31,33 @@
namespace FbTk { namespace FbTk {
Display *GContext::m_display = 0;
GContext::GContext(const FbTk::FbDrawable &drawable): GContext::GContext(const FbTk::FbDrawable &drawable):
m_display(FbTk::App::instance()->display()), m_gc(XCreateGC(m_display != 0 ? m_display : FbTk::App::instance()->display(),
m_gc(XCreateGC(m_display,
drawable.drawable(), drawable.drawable(),
0, 0)) { 0, 0)) {
if (m_display == 0)
m_display = FbTk::App::instance()->display();
setGraphicsExposure(false); setGraphicsExposure(false);
} }
GContext::GContext(Drawable drawable): GContext::GContext(Drawable drawable):
m_display(FbTk::App::instance()->display()), m_gc(XCreateGC(m_display != 0 ? m_display : FbTk::App::instance()->display(),
m_gc(XCreateGC(m_display,
drawable, drawable,
0, 0)) { 0, 0)) {
if (m_display == 0)
m_display = FbTk::App::instance()->display();
setGraphicsExposure(false); setGraphicsExposure(false);
} }
GContext::GContext(Drawable d, const GContext &gc): GContext::GContext(Drawable d, const GContext &gc):
m_display(FbTk::App::instance()->display()), m_gc(XCreateGC(m_display != 0 ? m_display : FbTk::App::instance()->display(),
m_gc(XCreateGC(m_display,
d, d,
0, 0)) { 0, 0)) {
if (m_display == 0)
m_display = FbTk::App::instance()->display();
setGraphicsExposure(false); setGraphicsExposure(false);
copy(gc); copy(gc);
} }

View file

@ -19,7 +19,7 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE. // DEALINGS IN THE SOFTWARE.
// $Id: GContext.hh,v 1.6 2003/12/16 17:06:51 fluxgen Exp $ // $Id: GContext.hh,v 1.7 2004/01/09 01:19:48 fluxgen Exp $
#ifndef FBTK_GCONTEXT_HH #ifndef FBTK_GCONTEXT_HH
#define FBTK_GCONTEXT_HH #define FBTK_GCONTEXT_HH
@ -98,7 +98,7 @@ public:
private: private:
GContext(const GContext &cont); GContext(const GContext &cont);
Display *m_display; // worth caching static Display *m_display; // worth caching
GC m_gc; GC m_gc;
}; };