From e16eea32be0cd0a22d9e5d9c334cd93f759d923e Mon Sep 17 00:00:00 2001 From: ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com> Date: Mon, 19 Aug 2019 09:34:42 +0200 Subject: [PATCH] Avoid repetition of the same multiplication. --- src/Fl_cocoa.mm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Fl_cocoa.mm b/src/Fl_cocoa.mm index 452a3a3be..c99d73aab 100644 --- a/src/Fl_cocoa.mm +++ b/src/Fl_cocoa.mm @@ -4208,8 +4208,8 @@ static NSBitmapImageRep* rect_to_NSBitmapImageRep_layer(Fl_Window *win, int x, i BOOL need_subimage = x || y || w != win->w() || h != win->h(); if (need_subimage) { float s = Fl::screen_driver()->scale(0); - int resolution = Fl_Cocoa_Window_Driver::driver(win->top_window())->mapped_to_retina() ? 2 : 1; - CGRect rect = CGRectMake(x * s * resolution, y * s * resolution, w * s * resolution, h * s * resolution); + if (Fl_Cocoa_Window_Driver::driver(win)->mapped_to_retina()) s *= 2; + CGRect rect = CGRectMake(x * s, y * s, w * s, h * s); cgimg = CGImageCreateWithImageInRect(cgimg, rect); } bitmap = [[NSBitmapImageRep alloc] initWithCGImage:cgimg];//10.5