Remove Fl_X::q_fill_context() used only once.

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11171 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
Manolo Gouy
2016-02-14 06:36:20 +00:00
parent 6439f34ee7
commit ec290bc9e0
4 changed files with 17 additions and 25 deletions
-1
View File
@@ -162,7 +162,6 @@ public:
void in_windowDidResize(bool); // sets whether window is performing windowDidResize
// Quartz additions:
CGContextRef gc; // graphics context (NULL when using QD)
static void q_fill_context(); // fill a Quartz context with current FLTK state
static void q_release_context(Fl_X *x=0); // free all resources associated with fl_gc
// Cocoa additions
static NSOpenGLPixelFormat *mode_to_NSOpenGLPixelFormat(int mode, const int*); // computes NSOpenGLPixelFormat from Gl window's mode
-1
View File
@@ -97,7 +97,6 @@ public:
// void in_windowDidResize(bool); // sets whether window is performing windowDidResize
// // Quartz additions:
// CGContextRef gc; // graphics context (NULL when using QD)
// static void q_fill_context(); // fill a Quartz context with current FLTK state
// static void q_release_context(Fl_X *x=0); // free all resources associated with fl_gc
// // Cocoa additions
// static NSOpenGLPixelFormat *mode_to_NSOpenGLPixelFormat(int mode, const int*); // computes NSOpenGLPixelFormat from Gl window's mode
-20
View File
@@ -3305,26 +3305,6 @@ void Fl_Window::make_current()
#endif
}
// helper function to manage the current CGContext fl_gc
extern void fl_quartz_restore_line_style_();
// FLTK has only one global graphics state. This function copies the FLTK state into the
// current Quartz context
void Fl_X::q_fill_context() {
if (!fl_gc) return;
if ( ! fl_window) { // a bitmap context
CGFloat hgt = CGBitmapContextGetHeight(fl_gc);
CGAffineTransform at = CGContextGetCTM(fl_gc);
if (at.a != 1 && at.a == at.d && at.b == 0 && at.c == 0) { // proportional scaling, no rotation
hgt /= at.a;
}
CGContextTranslateCTM(fl_gc, 0.5, hgt-0.5f);
CGContextScaleCTM(fl_gc, 1.0f, -1.0f); // now 0,0 is top-left point of the context
}
fl_color(fl_graphics_driver->color());
fl_quartz_restore_line_style_();
}
// Give the Quartz context back to the system
void Fl_X::q_release_context(Fl_X *x) {
if (x && x->gc!=fl_gc) return;
@@ -265,6 +265,9 @@ void Fl_Quartz_Graphics_Driver::pop_clip() {
restore_clip();
}
// helper function to manage the current CGContext fl_gc
extern void fl_quartz_restore_line_style_();
void Fl_Quartz_Graphics_Driver::restore_clip() {
fl_clip_state_number++;
Fl_Region r = rstack[rstackptr];
@@ -273,9 +276,20 @@ void Fl_Quartz_Graphics_Driver::restore_clip() {
CGContextRestoreGState(fl_gc);
CGContextSaveGState(fl_gc);
}
Fl_X::q_fill_context();//flip coords if bitmap context
//apply program clip
if (r) {
// FLTK has only one global graphics state.
// This copies the FLTK state into the current Quartz context
if ( ! fl_window ) { // a bitmap context
CGFloat hgt = CGBitmapContextGetHeight(fl_gc);
CGAffineTransform at = CGContextGetCTM(fl_gc);
if (at.a != 1 && at.a == at.d && at.b == 0 && at.c == 0) { // proportional scaling, no rotation
hgt /= at.a;
}
CGContextTranslateCTM(fl_gc, 0.5, hgt-0.5f);
CGContextScaleCTM(fl_gc, 1.0f, -1.0f); // now 0,0 is top-left point of the context
}
color(color());
fl_quartz_restore_line_style_();
if (r) { //apply program clip
CGContextClipToRects(fl_gc, r->rects, r->count);
}
}