summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>2019-10-14 15:41:53 +0200
committerManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>2019-10-14 15:41:53 +0200
commit4d350b61c171855903fc396ab75b56ea5c341f23 (patch)
tree918423f671450680524659854769d848b49b519b /src
parent9863fef25a77478acc622f2618165a6ea3bf02e7 (diff)
Rewrite for macOS 10.15 Catalina
Another way to support what occurs under macOS 10.15 where the bitmap graphics context prepared by the system when drawRect: runs sometimes changes its number of bytes/row even if the width and height are unchanged. This is expected to perform better when the number of bytes/row alternates between two values.
Diffstat (limited to 'src')
-rw-r--r--src/Fl_cocoa.mm9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/Fl_cocoa.mm b/src/Fl_cocoa.mm
index 5d5596042..e2ddb8cc9 100644
--- a/src/Fl_cocoa.mm
+++ b/src/Fl_cocoa.mm
@@ -2277,9 +2277,14 @@ static FLTextInputContext* fltextinputcontext_instance = nil;
if (!through_Fl_X_flush) window->clear_damage();
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_14
if (gc) {
- if (aux_bitmap && CGBitmapContextGetBytesPerRow(gc) != CGBitmapContextGetBytesPerRow(aux_bitmap)) [self reset_aux_bitmap];
if (!aux_bitmap) [self create_aux_bitmap:gc retina:d->mapped_to_retina()];
- memcpy(CGBitmapContextGetData(aux_bitmap), CGBitmapContextGetData(gc), CGBitmapContextGetHeight(gc) * CGBitmapContextGetBytesPerRow(gc));
+ if (CGBitmapContextGetBytesPerRow(gc) != CGBitmapContextGetBytesPerRow(aux_bitmap)) {
+ CGImageRef img = CGBitmapContextCreateImage(gc);
+ CGContextDrawImage(aux_bitmap, [self frame], img);
+ CGImageRelease(img);
+ } else {
+ memcpy(CGBitmapContextGetData(aux_bitmap), CGBitmapContextGetData(gc), CGBitmapContextGetHeight(gc) * CGBitmapContextGetBytesPerRow(gc));
+ }
Fl_Cocoa_Window_Driver::q_release_context();
direct_draw = NO;
}