@@ -1041,7 +1041,7 @@ public: | |||
static cairo_surface_t * cairo_create_surface ( Window xid, int W, int H ); | |||
// Cairo support API | |||
static cairo_t * cairo_make_current( cairo_surface_t *cs, cairo_t *cc ); | |||
static cairo_t * cairo_make_current( cairo_t *cc ); | |||
/** when FLTK_HAVE_CAIRO is defined and cairo_autolink_context() is true, | |||
any current window dc is linked to a current context. | |||
This is not the default, because it may not be necessary | |||
@@ -46,7 +46,6 @@ | |||
# include <cairo/cairo-xlib.h> | |||
# endif | |||
FL_EXPORT extern cairo_surface_t *fl_cairo_surface; | |||
FL_EXPORT extern cairo_t *fl_cairo_context; | |||
cairo_surface_t * cairo_create_surface(void * gc, int W, int H); | |||
@@ -156,9 +156,7 @@ public: | |||
Window xid; | |||
Window other_xid; /* for double buffering */ | |||
cairo_t *cc; | |||
cairo_surface_t *cs; | |||
cairo_t *other_cc; /* for double buffering */ | |||
cairo_surface_t *other_cs; /* for double buffering */ | |||
Fl_Window *w; | |||
Fl_Region region; | |||
Fl_X *next; | |||
@@ -50,7 +50,6 @@ cairo_surface_t * cairo_create_surface(void * gc, Window w, int W, int H) { | |||
# endif | |||
} | |||
cairo_surface_t *fl_cairo_surface; | |||
cairo_t *fl_cairo_context; | |||
cairo_surface_t * | |||
@@ -60,9 +59,8 @@ Fl::cairo_create_surface ( Window xid, int W, int H ) | |||
} | |||
cairo_t * | |||
Fl::cairo_make_current( cairo_surface_t *cs, cairo_t *cc ) { | |||
fl_cairo_surface = cs; | |||
Fl::cairo_make_current( cairo_t *cc ) | |||
{ | |||
fl_cairo_context = cc; | |||
return cc; | |||
@@ -325,16 +325,16 @@ void Fl_Double_Window::flush(int eraseoverlay) { | |||
#else | |||
# error unsupported platform | |||
#endif | |||
myi->other_cs = Fl::cairo_create_surface( myi->other_xid, w(), h() ); | |||
myi->other_cc = cairo_create( myi->other_cs ); | |||
cairo_surface_t *cs = Fl::cairo_create_surface( myi->other_xid, w(), h() ); | |||
myi->other_cc = cairo_create( cs ); | |||
cairo_surface_destroy( cs ); | |||
} | |||
fl_clip_region(myi->region); | |||
if (damage() & ~FL_DAMAGE_EXPOSE) { | |||
Fl::cairo_make_current( myi->other_cs, myi->other_cc ); | |||
Fl::cairo_make_current( myi->other_cc ); | |||
#ifdef WIN32 | |||
HDC _sgc = fl_gc; | |||
@@ -363,15 +363,11 @@ void Fl_Double_Window::flush(int eraseoverlay) { | |||
draw(); | |||
#if FLTK_HAVE_CAIRO | |||
cairo_surface_flush( myi->other_cs ); | |||
#endif | |||
/* cairo_surface_flush( myi->other_cs ); */ | |||
fl_window = myi->xid; | |||
#if FLTK_HAVE_CAIRO | |||
Fl::cairo_make_current( myi->cs, myi->cc ); | |||
#endif | |||
Fl::cairo_make_current( myi->cc ); | |||
// fl_restore_clip(); | |||
fl_clip_region(myi->region); | |||
@@ -388,10 +384,8 @@ void Fl_Double_Window::flush(int eraseoverlay) { | |||
// the current clip region: | |||
#if 1 // FLTK_USE_CAIRO | |||
cairo_set_source_surface( myi->cc, myi->other_cs, 0, 0 ); | |||
cairo_set_source_surface( myi->cc, cairo_get_target( myi->other_cc ), 0, 0 ); | |||
cairo_set_operator( myi->cc, CAIRO_OPERATOR_SOURCE ); | |||
/* cairo_rectangle( myi->cc, 0, 0, w(), h() ); */ | |||
/* cairo_fill( myi->cc ); */ | |||
cairo_paint( myi->cc ); | |||
cairo_set_operator( myi->cc, CAIRO_OPERATOR_OVER ); | |||
#else | |||
@@ -415,13 +409,10 @@ void Fl_Double_Window::resize(int X,int Y,int W,int H) { | |||
Fl_Window::resize(X,Y,W,H); | |||
Fl_X* myi = Fl_X::i(this); | |||
if (myi && myi->other_xid && (ow != w() || oh != h())) { | |||
#if FLTK_HAVE_CAIRO | |||
if ( myi->other_cs ) | |||
if ( myi->other_cc ) | |||
{ | |||
cairo_destroy( myi->other_cc ); myi->other_cc = 0; | |||
cairo_surface_destroy( myi->other_cs ); myi->other_cs = 0; | |||
} | |||
#endif | |||
fl_delete_offscreen(myi->other_xid); | |||
myi->other_xid = 0; | |||
} | |||
@@ -430,13 +421,8 @@ void Fl_Double_Window::resize(int X,int Y,int W,int H) { | |||
void Fl_Double_Window::hide() { | |||
Fl_X* myi = Fl_X::i(this); | |||
if (myi && myi->other_xid) { | |||
#if FLTK_HAVE_CAIRO | |||
if ( myi->other_cs ) | |||
{ | |||
if ( myi->other_cc ) | |||
cairo_destroy( myi->other_cc ); myi->other_cc = 0; | |||
cairo_surface_destroy( myi->other_cs ); myi->other_cs = 0; | |||
} | |||
#endif | |||
fl_delete_offscreen(myi->other_xid); | |||
myi->other_xid = 0; | |||
} | |||
@@ -1618,11 +1618,11 @@ Fl_X* Fl_X::set_xid(Fl_Window* win, Window winxid) { | |||
Fl_X* xp = new Fl_X; | |||
xp->xid = winxid; | |||
xp->other_xid = 0; | |||
xp->cs = Fl::cairo_create_surface( winxid, win->w(), win->h() ); | |||
xp->cc = cairo_create( xp->cs ); | |||
cairo_surface_t *cs = Fl::cairo_create_surface( winxid, win->w(), win->h() ); | |||
xp->cc = cairo_create( cs ); | |||
cairo_surface_destroy( cs ); | |||
xp->cairo_surface_invalid = 0; | |||
xp->other_cc = 0; | |||
xp->other_cs = 0; | |||
xp->setwindow(win); | |||
xp->next = Fl_X::first; | |||
xp->region = 0; | |||
@@ -1983,17 +1983,16 @@ void Fl_Window::make_current() { | |||
if ( i->cairo_surface_invalid && i->cc ) | |||
{ | |||
cairo_destroy( i->cc ); i->cc = 0; | |||
cairo_surface_destroy( i->cs ); i->cs = 0; | |||
} | |||
if ( ! i->cc ) | |||
{ | |||
i->cs = Fl::cairo_create_surface( i->xid, w(), h() ); | |||
i->cc = cairo_create( i->cs ); | |||
cairo_surface_t *cs = Fl::cairo_create_surface( i->xid, w(), h() ); | |||
i->cc = cairo_create( cs ); | |||
cairo_surface_destroy( cs ); | |||
} | |||
Fl::cairo_make_current( i->cs, i->cc ); | |||
Fl::cairo_make_current( i->cc ); | |||
current_ = this; | |||