summaryrefslogtreecommitdiff
path: root/src/drivers/Quartz
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/drivers/Quartz
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/drivers/Quartz')
-rw-r--r--src/drivers/Quartz/Fl_Quartz_Graphics_Driver.cxx24
-rw-r--r--src/drivers/Quartz/Fl_Quartz_Graphics_Driver.h3
-rw-r--r--src/drivers/Quartz/Fl_Quartz_Graphics_Driver_arci.cxx44
-rw-r--r--src/drivers/Quartz/Fl_Quartz_Graphics_Driver_color.cxx12
-rw-r--r--src/drivers/Quartz/Fl_Quartz_Graphics_Driver_font.cxx37
-rw-r--r--src/drivers/Quartz/Fl_Quartz_Graphics_Driver_image.cxx58
-rw-r--r--src/drivers/Quartz/Fl_Quartz_Graphics_Driver_line_style.cxx12
-rw-r--r--src/drivers/Quartz/Fl_Quartz_Graphics_Driver_rect.cxx212
-rw-r--r--src/drivers/Quartz/Fl_Quartz_Graphics_Driver_vertex.cxx52
9 files changed, 235 insertions, 219 deletions
diff --git a/src/drivers/Quartz/Fl_Quartz_Graphics_Driver.cxx b/src/drivers/Quartz/Fl_Quartz_Graphics_Driver.cxx
index 44fe57403..657e7eb26 100644
--- a/src/drivers/Quartz/Fl_Quartz_Graphics_Driver.cxx
+++ b/src/drivers/Quartz/Fl_Quartz_Graphics_Driver.cxx
@@ -23,6 +23,16 @@
const char *Fl_Quartz_Graphics_Driver::class_id = "Fl_Quartz_Graphics_Driver";
+/* Reference to the current CGContext
+ For back-compatibility only. The preferred procedure to get this reference is
+ Fl_Surface_Device::surface()->driver()->get_gc().
+ */
+CGContextRef fl_gc = 0;
+
+void Fl_Graphics_Driver::global_gc()
+{
+ fl_gc = (CGContextRef)get_gc();
+}
/*
* By linking this module, the following static method will instatiate the
@@ -118,15 +128,15 @@ void fl_begin_offscreen(Fl_Offscreen ctx) {
_ss = Fl_Surface_Device::surface();
Fl_Display_Device::display_device()->set_current();
if (stack_ix<stack_max) {
- stack_gc[stack_ix] = fl_gc;
+ stack_gc[stack_ix] = (CGContextRef)fl_graphics_driver->get_gc();
stack_window[stack_ix] = fl_window;
} else
fprintf(stderr, "FLTK CGContext Stack overflow error\n");
stack_ix++;
- fl_gc = (CGContextRef)ctx;
+ fl_graphics_driver->set_gc(ctx);
fl_window = 0;
- CGContextSaveGState(fl_gc);
+ CGContextSaveGState(ctx);
fl_graphics_driver->push_no_clip();
}
@@ -135,14 +145,16 @@ void fl_begin_offscreen(Fl_Offscreen ctx) {
*/
void fl_end_offscreen() {
fl_graphics_driver->pop_clip();
- CGContextRestoreGState(fl_gc); // matches CGContextSaveGState in fl_begin_offscreen()
- CGContextFlush(fl_gc);
+ CGContextRef gc = (CGContextRef)fl_graphics_driver->get_gc();
+
+ CGContextRestoreGState(gc); // matches CGContextSaveGState in fl_begin_offscreen()
+ CGContextFlush(gc);
if (stack_ix>0)
stack_ix--;
else
fprintf(stderr, "FLTK CGContext Stack underflow error\n");
if (stack_ix<stack_max) {
- fl_gc = stack_gc[stack_ix];
+ fl_graphics_driver->set_gc(stack_gc[stack_ix]);
fl_window = stack_window[stack_ix];
}
_ss->set_current();
diff --git a/src/drivers/Quartz/Fl_Quartz_Graphics_Driver.h b/src/drivers/Quartz/Fl_Quartz_Graphics_Driver.h
index 93fbbfeb3..c9a6c916e 100644
--- a/src/drivers/Quartz/Fl_Quartz_Graphics_Driver.h
+++ b/src/drivers/Quartz/Fl_Quartz_Graphics_Driver.h
@@ -39,10 +39,13 @@
This class is implemented only on the Mac OS X platform.
*/
class Fl_Quartz_Graphics_Driver : public Fl_Graphics_Driver {
+ CGContextRef gc;
public:
static const char *class_id;
const char *class_name() {return class_id;};
virtual int has_feature(driver_feature mask) { return mask & NATIVE; }
+ virtual void set_gc(void *ctxt) {gc = (CGContextRef)ctxt;}
+ virtual void *get_gc() {return gc;}
char can_do_alpha_blending();
// --- bitmap stuff
diff --git a/src/drivers/Quartz/Fl_Quartz_Graphics_Driver_arci.cxx b/src/drivers/Quartz/Fl_Quartz_Graphics_Driver_arci.cxx
index 892baf859..4b1a164df 100644
--- a/src/drivers/Quartz/Fl_Quartz_Graphics_Driver_arci.cxx
+++ b/src/drivers/Quartz/Fl_Quartz_Graphics_Driver_arci.cxx
@@ -30,42 +30,42 @@ void Fl_Quartz_Graphics_Driver::arc(int x,int y,int w,int h,double a1,double a2)
if (w <= 0 || h <= 0) return;
a1 = (-a1)/180.0f*M_PI; a2 = (-a2)/180.0f*M_PI;
float cx = x + 0.5f*w - 0.5f, cy = y + 0.5f*h - 0.5f;
- CGContextSetShouldAntialias(fl_gc, true);
+ CGContextSetShouldAntialias(gc, true);
if (w!=h) {
- CGContextSaveGState(fl_gc);
- CGContextTranslateCTM(fl_gc, cx, cy);
- CGContextScaleCTM(fl_gc, w-1.0f, h-1.0f);
- CGContextAddArc(fl_gc, 0, 0, 0.5, a1, a2, 1);
- CGContextRestoreGState(fl_gc);
+ CGContextSaveGState(gc);
+ CGContextTranslateCTM(gc, cx, cy);
+ CGContextScaleCTM(gc, w-1.0f, h-1.0f);
+ CGContextAddArc(gc, 0, 0, 0.5, a1, a2, 1);
+ CGContextRestoreGState(gc);
} else {
float r = (w+h)*0.25f-0.5f;
- CGContextAddArc(fl_gc, cx, cy, r, a1, a2, 1);
+ CGContextAddArc(gc, cx, cy, r, a1, a2, 1);
}
- CGContextStrokePath(fl_gc);
- CGContextSetShouldAntialias(fl_gc, false);
+ CGContextStrokePath(gc);
+ CGContextSetShouldAntialias(gc, false);
}
void Fl_Quartz_Graphics_Driver::pie(int x,int y,int w,int h,double a1,double a2) {
if (w <= 0 || h <= 0) return;
a1 = (-a1)/180.0f*M_PI; a2 = (-a2)/180.0f*M_PI;
float cx = x + 0.5f*w - 0.5f, cy = y + 0.5f*h - 0.5f;
- CGContextSetShouldAntialias(fl_gc, true);
+ CGContextSetShouldAntialias(gc, true);
if (w!=h) {
- CGContextSaveGState(fl_gc);
- CGContextTranslateCTM(fl_gc, cx, cy);
- CGContextScaleCTM(fl_gc, w, h);
- CGContextAddArc(fl_gc, 0, 0, 0.5, a1, a2, 1);
- CGContextAddLineToPoint(fl_gc, 0, 0);
- CGContextClosePath(fl_gc);
- CGContextRestoreGState(fl_gc);
+ CGContextSaveGState(gc);
+ CGContextTranslateCTM(gc, cx, cy);
+ CGContextScaleCTM(gc, w, h);
+ CGContextAddArc(gc, 0, 0, 0.5, a1, a2, 1);
+ CGContextAddLineToPoint(gc, 0, 0);
+ CGContextClosePath(gc);
+ CGContextRestoreGState(gc);
} else {
float r = (w+h)*0.25f;
- CGContextAddArc(fl_gc, cx, cy, r, a1, a2, 1);
- CGContextAddLineToPoint(fl_gc, cx, cy);
- CGContextClosePath(fl_gc);
+ CGContextAddArc(gc, cx, cy, r, a1, a2, 1);
+ CGContextAddLineToPoint(gc, cx, cy);
+ CGContextClosePath(gc);
}
- CGContextFillPath(fl_gc);
- CGContextSetShouldAntialias(fl_gc, false);
+ CGContextFillPath(gc);
+ CGContextSetShouldAntialias(gc, false);
}
#endif // FL_CFG_GFX_QUARTZ
diff --git a/src/drivers/Quartz/Fl_Quartz_Graphics_Driver_color.cxx b/src/drivers/Quartz/Fl_Quartz_Graphics_Driver_color.cxx
index a5c489a5c..c321419ee 100644
--- a/src/drivers/Quartz/Fl_Quartz_Graphics_Driver_color.cxx
+++ b/src/drivers/Quartz/Fl_Quartz_Graphics_Driver_color.cxx
@@ -53,12 +53,12 @@ void Fl_Quartz_Graphics_Driver::color(Fl_Color i) {
g = c>>16;
b = c>> 8;
}
- if (!fl_gc) return; // no context yet? We will assign the color later.
+ if (!gc) return; // no context yet? We will assign the color later.
float fr = r/255.0f;
float fg = g/255.0f;
float fb = b/255.0f;
- CGContextSetRGBFillColor(fl_gc, fr, fg, fb, 1.0f);
- CGContextSetRGBStrokeColor(fl_gc, fr, fg, fb, 1.0f);
+ CGContextSetRGBFillColor(gc, fr, fg, fb, 1.0f);
+ CGContextSetRGBStrokeColor(gc, fr, fg, fb, 1.0f);
}
void Fl_Quartz_Graphics_Driver::color(uchar r, uchar g, uchar b) {
@@ -66,9 +66,9 @@ void Fl_Quartz_Graphics_Driver::color(uchar r, uchar g, uchar b) {
float fr = r/255.0f;
float fg = g/255.0f;
float fb = b/255.0f;
- if (!fl_gc) return; // no context yet? We will assign the color later.
- CGContextSetRGBFillColor(fl_gc, fr, fg, fb, 1.0f);
- CGContextSetRGBStrokeColor(fl_gc, fr, fg, fb, 1.0f);
+ if (!gc) return; // no context yet? We will assign the color later.
+ CGContextSetRGBFillColor(gc, fr, fg, fb, 1.0f);
+ CGContextSetRGBStrokeColor(gc, fr, fg, fb, 1.0f);
}
// FIXME: this function should not be here! It's not part of the driver.
diff --git a/src/drivers/Quartz/Fl_Quartz_Graphics_Driver_font.cxx b/src/drivers/Quartz/Fl_Quartz_Graphics_Driver_font.cxx
index d3fc9e79d..1d909b488 100644
--- a/src/drivers/Quartz/Fl_Quartz_Graphics_Driver_font.cxx
+++ b/src/drivers/Quartz/Fl_Quartz_Graphics_Driver_font.cxx
@@ -580,7 +580,7 @@ if (fl_mac_os_version >= Fl_X::CoreText_threshold) {
// activate the current GC
iSize = sizeof(CGContextRef);
iTag = kATSUCGContextTag;
- iValuePtr = &fl_gc;
+ iValuePtr = &gc;
ATSUSetLayoutControls(layout, 1, &iTag, &iSize, &iValuePtr);
// now measure the bounding box
err = ATSUSetTextPointerLocation(layout, txt, kATSUFromTextBeginning, n, n);
@@ -632,10 +632,10 @@ if (fl_mac_os_version >= Fl_X::CoreText_threshold) {
CFRelease(str16);
CTLineRef ctline = CTLineCreateWithAttributedString(mastr);
CFRelease(mastr);
- CGContextSetTextPosition(fl_gc, 0, 0);
- CGContextSetShouldAntialias(fl_gc, true);
- CGRect rect = CTLineGetImageBounds(ctline, fl_gc);
- CGContextSetShouldAntialias(fl_gc, false);
+ CGContextSetTextPosition(gc, 0, 0);
+ CGContextSetShouldAntialias(gc, true);
+ CGRect rect = CTLineGetImageBounds(ctline, gc);
+ CGContextSetShouldAntialias(gc, false);
CFRelease(ctline);
dx = floor(rect.origin.x + 0.5);
dy = floor(- rect.origin.y - rect.size.height + 0.5);
@@ -657,7 +657,7 @@ else {
// activate the current GC
iSize = sizeof(CGContextRef);
iTag = kATSUCGContextTag;
- iValuePtr = &fl_gc;
+ iValuePtr = &gc;
ATSUSetLayoutControls(layout, 1, &iTag, &iSize, &iValuePtr);
// now measure the bounding box
err = ATSUSetTextPointerLocation(layout, txt, kATSUFromTextBeginning, n, n);
@@ -704,11 +704,12 @@ static void fl_mac_draw(const char *str, int n, float x, float y, Fl_Graphics_Dr
CFRelease(color);
CTLineRef ctline = CTLineCreateWithAttributedString(mastr);
CFRelease(mastr);
- CGContextSetTextMatrix(fl_gc, font_mx);
- CGContextSetTextPosition(fl_gc, x, y);
- CGContextSetShouldAntialias(fl_gc, true);
- CTLineDraw(ctline, fl_gc);
- CGContextSetShouldAntialias(fl_gc, false);
+ CGContextRef gc = (CGContextRef)driver->get_gc();
+ CGContextSetTextMatrix(gc, font_mx);
+ CGContextSetTextPosition(gc, x, y);
+ CGContextSetShouldAntialias(gc, true);
+ CTLineDraw(ctline, gc);
+ CGContextSetShouldAntialias(gc, false);
CFRelease(ctline);
} else {
#endif
@@ -719,13 +720,13 @@ static void fl_mac_draw(const char *str, int n, float x, float y, Fl_Graphics_Dr
ByteCount iSize = sizeof(CGContextRef);
ATSUAttributeTag iTag = kATSUCGContextTag;
- ATSUAttributeValuePtr iValuePtr=&fl_gc;
+ ATSUAttributeValuePtr iValuePtr=&gc;
ATSUSetLayoutControls(layout, 1, &iTag, &iSize, &iValuePtr);
err = ATSUSetTextPointerLocation(layout, uniStr, kATSUFromTextBeginning, n, n);
- CGContextSetShouldAntialias(fl_gc, true);
+ CGContextSetShouldAntialias(gc, true);
err = ATSUDrawText(layout, kATSUFromTextBeginning, n, FloatToFixed(x), FloatToFixed(y));
- CGContextSetShouldAntialias(fl_gc, false);
+ CGContextSetShouldAntialias(gc, false);
#endif
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
}
@@ -745,11 +746,11 @@ void Fl_Quartz_Graphics_Driver::draw(const char* str, int n, int x, int y) {
}
void Fl_Quartz_Graphics_Driver::draw(int angle, const char *str, int n, int x, int y) {
- CGContextSaveGState(fl_gc);
- CGContextTranslateCTM(fl_gc, x, y);
- CGContextRotateCTM(fl_gc, - angle*(M_PI/180) );
+ CGContextSaveGState(gc);
+ CGContextTranslateCTM(gc, x, y);
+ CGContextRotateCTM(gc, - angle*(M_PI/180) );
draw(str, n, 0, 0);
- CGContextRestoreGState(fl_gc);
+ CGContextRestoreGState(gc);
}
void Fl_Quartz_Graphics_Driver::rtl_draw(const char* c, int n, int x, int y) {
diff --git a/src/drivers/Quartz/Fl_Quartz_Graphics_Driver_image.cxx b/src/drivers/Quartz/Fl_Quartz_Graphics_Driver_image.cxx
index e1fa62e42..a36f34c82 100644
--- a/src/drivers/Quartz/Fl_Quartz_Graphics_Driver_image.cxx
+++ b/src/drivers/Quartz/Fl_Quartz_Graphics_Driver_image.cxx
@@ -51,7 +51,7 @@ static void dataReleaseCB(void *info, const void *data, size_t size)
*/
static void innards(const uchar *buf, int X, int Y, int W, int H,
int delta, int linedelta, int mono,
- Fl_Draw_Image_Cb cb, void* userdata)
+ Fl_Draw_Image_Cb cb, void* userdata, CGContextRef gc)
{
if (!linedelta) linedelta = W*delta;
@@ -79,7 +79,7 @@ static void innards(const uchar *buf, int X, int Y, int W, int H,
lut = CGColorSpaceCreateDeviceGray();
else
lut = CGColorSpaceCreateDeviceRGB();
- // a release callback is necessary when the fl_gc is a print context because the image data
+ // a release callback is necessary when the gc is a print context because the image data
// must be kept until the page is closed. Thus tmpBuf can't be deleted here. It's too early.
CGDataProviderRef src = CGDataProviderCreateWithData( 0L, array, linedelta*H,
tmpBuf ? dataReleaseCB : NULL
@@ -98,7 +98,7 @@ static void innards(const uchar *buf, int X, int Y, int W, int H,
CGDataProviderRelease(src);
if (img) return; // else fall through to slow mode
// following the very save (and very slow) way to write the image into the give port
- CGContextSetShouldAntialias(fl_gc, false);
+ CGContextSetShouldAntialias(gc, false);
if ( cb )
{
uchar *tmpBuf = new uchar[ W*4 ];
@@ -112,9 +112,9 @@ static void innards(const uchar *buf, int X, int Y, int W, int H,
{ fl_color( src[0], src[0], src[0] ); }
else
{ fl_color( src[0], src[1], src[2] ); }
- CGContextMoveToPoint(fl_gc, X+j, Y+i);
- CGContextAddLineToPoint(fl_gc, X+j, Y+i);
- CGContextStrokePath(fl_gc);
+ CGContextMoveToPoint(gc, X+j, Y+i);
+ CGContextAddLineToPoint(gc, X+j, Y+i);
+ CGContextStrokePath(gc);
src+=delta;
}
}
@@ -131,29 +131,29 @@ static void innards(const uchar *buf, int X, int Y, int W, int H,
fl_color( src[0], src[0], src[0] );
else
fl_color( src[0], src[1], src[2] );
- CGContextMoveToPoint(fl_gc, X+j, Y+i);
- CGContextAddLineToPoint(fl_gc, X+j, Y+i);
- CGContextStrokePath(fl_gc);
+ CGContextMoveToPoint(gc, X+j, Y+i);
+ CGContextAddLineToPoint(gc, X+j, Y+i);
+ CGContextStrokePath(gc);
src += delta;
}
}
}
- CGContextSetShouldAntialias(fl_gc, true);
+ CGContextSetShouldAntialias(gc, true);
}
void Fl_Quartz_Graphics_Driver::draw_image(const uchar* buf, int x, int y, int w, int h, int d, int l){
- innards(buf,x,y,w,h,d,l,(d<3&&d>-3),0,0);
+ innards(buf,x,y,w,h,d,l,(d<3&&d>-3),0,0,gc);
}
void Fl_Quartz_Graphics_Driver::draw_image(Fl_Draw_Image_Cb cb, void* data,
int x, int y, int w, int h,int d) {
- innards(0,x,y,w,h,d,0,(d<3&&d>-3),cb,data);
+ innards(0,x,y,w,h,d,0,(d<3&&d>-3),cb,data,gc);
}
void Fl_Quartz_Graphics_Driver::draw_image_mono(const uchar* buf, int x, int y, int w, int h, int d, int l){
- innards(buf,x,y,w,h,d,l,1,0,0);
+ innards(buf,x,y,w,h,d,l,1,0,0,gc);
}
void Fl_Quartz_Graphics_Driver::draw_image_mono(Fl_Draw_Image_Cb cb, void* data,
int x, int y, int w, int h,int d) {
- innards(0,x,y,w,h,d,0,1,cb,data);
+ innards(0,x,y,w,h,d,0,1,cb,data,gc);
}
void fl_rectf(int x, int y, int w, int h, uchar r, uchar g, uchar b) {
@@ -166,7 +166,7 @@ void Fl_Quartz_Graphics_Driver::draw(Fl_Bitmap *bm, int XP, int YP, int WP, int
if (bm->start(XP, YP, WP, HP, cx, cy, X, Y, W, H)) {
return;
}
- if (bm->id_ && fl_gc) {
+ if (bm->id_ && gc) {
draw_CGImage((CGImageRef)bm->id_, X,Y,W,H, cx, cy, bm->w(), bm->h());
}
}
@@ -223,7 +223,7 @@ void Fl_Quartz_Graphics_Driver::draw(Fl_RGB_Image *img, int XP, int YP, int WP,
CGColorSpaceRelease(lut);
CGDataProviderRelease(src);
}
- if (img->id_ && fl_gc) {
+ if (img->id_ && gc) {
if (!img->alloc_array && has_feature(PRINTER) && !CGImageGetShouldInterpolate((CGImageRef)img->id_)) {
// When printing, the image data is used when the page is completed, that is, after return from this function.
// If the image has alloc_array = 0, we must protect against image data being freed before it is used:
@@ -252,12 +252,12 @@ int Fl_Quartz_Graphics_Driver::draw_scaled(Fl_Image *img, int XP, int YP, int WP
fl_clip_box(XP,YP,WP,HP,X,Y,W,H); // X,Y,W,H will give the unclipped area of XP,YP,WP,HP
if (W == 0 || H == 0) return 1;
fl_push_no_clip(); // remove the FLTK clip that can't be rescaled
- CGContextSaveGState(fl_gc);
- CGContextClipToRect(fl_gc, CGRectMake(X, Y, W, H)); // this clip path will be rescaled & translated
- CGContextTranslateCTM(fl_gc, XP, YP);
- CGContextScaleCTM(fl_gc, float(WP)/img->w(), float(HP)/img->h());
+ CGContextSaveGState(gc);
+ CGContextClipToRect(gc, CGRectMake(X, Y, W, H)); // this clip path will be rescaled & translated
+ CGContextTranslateCTM(gc, XP, YP);
+ CGContextScaleCTM(gc, float(WP)/img->w(), float(HP)/img->h());
img->draw(0, 0, img->w(), img->h(), 0, 0);
- CGContextRestoreGState(fl_gc);
+ CGContextRestoreGState(gc);
fl_pop_clip(); // restore FLTK's clip
return 1;
}
@@ -317,14 +317,14 @@ fl_uintptr_t Fl_Quartz_Graphics_Driver::cache(Fl_Pixmap *img, int w, int h, cons
void Fl_Quartz_Graphics_Driver::draw_CGImage(CGImageRef cgimg, int x, int y, int w, int h, int srcx, int srcy, int sw, int sh)
{
CGRect rect = CGRectMake(x, y, w, h);
- CGContextSaveGState(fl_gc);
- CGContextClipToRect(fl_gc, CGRectOffset(rect, -0.5, -0.5 ));
+ CGContextSaveGState(gc);
+ CGContextClipToRect(gc, CGRectOffset(rect, -0.5, -0.5 ));
// move graphics context to origin of vertically reversed image
// The 0.5 here cancels the 0.5 offset present in Quartz graphics contexts.
// Thus, image and surface pixels are in phase if there's no scaling.
- CGContextTranslateCTM(fl_gc, rect.origin.x - srcx - 0.5, rect.origin.y - srcy + sh - 0.5);
- CGContextScaleCTM(fl_gc, 1, -1);
- CGAffineTransform at = CGContextGetCTM(fl_gc);
+ CGContextTranslateCTM(gc, rect.origin.x - srcx - 0.5, rect.origin.y - srcy + sh - 0.5);
+ CGContextScaleCTM(gc, 1, -1);
+ CGAffineTransform at = CGContextGetCTM(gc);
if (at.a == at.d && at.b == 0 && at.c == 0) { // proportional scaling, no rotation
// We handle x2 and /2 scalings that occur when drawing to
// a double-resolution bitmap, and when drawing a double-resolution bitmap to display.
@@ -345,10 +345,10 @@ void Fl_Quartz_Graphics_Driver::draw_CGImage(CGImageRef cgimg, int x, int y, int
deltay = (at.ty - round(at.ty))*2;
}
}
- if (doit) CGContextTranslateCTM(fl_gc, -deltax, -deltay);
+ if (doit) CGContextTranslateCTM(gc, -deltax, -deltay);
}
- CGContextDrawImage(fl_gc, CGRectMake(0, 0, sw, sh), cgimg);
- CGContextRestoreGState(fl_gc);
+ CGContextDrawImage(gc, CGRectMake(0, 0, sw, sh), cgimg);
+ CGContextRestoreGState(gc);
}
//
diff --git a/src/drivers/Quartz/Fl_Quartz_Graphics_Driver_line_style.cxx b/src/drivers/Quartz/Fl_Quartz_Graphics_Driver_line_style.cxx
index b30743a1a..9231b0581 100644
--- a/src/drivers/Quartz/Fl_Quartz_Graphics_Driver_line_style.cxx
+++ b/src/drivers/Quartz/Fl_Quartz_Graphics_Driver_line_style.cxx
@@ -36,11 +36,11 @@ static /*enum*/ CGLineJoin fl_quartz_line_join_ = kCGLineJoinMiter;
static CGFloat *fl_quartz_line_pattern = 0;
static int fl_quartz_line_pattern_size = 0;
-void fl_quartz_restore_line_style_() {
- CGContextSetLineWidth(fl_gc, fl_quartz_line_width_);
- CGContextSetLineCap(fl_gc, fl_quartz_line_cap_);
- CGContextSetLineJoin(fl_gc, fl_quartz_line_join_);
- CGContextSetLineDash(fl_gc, 0, fl_quartz_line_pattern, fl_quartz_line_pattern_size);
+void fl_quartz_restore_line_style_(CGContextRef gc) {
+ CGContextSetLineWidth(gc, fl_quartz_line_width_);
+ CGContextSetLineCap(gc, fl_quartz_line_cap_);
+ CGContextSetLineJoin(gc, fl_quartz_line_join_);
+ CGContextSetLineDash(gc, 0, fl_quartz_line_pattern, fl_quartz_line_pattern_size);
}
void Fl_Quartz_Graphics_Driver::line_style(int style, int width, char* dashes) {
@@ -94,7 +94,7 @@ void Fl_Quartz_Graphics_Driver::line_style(int style, int width, char* dashes) {
fl_quartz_line_pattern = 0;
fl_quartz_line_pattern_size = 0;
}
- fl_quartz_restore_line_style_();
+ fl_quartz_restore_line_style_((CGContextRef)get_gc());
}
#endif // FL_CFG_GFX_QUARTZ
diff --git a/src/drivers/Quartz/Fl_Quartz_Graphics_Driver_rect.cxx b/src/drivers/Quartz/Fl_Quartz_Graphics_Driver_rect.cxx
index debf15606..e641767d4 100644
--- a/src/drivers/Quartz/Fl_Quartz_Graphics_Driver_rect.cxx
+++ b/src/drivers/Quartz/Fl_Quartz_Graphics_Driver_rect.cxx
@@ -38,162 +38,162 @@ extern float fl_quartz_line_width_;
// --- line and polygon drawing with integer coordinates
void Fl_Quartz_Graphics_Driver::point(int x, int y) {
- CGContextFillRect(fl_gc, CGRectMake(x - 0.5, y - 0.5, 1, 1) );
+ CGContextFillRect(gc, CGRectMake(x - 0.5, y - 0.5, 1, 1) );
}
void Fl_Quartz_Graphics_Driver::rect(int x, int y, int w, int h) {
if (w<=0 || h<=0) return;
- if ( (!has_feature(PRINTER)) && fl_quartz_line_width_ > 1.5f) CGContextSetShouldAntialias(fl_gc, true);
+ if ( (!has_feature(PRINTER)) && fl_quartz_line_width_ > 1.5f) CGContextSetShouldAntialias(gc, true);
CGRect rect = CGRectMake(x, y, w-1, h-1);
- CGContextStrokeRect(fl_gc, rect);
- if ( (!has_feature(PRINTER)) && fl_quartz_line_width_ > 1.5f) CGContextSetShouldAntialias(fl_gc, false);
+ CGContextStrokeRect(gc, rect);
+ if ( (!has_feature(PRINTER)) && fl_quartz_line_width_ > 1.5f) CGContextSetShouldAntialias(gc, false);
}
void Fl_Quartz_Graphics_Driver::rectf(int x, int y, int w, int h) {
if (w<=0 || h<=0) return;
CGRect rect = CGRectMake(x - 0.5, y - 0.5, w , h);
- CGContextFillRect(fl_gc, rect);
+ CGContextFillRect(gc, rect);
}
void Fl_Quartz_Graphics_Driver::line(int x, int y, int x1, int y1) {
- if (fl_quartz_line_width_ > 1.5f) CGContextSetShouldAntialias(fl_gc, true);
- CGContextMoveToPoint(fl_gc, x, y);
- CGContextAddLineToPoint(fl_gc, x1, y1);
- CGContextStrokePath(fl_gc);
- if (fl_quartz_line_width_ > 1.5f) CGContextSetShouldAntialias(fl_gc, false);
+ if (fl_quartz_line_width_ > 1.5f) CGContextSetShouldAntialias(gc, true);
+ CGContextMoveToPoint(gc, x, y);
+ CGContextAddLineToPoint(gc, x1, y1);
+ CGContextStrokePath(gc);
+ if (fl_quartz_line_width_ > 1.5f) CGContextSetShouldAntialias(gc, false);
}
void Fl_Quartz_Graphics_Driver::line(int x, int y, int x1, int y1, int x2, int y2) {
- if (fl_quartz_line_width_ > 1.5f) CGContextSetShouldAntialias(fl_gc, true);
- CGContextMoveToPoint(fl_gc, x, y);
- CGContextAddLineToPoint(fl_gc, x1, y1);
- CGContextAddLineToPoint(fl_gc, x2, y2);
- CGContextStrokePath(fl_gc);
- if (fl_quartz_line_width_ > 1.5f) CGContextSetShouldAntialias(fl_gc, false);
+ if (fl_quartz_line_width_ > 1.5f) CGContextSetShouldAntialias(gc, true);
+ CGContextMoveToPoint(gc, x, y);
+ CGContextAddLineToPoint(gc, x1, y1);
+ CGContextAddLineToPoint(gc, x2, y2);
+ CGContextStrokePath(gc);
+ if (fl_quartz_line_width_ > 1.5f) CGContextSetShouldAntialias(gc, false);
}
void Fl_Quartz_Graphics_Driver::xyline(int x, int y, int x1) {
- if (has_feature(PRINTER) || fl_quartz_line_width_ > 1.5f) CGContextSetShouldAntialias(fl_gc, true);
- CGContextMoveToPoint(fl_gc, x, y);
- CGContextAddLineToPoint(fl_gc, x1, y);
- CGContextStrokePath(fl_gc);
+ if (has_feature(PRINTER) || fl_quartz_line_width_ > 1.5f) CGContextSetShouldAntialias(gc, true);
+ CGContextMoveToPoint(gc, x, y);
+ CGContextAddLineToPoint(gc, x1, y);
+ CGContextStrokePath(gc);
if (Fl_Display_Device::high_resolution()) {
/* On retina displays, all xyline() and yxline() functions produce lines that are half-unit
(or one pixel) too short at both ends. This is corrected by filling at both ends rectangles
of size one unit by line-width.
*/
- CGContextFillRect(fl_gc, CGRectMake(x-0.5 , y - fl_quartz_line_width_/2, 1 , fl_quartz_line_width_));
- CGContextFillRect(fl_gc, CGRectMake(x1-0.5 , y - fl_quartz_line_width_/2, 1 , fl_quartz_line_width_));
+ CGContextFillRect(gc, CGRectMake(x-0.5 , y - fl_quartz_line_width_/2, 1 , fl_quartz_line_width_));
+ CGContextFillRect(gc, CGRectMake(x1-0.5 , y - fl_quartz_line_width_/2, 1 , fl_quartz_line_width_));
}
- if (has_feature(PRINTER) || fl_quartz_line_width_ > 1.5f) CGContextSetShouldAntialias(fl_gc, false);
+ if (has_feature(PRINTER) || fl_quartz_line_width_ > 1.5f) CGContextSetShouldAntialias(gc, false);
}
void Fl_Quartz_Graphics_Driver::xyline(int x, int y, int x1, int y2) {
- if (has_feature(PRINTER) || fl_quartz_line_width_ > 1.5f) CGContextSetShouldAntialias(fl_gc, true);
- CGContextMoveToPoint(fl_gc, x, y);
- CGContextAddLineToPoint(fl_gc, x1, y);
- CGContextAddLineToPoint(fl_gc, x1, y2);
- CGContextStrokePath(fl_gc);
+ if (has_feature(PRINTER) || fl_quartz_line_width_ > 1.5f) CGContextSetShouldAntialias(gc, true);
+ CGContextMoveToPoint(gc, x, y);
+ CGContextAddLineToPoint(gc, x1, y);
+ CGContextAddLineToPoint(gc, x1, y2);
+ CGContextStrokePath(gc);
if (Fl_Display_Device::high_resolution()) {
- CGContextFillRect(fl_gc, CGRectMake(x-0.5, y - fl_quartz_line_width_/2, 1 , fl_quartz_line_width_));
- CGContextFillRect(fl_gc, CGRectMake(x1 - fl_quartz_line_width_/2, y2-0.5, fl_quartz_line_width_, 1));
+ CGContextFillRect(gc, CGRectMake(x-0.5, y - fl_quartz_line_width_/2, 1 , fl_quartz_line_width_));
+ CGContextFillRect(gc, CGRectMake(x1 - fl_quartz_line_width_/2, y2-0.5, fl_quartz_line_width_, 1));
}
- if (has_feature(PRINTER) || fl_quartz_line_width_ > 1.5f) CGContextSetShouldAntialias(fl_gc, false);
+ if (has_feature(PRINTER) || fl_quartz_line_width_ > 1.5f) CGContextSetShouldAntialias(gc, false);
}
void Fl_Quartz_Graphics_Driver::xyline(int x, int y, int x1, int y2, int x3) {
- if (has_feature(PRINTER) || fl_quartz_line_width_ > 1.5f) CGContextSetShouldAntialias(fl_gc, true);
- CGContextMoveToPoint(fl_gc, x, y);
- CGContextAddLineToPoint(fl_gc, x1, y);
- CGContextAddLineToPoint(fl_gc, x1, y2);
- CGContextAddLineToPoint(fl_gc, x3, y2);
- CGContextStrokePath(fl_gc);
+ if (has_feature(PRINTER) || fl_quartz_line_width_ > 1.5f) CGContextSetShouldAntialias(gc, true);
+ CGContextMoveToPoint(gc, x, y);
+ CGContextAddLineToPoint(gc, x1, y);
+ CGContextAddLineToPoint(gc, x1, y2);
+ CGContextAddLineToPoint(gc, x3, y2);
+ CGContextStrokePath(gc);
if (Fl_Display_Device::high_resolution()) {
- CGContextFillRect(fl_gc, CGRectMake(x-0.5, y - fl_quartz_line_width_/2, 1 , fl_quartz_line_width_));
- CGContextFillRect(fl_gc, CGRectMake(x3-0.5, y2 - fl_quartz_line_width_/2, 1 , fl_quartz_line_width_));
+ CGContextFillRect(gc, CGRectMake(x-0.5, y - fl_quartz_line_width_/2, 1 , fl_quartz_line_width_));
+ CGContextFillRect(gc, CGRectMake(x3-0.5, y2 - fl_quartz_line_width_/2, 1 , fl_quartz_line_width_));
}
- if (has_feature(PRINTER) || fl_quartz_line_width_ > 1.5f) CGContextSetShouldAntialias(fl_gc, false);
+ if (has_feature(PRINTER) || fl_quartz_line_width_ > 1.5f) CGContextSetShouldAntialias(gc, false);
}
void Fl_Quartz_Graphics_Driver::yxline(int x, int y, int y1) {
- if (has_feature(PRINTER) || fl_quartz_line_width_ > 1.5f) CGContextSetShouldAntialias(fl_gc, true);
- CGContextMoveToPoint(fl_gc, x, y);
- CGContextAddLineToPoint(fl_gc, x, y1);
- CGContextStrokePath(fl_gc);
+ if (has_feature(PRINTER) || fl_quartz_line_width_ > 1.5f) CGContextSetShouldAntialias(gc, true);
+ CGContextMoveToPoint(gc, x, y);
+ CGContextAddLineToPoint(gc, x, y1);
+ CGContextStrokePath(gc);
if (Fl_Display_Device::high_resolution()) {
- CGContextFillRect(fl_gc, CGRectMake(x - fl_quartz_line_width_/2, y-0.5, fl_quartz_line_width_, 1));
- CGContextFillRect(fl_gc, CGRectMake(x - fl_quartz_line_width_/2, y1-0.5, fl_quartz_line_width_, 1));
+ CGContextFillRect(gc, CGRectMake(x - fl_quartz_line_width_/2, y-0.5, fl_quartz_line_width_, 1));
+ CGContextFillRect(gc, CGRectMake(x - fl_quartz_line_width_/2, y1-0.5, fl_quartz_line_width_, 1));
}
- if (has_feature(PRINTER) || fl_quartz_line_width_ > 1.5f) CGContextSetShouldAntialias(fl_gc, false);
+ if (has_feature(PRINTER) || fl_quartz_line_width_ > 1.5f) CGContextSetShouldAntialias(gc, false);
}
void Fl_Quartz_Graphics_Driver::yxline(int x, int y, int y1, int x2) {
- if (has_feature(PRINTER) || fl_quartz_line_width_ > 1.5f) CGContextSetShouldAntialias(fl_gc, true);
- CGContextMoveToPoint(fl_gc, x, y);
- CGContextAddLineToPoint(fl_gc, x, y1);
- CGContextAddLineToPoint(fl_gc, x2, y1);
- CGContextStrokePath(fl_gc);
+ if (has_feature(PRINTER) || fl_quartz_line_width_ > 1.5f) CGContextSetShouldAntialias(gc, true);
+ CGContextMoveToPoint(gc, x, y);
+ CGContextAddLineToPoint(gc, x, y1);
+ CGContextAddLineToPoint(gc, x2, y1);
+ CGContextStrokePath(gc);
if (Fl_Display_Device::high_resolution()) {
- CGContextFillRect(fl_gc, CGRectMake(x - fl_quartz_line_width_/2, y-0.5, fl_quartz_line_width_, 1));
- CGContextFillRect(fl_gc, CGRectMake(x2-0.5, y1 - fl_quartz_line_width_/2, 1 , fl_quartz_line_width_));
+ CGContextFillRect(gc, CGRectMake(x - fl_quartz_line_width_/2, y-0.5, fl_quartz_line_width_, 1));
+ CGContextFillRect(gc, CGRectMake(x2-0.5, y1 - fl_quartz_line_width_/2, 1 , fl_quartz_line_width_));
}
- if (has_feature(PRINTER) || fl_quartz_line_width_ > 1.5f) CGContextSetShouldAntialias(fl_gc, false);
+ if (has_feature(PRINTER) || fl_quartz_line_width_ > 1.5f) CGContextSetShouldAntialias(gc, false);
}
void Fl_Quartz_Graphics_Driver::yxline(int x, int y, int y1, int x2, int y3) {
- if (has_feature(PRINTER) || fl_quartz_line_width_ > 1.5f) CGContextSetShouldAntialias(fl_gc, true);
- CGContextMoveToPoint(fl_gc, x, y);
- CGContextAddLineToPoint(fl_gc, x, y1);
- CGContextAddLineToPoint(fl_gc, x2, y1);
- CGContextAddLineToPoint(fl_gc, x2, y3);
- CGContextStrokePath(fl_gc);
+ if (has_feature(PRINTER) || fl_quartz_line_width_ > 1.5f) CGContextSetShouldAntialias(gc, true);
+ CGContextMoveToPoint(gc, x, y);
+ CGContextAddLineToPoint(gc, x, y1);
+ CGContextAddLineToPoint(gc, x2, y1);
+ CGContextAddLineToPoint(gc, x2, y3);
+ CGContextStrokePath(gc);
if (Fl_Display_Device::high_resolution()) {
- CGContextFillRect(fl_gc, CGRectMake(x - fl_quartz_line_width_/2, y-0.5, fl_quartz_line_width_, 1));
- CGContextFillRect(fl_gc, CGRectMake(x2 - fl_quartz_line_width_/2, y3-0.5, fl_quartz_line_width_, 1));
+ CGContextFillRect(gc, CGRectMake(x - fl_quartz_line_width_/2, y-0.5, fl_quartz_line_width_, 1));
+ CGContextFillRect(gc, CGRectMake(x2 - fl_quartz_line_width_/2, y3-0.5, fl_quartz_line_width_, 1));
}
- if (has_feature(PRINTER) || fl_quartz_line_width_ > 1.5f) CGContextSetShouldAntialias(fl_gc, false);
+ if (has_feature(PRINTER) || fl_quartz_line_width_ > 1.5f) CGContextSetShouldAntialias(gc, false);
}
void Fl_Quartz_Graphics_Driver::loop(int x, int y, int x1, int y1, int x2, int y2) {
- CGContextSetShouldAntialias(fl_gc, true);
- CGContextMoveToPoint(fl_gc, x, y);
- CGContextAddLineToPoint(fl_gc, x1, y1);
- CGContextAddLineToPoint(fl_gc, x2, y2);
- CGContextClosePath(fl_gc);
- CGContextStrokePath(fl_gc);
- CGContextSetShouldAntialias(fl_gc, false);
+ CGContextSetShouldAntialias(gc, true);
+ CGContextMoveToPoint(gc, x, y);
+ CGContextAddLineToPoint(gc, x1, y1);
+ CGContextAddLineToPoint(gc, x2, y2);
+ CGContextClosePath(gc);
+ CGContextStrokePath(gc);
+ CGContextSetShouldAntialias(gc, false);
}
void Fl_Quartz_Graphics_Driver::loop(int x, int y, int x1, int y1, int x2, int y2, int x3, int y3) {
- CGContextSetShouldAntialias(fl_gc, true);
- CGContextMoveToPoint(fl_gc, x, y);
- CGContextAddLineToPoint(fl_gc, x1, y1);
- CGContextAddLineToPoint(fl_gc, x2, y2);
- CGContextAddLineToPoint(fl_gc, x3, y3);
- CGContextClosePath(fl_gc);
- CGContextStrokePath(fl_gc);
- CGContextSetShouldAntialias(fl_gc, false);
+ CGContextSetShouldAntialias(gc, true);
+ CGContextMoveToPoint(gc, x, y);
+ CGContextAddLineToPoint(gc, x1, y1);
+ CGContextAddLineToPoint(gc, x2, y2);
+ CGContextAddLineToPoint(gc, x3, y3);
+ CGContextClosePath(gc);
+ CGContextStrokePath(gc);
+ CGContextSetShouldAntialias(gc, false);
}
void Fl_Quartz_Graphics_Driver::polygon(int x, int y, int x1, int y1, int x2, int y2) {
- CGContextSetShouldAntialias(fl_gc, true);
- CGContextMoveToPoint(fl_gc, x, y);
- CGContextAddLineToPoint(fl_gc, x1, y1);
- CGContextAddLineToPoint(fl_gc, x2, y2);
- CGContextClosePath(fl_gc);
- CGContextFillPath(fl_gc);
- CGContextSetShouldAntialias(fl_gc, false);
+ CGContextSetShouldAntialias(gc, true);
+ CGContextMoveToPoint(gc, x, y);
+ CGContextAddLineToPoint(gc, x1, y1);
+ CGContextAddLineToPoint(gc, x2, y2);
+ CGContextClosePath(gc);
+ CGContextFillPath(gc);
+ CGContextSetShouldAntialias(gc, false);
}
void Fl_Quartz_Graphics_Driver::polygon(int x, int y, int x1, int y1, int x2, int y2, int x3, int y3) {
- CGContextSetShouldAntialias(fl_gc, true);
- CGContextMoveToPoint(fl_gc, x, y);
- CGContextAddLineToPoint(fl_gc, x1, y1);
- CGContextAddLineToPoint(fl_gc, x2, y2);
- CGContextAddLineToPoint(fl_gc, x3, y3);
- CGContextClosePath(fl_gc);
- CGContextFillPath(fl_gc);
- CGContextSetShouldAntialias(fl_gc, false);
+ CGContextSetShouldAntialias(gc, true);
+ CGContextMoveToPoint(gc, x, y);
+ CGContextAddLineToPoint(gc, x1, y1);
+ CGContextAddLineToPoint(gc, x2, y2);
+ CGContextAddLineToPoint(gc, x3, y3);
+ CGContextClosePath(gc);
+ CGContextFillPath(gc);
+ CGContextSetShouldAntialias(gc, false);
}
// --- clipping
@@ -265,34 +265,34 @@ 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_();
+// helper function to manage the current CGContext gc
+extern void fl_quartz_restore_line_style_(CGContextRef gc);
void Fl_Quartz_Graphics_Driver::restore_clip() {
fl_clip_state_number++;
Fl_Region r = rstack[rstackptr];
- if ( fl_window || fl_gc ) { // clipping for a true window or an offscreen buffer
- if (fl_gc) {
- CGContextRestoreGState(fl_gc);
- CGContextSaveGState(fl_gc);
+ if ( fl_window || gc ) { // clipping for a true window or an offscreen buffer
+ if (gc) {
+ CGContextRestoreGState(gc);
+ CGContextSaveGState(gc);
}
// 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);
+ CGFloat hgt = CGBitmapContextGetHeight(gc);
+ CGAffineTransform at = CGContextGetCTM(gc);
CGFloat offset = 0.5;
if (at.a != 1 && at.a == at.d && at.b == 0 && at.c == 0) { // proportional scaling, no rotation
hgt /= at.a;
offset /= at.a;
}
- CGContextTranslateCTM(fl_gc, offset, hgt-offset);
- CGContextScaleCTM(fl_gc, 1.0f, -1.0f); // now 0,0 is top-left point of the context
+ CGContextTranslateCTM(gc, offset, hgt-offset);
+ CGContextScaleCTM(gc, 1.0f, -1.0f); // now 0,0 is top-left point of the context
}
color(color());
- fl_quartz_restore_line_style_();
+ fl_quartz_restore_line_style_(gc);
if (r) { //apply program clip
- CGContextClipToRects(fl_gc, r->rects, r->count);
+ CGContextClipToRects(gc, r->rects, r->count);
}
}
}
diff --git a/src/drivers/Quartz/Fl_Quartz_Graphics_Driver_vertex.cxx b/src/drivers/Quartz/Fl_Quartz_Graphics_Driver_vertex.cxx
index ad6977e12..6400c5056 100644
--- a/src/drivers/Quartz/Fl_Quartz_Graphics_Driver_vertex.cxx
+++ b/src/drivers/Quartz/Fl_Quartz_Graphics_Driver_vertex.cxx
@@ -41,13 +41,13 @@ void Fl_Quartz_Graphics_Driver::vertex(double x,double y) {
}
void Fl_Quartz_Graphics_Driver::end_points() {
- if (fl_quartz_line_width_ > 1.5f) CGContextSetShouldAntialias(fl_gc, true);
+ if (fl_quartz_line_width_ > 1.5f) CGContextSetShouldAntialias(gc, true);
for (int i=0; i<n; i++) {
- CGContextMoveToPoint(fl_gc, p[i].x, p[i].y);
- CGContextAddLineToPoint(fl_gc, p[i].x, p[i].y);
- CGContextStrokePath(fl_gc);
+ CGContextMoveToPoint(gc, p[i].x, p[i].y);
+ CGContextAddLineToPoint(gc, p[i].x, p[i].y);
+ CGContextStrokePath(gc);
}
- if (fl_quartz_line_width_ > 1.5f) CGContextSetShouldAntialias(fl_gc, false);
+ if (fl_quartz_line_width_ > 1.5f) CGContextSetShouldAntialias(gc, false);
}
void Fl_Quartz_Graphics_Driver::end_line() {
@@ -56,12 +56,12 @@ void Fl_Quartz_Graphics_Driver::end_line() {
return;
}
if (n<=1) return;
- CGContextSetShouldAntialias(fl_gc, true);
- CGContextMoveToPoint(fl_gc, p[0].x, p[0].y);
+ CGContextSetShouldAntialias(gc, true);
+ CGContextMoveToPoint(gc, p[0].x, p[0].y);
for (int i=1; i<n; i++)
- CGContextAddLineToPoint(fl_gc, p[i].x, p[i].y);
- CGContextStrokePath(fl_gc);
- CGContextSetShouldAntialias(fl_gc, false);
+ CGContextAddLineToPoint(gc, p[i].x, p[i].y);
+ CGContextStrokePath(gc);
+ CGContextSetShouldAntialias(gc, false);
}
void Fl_Quartz_Graphics_Driver::end_loop() {
@@ -77,13 +77,13 @@ void Fl_Quartz_Graphics_Driver::end_polygon() {
return;
}
if (n<=1) return;
- CGContextSetShouldAntialias(fl_gc, true);
- CGContextMoveToPoint(fl_gc, p[0].x, p[0].y);
+ CGContextSetShouldAntialias(gc, true);
+ CGContextMoveToPoint(gc, p[0].x, p[0].y);
for (int i=1; i<n; i++)
- CGContextAddLineToPoint(fl_gc, p[i].x, p[i].y);
- CGContextClosePath(fl_gc);
- CGContextFillPath(fl_gc);
- CGContextSetShouldAntialias(fl_gc, false);
+ CGContextAddLineToPoint(gc, p[i].x, p[i].y);
+ CGContextClosePath(gc);
+ CGContextFillPath(gc);
+ CGContextSetShouldAntialias(gc, false);
}
void Fl_Quartz_Graphics_Driver::begin_complex_polygon() {
@@ -108,13 +108,13 @@ void Fl_Quartz_Graphics_Driver::end_complex_polygon() {
return;
}
if (n<=1) return;
- CGContextSetShouldAntialias(fl_gc, true);
- CGContextMoveToPoint(fl_gc, p[0].x, p[0].y);
+ CGContextSetShouldAntialias(gc, true);
+ CGContextMoveToPoint(gc, p[0].x, p[0].y);
for (int i=1; i<n; i++)
- CGContextAddLineToPoint(fl_gc, p[i].x, p[i].y);
- CGContextClosePath(fl_gc);
- CGContextFillPath(fl_gc);
- CGContextSetShouldAntialias(fl_gc, false);
+ CGContextAddLineToPoint(gc, p[i].x, p[i].y);
+ CGContextClosePath(gc);
+ CGContextFillPath(gc);
+ CGContextSetShouldAntialias(gc, false);
}
void Fl_Quartz_Graphics_Driver::circle(double x, double y,double r) {
@@ -129,10 +129,10 @@ void Fl_Quartz_Graphics_Driver::circle(double x, double y,double r) {
// Quartz warning: circle won't scale to current matrix!
// Last argument must be 0 (counter-clockwise) or it draws nothing under __LP64__ !!!!
- CGContextSetShouldAntialias(fl_gc, true);
- CGContextAddArc(fl_gc, xt, yt, (w+h)*0.25f, 0, 2.0f*M_PI, 0);
- (what == POLYGON ? CGContextFillPath : CGContextStrokePath)(fl_gc);
- CGContextSetShouldAntialias(fl_gc, false);
+ CGContextSetShouldAntialias(gc, true);
+ CGContextAddArc(gc, xt, yt, (w+h)*0.25f, 0, 2.0f*M_PI, 0);
+ (what == POLYGON ? CGContextFillPath : CGContextStrokePath)(gc);
+ CGContextSetShouldAntialias(gc, false);
}
#endif // FL_CFG_GFX_QUARTZ