summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>2019-10-12 16:02:00 +0200
committerManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>2019-10-12 16:02:00 +0200
commit9863fef25a77478acc622f2618165a6ea3bf02e7 (patch)
tree5a461be8027e19062018af2ec6033d9a6ba52476 /src
parent72e712efbdf7f7c8d1391794700dea46d5cc0db0 (diff)
Fix for macOS Catalina 10.15
Under Catalina, 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.
Diffstat (limited to 'src')
-rw-r--r--src/Fl_cocoa.mm10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/Fl_cocoa.mm b/src/Fl_cocoa.mm
index 2357400c6..5d5596042 100644
--- a/src/Fl_cocoa.mm
+++ b/src/Fl_cocoa.mm
@@ -2262,7 +2262,14 @@ static FLTextInputContext* fltextinputcontext_instance = nil;
}
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_14
else if (gc && aux_bitmap && ( Fl_X::i(window)->region || !(window->damage()&FL_DAMAGE_ALL)) ) {
- memcpy(CGBitmapContextGetData(gc), CGBitmapContextGetData(aux_bitmap), CGBitmapContextGetHeight(gc) * CGBitmapContextGetBytesPerRow(gc));
+ if (CGBitmapContextGetBytesPerRow(gc) != CGBitmapContextGetBytesPerRow(aux_bitmap)) {
+ // this condition (unchanged W and H but changed BytesPerRow) occurs with 10.15
+ CGImageRef img = CGBitmapContextCreateImage(aux_bitmap);
+ CGContextDrawImage(gc, [self frame], img);
+ CGImageRelease(img);
+ } else {
+ memcpy(CGBitmapContextGetData(gc), CGBitmapContextGetData(aux_bitmap), CGBitmapContextGetHeight(gc) * CGBitmapContextGetBytesPerRow(gc));
+ }
}
#endif
through_drawRect = YES;
@@ -2270,6 +2277,7 @@ 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));
Fl_Cocoa_Window_Driver::q_release_context();