summaryrefslogtreecommitdiff
path: root/src/Fl_cocoa.mm
diff options
context:
space:
mode:
authorManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>2019-05-20 13:16:31 +0200
committerManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>2019-05-20 13:16:31 +0200
commit159572785df885ef33663040af920e02a7950749 (patch)
tree3900d8f6b8891800b598afaba414afeeffec94e7 /src/Fl_cocoa.mm
parent357dad1e519fdd39f3af2d07fff4d70415ceec8a (diff)
Remove small duplication of code
Diffstat (limited to 'src/Fl_cocoa.mm')
-rw-r--r--src/Fl_cocoa.mm8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/Fl_cocoa.mm b/src/Fl_cocoa.mm
index d6767ebe8..f1f3d795e 100644
--- a/src/Fl_cocoa.mm
+++ b/src/Fl_cocoa.mm
@@ -4228,9 +4228,9 @@ static NSBitmapImageRep* rect_to_NSBitmapImageRep_layer(Fl_Window *win, int x, i
CGContextRef gc = ((FLViewLayer*)[fl_xid(win) contentView])->layer_data;
if (!gc) return nil;
CGImageRef cgimg = CGBitmapContextCreateImage(gc); // requires 10.4
- float s = Fl::screen_driver()->scale(0);
int resolution = Fl_Cocoa_Window_Driver::driver(win->top_window())->mapped_to_retina() ? 2 : 1;
if (x || y || w != win->w() || h != win->h()) {
+ float s = Fl::screen_driver()->scale(0);
CGRect rect = CGRectMake(x * s * resolution, y * s * resolution, w * s * resolution, h * s * resolution);
CGImageRef cgimg2 = CGImageCreateWithImageInRect(cgimg, rect);
CGImageRelease(cgimg);
@@ -4356,11 +4356,11 @@ int Fl_Cocoa_Window_Driver::decorated_h()
return h() + bt + by;
}
-static CALayer *get_titlebar_layer(Fl_Window *win)
+CALayer *Fl_Cocoa_Window_Driver::get_titlebar_layer()
{
// a compilation warning appears with SDK 10.5, so we require SDK 10.6 instead
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6
- return fl_mac_os_version >= 101000 ? [[[fl_xid(win) standardWindowButton:NSWindowCloseButton] superview] layer] : nil; // 10.5
+ return fl_mac_os_version >= 101000 ? [[[fl_xid(pWindow) standardWindowButton:NSWindowCloseButton] superview] layer] : nil; // 10.5
#else
return nil;
#endif
@@ -4387,7 +4387,7 @@ void Fl_Cocoa_Window_Driver::capture_titlebar_and_borders(Fl_RGB_Image*& top, Fl
{
left = bottom = right = NULL;
int htop = pWindow->decorated_h() - h();
- CALayer *layer = get_titlebar_layer(pWindow);
+ CALayer *layer = get_titlebar_layer();
CGColorSpaceRef cspace = CGColorSpaceCreateDeviceRGB();
float s = Fl::screen_driver()->scale(screen_num());
int scaled_w = int(w() * s);