summaryrefslogtreecommitdiff
path: root/src/Fl_Copy_Surface.cxx
diff options
context:
space:
mode:
authorManolo Gouy <Manolo>2016-02-18 16:21:51 +0000
committerManolo Gouy <Manolo>2016-02-18 16:21:51 +0000
commitf33b45f1d30653fb5da4817089e38ff0a2413cfb (patch)
tree9edc759690defa581b00b6ada80bb334f4ac5da8 /src/Fl_Copy_Surface.cxx
parent6ce27012a9412c4964e0ae40c81ea92ff39a61d3 (diff)
Remove all uses of the fl_gc global variable. Towards a clean driver model.
fl_gc remains usable by the application as a hook into the system. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11189 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src/Fl_Copy_Surface.cxx')
-rw-r--r--src/Fl_Copy_Surface.cxx16
1 files changed, 7 insertions, 9 deletions
diff --git a/src/Fl_Copy_Surface.cxx b/src/Fl_Copy_Surface.cxx
index b1cc00b8b..c91695883 100644
--- a/src/Fl_Copy_Surface.cxx
+++ b/src/Fl_Copy_Surface.cxx
@@ -49,15 +49,15 @@ Fl_GDI_Surface_::~Fl_GDI_Surface_() {
}
void Fl_GDI_Surface_::translate(int x, int y) {
- GetWindowOrgEx(fl_gc, origins+depth);
- SetWindowOrgEx(fl_gc, origins[depth].x - x, origins[depth].y - y, NULL);
+ GetWindowOrgEx((HDC)driver()->get_gc(), origins+depth);
+ SetWindowOrgEx((HDC)driver()->get_gc(), origins[depth].x - x, origins[depth].y - y, NULL);
if (depth < sizeof(origins)/sizeof(POINT)) depth++;
else Fl::warning("Fl_GDI_Surface_: translate stack overflow!");
}
void Fl_GDI_Surface_::untranslate() {
if (depth > 0) depth--;
- SetWindowOrgEx(fl_gc, origins[depth].x, origins[depth].y, NULL);
+ SetWindowOrgEx((HDC)driver()->get_gc(), origins[depth].x, origins[depth].y, NULL);
}
const char *Fl_GDI_Surface_::class_id = "Fl_GDI_Surface_";
@@ -79,11 +79,10 @@ Fl_Copy_Surface::Fl_Copy_Surface(int w, int h) : Fl_Surface_Device(NULL)
helper = new Fl_Quartz_Surface_(width, height);
driver(helper->driver());
prepare_copy_pdf_and_tiff(w, h);
- oldgc = fl_gc;
#elif defined(WIN32)
helper = new Fl_GDI_Surface_();
driver(helper->driver());
- oldgc = fl_gc;
+ oldgc = (HDC)Fl_Surface_Device::surface()->driver()->get_gc();
// exact computation of factor from screen units to EnhMetaFile units (0.01 mm)
HDC hdc = GetDC(NULL);
int hmm = GetDeviceCaps(hdc, HORZSIZE);
@@ -122,10 +121,9 @@ Fl_Copy_Surface::~Fl_Copy_Surface()
{
#ifdef __APPLE__ // PORTME: Fl_Surface_Driver - platform copy surface
complete_copy_pdf_and_tiff();
- fl_gc = oldgc;
delete (Fl_Quartz_Surface_*)helper;
#elif defined(WIN32)
- if(oldgc == fl_gc) oldgc = NULL;
+ if (oldgc == (HDC)Fl_Surface_Device::surface()->driver()->get_gc()) oldgc = NULL;
HENHMETAFILE hmf = CloseEnhMetaFile (gc);
if ( hmf != NULL ) {
if ( OpenClipboard (NULL) ){
@@ -136,7 +134,7 @@ Fl_Copy_Surface::~Fl_Copy_Surface()
DeleteEnhMetaFile(hmf);
}
DeleteDC(gc);
- fl_gc = oldgc;
+ Fl_Surface_Device::surface()->driver()->set_gc(oldgc);
delete (Fl_GDI_Surface_*)helper;
#elif defined(FL_PORTING)
# pragma message "FL_PORTING: free resources in destructor of Fl_Copy_Surface"
@@ -166,7 +164,7 @@ void Fl_Copy_Surface::draw(Fl_Widget* widget, int delta_x, int delta_y)
void Fl_Copy_Surface::set_current()
{
#if defined(__APPLE__) || defined(WIN32) // PORTME: Fl_Surface_Driver - platform copy surface
- fl_gc = gc;
+ driver()->set_gc(gc);
fl_window = (Window)1;
Fl_Surface_Device::set_current();
#elif defined(FL_PORTING)