diff options
| author | Manolo Gouy <Manolo> | 2016-02-12 21:15:48 +0000 |
|---|---|---|
| committer | Manolo Gouy <Manolo> | 2016-02-12 21:15:48 +0000 |
| commit | df0b1dcb07b551a93868d8bd7942232dc4d6d0a8 (patch) | |
| tree | bdb6de990ea01fa31e2f2bb13635a4cc4ac1e6a3 /src | |
| parent | bf7c25a1d72b28b6b19a1ac54492be539cb75552 (diff) | |
Fl_Window::capture_titlebar_and_borders() returns a double-resolution top image.
Also, Fl_Image_Surface now can draw a scaled Fl_Shared_Image to
a double-resolution surface.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11160 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src')
| -rw-r--r-- | src/Fl_Image_Surface.cxx | 10 | ||||
| -rw-r--r-- | src/Fl_cocoa.mm | 12 |
2 files changed, 12 insertions, 10 deletions
diff --git a/src/Fl_Image_Surface.cxx b/src/Fl_Image_Surface.cxx index 6800c4e09..ff4f923a2 100644 --- a/src/Fl_Image_Surface.cxx +++ b/src/Fl_Image_Surface.cxx @@ -36,18 +36,18 @@ class Fl_Quartz_Scaled_Graphics_Driver_ : public Fl_Quartz_Graphics_Driver { protected: virtual void push_clip(int x, int y, int w, int h) { - CGContextRestoreGState(fl_gc); - CGContextSaveGState(fl_gc); - CGContextTranslateCTM(fl_gc, 0, CGBitmapContextGetHeight(fl_gc)/2); - CGContextScaleCTM(fl_gc, 1.0f, -1.0f); + push_no_clip(); CGContextClipToRect(fl_gc, CGRectMake(x, y, w, h)); } - virtual void pop_clip() { + 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 diff --git a/src/Fl_cocoa.mm b/src/Fl_cocoa.mm index 8a951adeb..66830ab54 100644 --- a/src/Fl_cocoa.mm +++ b/src/Fl_cocoa.mm @@ -4407,9 +4407,10 @@ void Fl_Window::capture_titlebar_and_borders(Fl_Shared_Image*& top, Fl_Shared_Im int htop = decorated_h() - h(); CALayer *layer = get_titlebar_layer(this); CGColorSpaceRef cspace = CGColorSpaceCreateDeviceRGB(); - uchar *rgba = new uchar[4 * w() * htop]; - CGContextRef auxgc = CGBitmapContextCreate(rgba, w(), htop, 8, 4 * w(), cspace, kCGImageAlphaPremultipliedLast); + uchar *rgba = new uchar[4 * w() * htop * 4]; + CGContextRef auxgc = CGBitmapContextCreate(rgba, 2 * w(), 2 * htop, 8, 8 * w(), cspace, kCGImageAlphaPremultipliedLast); CGColorSpaceRelease(cspace); + CGContextScaleCTM(auxgc, 2, 2); if (layer) { draw_layer_to_context(layer, auxgc, w(), htop); } else { @@ -4420,9 +4421,10 @@ void Fl_Window::capture_titlebar_and_borders(Fl_Shared_Image*& top, Fl_Shared_Im CGContextRestoreGState(auxgc); CFRelease(img); } - Fl_RGB_Image *toprgb = new Fl_RGB_Image(rgba, w(), htop, 4); - toprgb->alloc_array = 1; - top = Fl_Shared_Image::get(toprgb); + Fl_RGB_Image *top_rgb = new Fl_RGB_Image(rgba, 2 * w(), 2 * htop, 4); + top_rgb->alloc_array = 1; + top = Fl_Shared_Image::get(top_rgb); + top->scale(w(),htop); CGContextRelease(auxgc); } |
