diff options
| author | Manolo Gouy <Manolo> | 2016-02-13 06:25:34 +0000 |
|---|---|---|
| committer | Manolo Gouy <Manolo> | 2016-02-13 06:25:34 +0000 |
| commit | 8deac1e6baf7a016aabd3b6cb5ccffd7f09263cd (patch) | |
| tree | 5840c10cce714610c4590a45905b2f2e4c040bd0 | |
| parent | df0b1dcb07b551a93868d8bd7942232dc4d6d0a8 (diff) | |
Simpler code to support drawing to high-resolution Fl_Image_Surface object.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11162 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
| -rw-r--r-- | src/Fl_Image_Surface.cxx | 21 | ||||
| -rw-r--r-- | src/Fl_cocoa.mm | 8 |
2 files changed, 6 insertions, 23 deletions
diff --git a/src/Fl_Image_Surface.cxx b/src/Fl_Image_Surface.cxx index ff4f923a2..3385d2e25 100644 --- a/src/Fl_Image_Surface.cxx +++ b/src/Fl_Image_Surface.cxx @@ -32,25 +32,6 @@ #else #endif -#ifdef __APPLE__ -class Fl_Quartz_Scaled_Graphics_Driver_ : public Fl_Quartz_Graphics_Driver { -protected: - virtual void push_clip(int x, int y, int w, int h) { - push_no_clip(); - CGContextClipToRect(fl_gc, CGRectMake(x, y, w, h)); - } - virtual void push_no_clip() { - CGContextRestoreGState(fl_gc); - CGContextSaveGState(fl_gc); - CGContextTranslateCTM(fl_gc, 0, CGBitmapContextGetHeight(fl_gc)/2); - CGContextScaleCTM(fl_gc, 1.0f, -1.0f); - } - virtual void pop_clip() { - push_no_clip(); - } -}; -#endif - const char *Fl_Image_Surface::class_id = "Fl_Image_Surface"; /** Constructor with optional high resolution. @@ -68,8 +49,6 @@ Fl_Image_Surface::Fl_Image_Surface(int w, int h, int highres) : Fl_Surface_Devic offscreen = fl_create_offscreen(highres ? 2*w : w, highres ? 2*h : h); helper = new Fl_Quartz_Flipped_Surface_(width, height); if (highres) { - delete helper->driver(); - helper->driver(new Fl_Quartz_Scaled_Graphics_Driver_); CGContextScaleCTM(offscreen, 2, 2); } driver(helper->driver()); diff --git a/src/Fl_cocoa.mm b/src/Fl_cocoa.mm index 66830ab54..938771ea4 100644 --- a/src/Fl_cocoa.mm +++ b/src/Fl_cocoa.mm @@ -3310,10 +3310,14 @@ extern void fl_quartz_restore_line_style_(); void Fl_X::q_fill_context() { if (!fl_gc) return; if ( ! fl_window) { // a bitmap context - size_t hgt = CGBitmapContextGetHeight(fl_gc); + 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_(); } |
