diff options
| author | Manolo Gouy <Manolo> | 2016-02-19 12:40:24 +0000 |
|---|---|---|
| committer | Manolo Gouy <Manolo> | 2016-02-19 12:40:24 +0000 |
| commit | 1b5e231c902ab198c577989db44946797ebd4893 (patch) | |
| tree | 211751e0eceda308df4e51d94511362f5e0b55f6 /src/drivers/Quartz/Fl_Quartz_Graphics_Driver_rect.cxx | |
| parent | 6d766cc6814a9e7a04c0b147c7a3cbdc0817dfd4 (diff) | |
Rename Fl_Graphics_Driver::set_gc(void*) to gc(void*) and Fl_Graphics_Driver::get_gc() to gc().
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11191 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src/drivers/Quartz/Fl_Quartz_Graphics_Driver_rect.cxx')
| -rw-r--r-- | src/drivers/Quartz/Fl_Quartz_Graphics_Driver_rect.cxx | 208 |
1 files changed, 104 insertions, 104 deletions
diff --git a/src/drivers/Quartz/Fl_Quartz_Graphics_Driver_rect.cxx b/src/drivers/Quartz/Fl_Quartz_Graphics_Driver_rect.cxx index e641767d4..277abfdfb 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(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(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(gc, rect); - if ( (!has_feature(PRINTER)) && fl_quartz_line_width_ > 1.5f) CGContextSetShouldAntialias(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(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(gc, true); - CGContextMoveToPoint(gc, x, y); - CGContextAddLineToPoint(gc, x1, y1); - CGContextStrokePath(gc); - if (fl_quartz_line_width_ > 1.5f) CGContextSetShouldAntialias(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(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); + 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(gc, true); - CGContextMoveToPoint(gc, x, y); - CGContextAddLineToPoint(gc, x1, y); - CGContextStrokePath(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(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_)); + 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(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(gc, true); - CGContextMoveToPoint(gc, x, y); - CGContextAddLineToPoint(gc, x1, y); - CGContextAddLineToPoint(gc, x1, y2); - CGContextStrokePath(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(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)); + 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(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(gc, true); - CGContextMoveToPoint(gc, x, y); - CGContextAddLineToPoint(gc, x1, y); - CGContextAddLineToPoint(gc, x1, y2); - CGContextAddLineToPoint(gc, x3, y2); - CGContextStrokePath(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(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_)); + 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(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(gc, true); - CGContextMoveToPoint(gc, x, y); - CGContextAddLineToPoint(gc, x, y1); - CGContextStrokePath(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(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)); + 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(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(gc, true); - CGContextMoveToPoint(gc, x, y); - CGContextAddLineToPoint(gc, x, y1); - CGContextAddLineToPoint(gc, x2, y1); - CGContextStrokePath(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(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_)); + 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(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(gc, true); - CGContextMoveToPoint(gc, x, y); - CGContextAddLineToPoint(gc, x, y1); - CGContextAddLineToPoint(gc, x2, y1); - CGContextAddLineToPoint(gc, x2, y3); - CGContextStrokePath(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(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)); + 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(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(gc, true); - CGContextMoveToPoint(gc, x, y); - CGContextAddLineToPoint(gc, x1, y1); - CGContextAddLineToPoint(gc, x2, y2); - CGContextClosePath(gc); - CGContextStrokePath(gc); - CGContextSetShouldAntialias(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(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); + 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(gc, true); - CGContextMoveToPoint(gc, x, y); - CGContextAddLineToPoint(gc, x1, y1); - CGContextAddLineToPoint(gc, x2, y2); - CGContextClosePath(gc); - CGContextFillPath(gc); - CGContextSetShouldAntialias(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(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); + 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 @@ -271,28 +271,28 @@ 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 || gc ) { // clipping for a true window or an offscreen buffer - if (gc) { - CGContextRestoreGState(gc); - CGContextSaveGState(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(gc); - CGAffineTransform at = CGContextGetCTM(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(gc, offset, hgt-offset); - CGContextScaleCTM(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_(gc); + fl_quartz_restore_line_style_(gc_); if (r) { //apply program clip - CGContextClipToRects(gc, r->rects, r->count); + CGContextClipToRects(gc_, r->rects, r->count); } } } |
