summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>2019-10-20 15:37:05 +0200
committerManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>2019-10-20 15:37:05 +0200
commit80f574046840a33e15da87dd18e7b576c67f222e (patch)
tree4bea2f64a893e62bbb6e8e21508fec55b3fdef86
parent4d350b61c171855903fc396ab75b56ea5c341f23 (diff)
Avoid useless code when drawing directly.
-rw-r--r--src/Fl_cocoa.mm23
1 files changed, 13 insertions, 10 deletions
diff --git a/src/Fl_cocoa.mm b/src/Fl_cocoa.mm
index e2ddb8cc9..ffabb6e41 100644
--- a/src/Fl_cocoa.mm
+++ b/src/Fl_cocoa.mm
@@ -2273,22 +2273,25 @@ static FLTextInputContext* fltextinputcontext_instance = nil;
}
#endif
through_drawRect = YES;
- d->Fl_Window_Driver::flush();
- 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) [self create_aux_bitmap:gc retina:d->mapped_to_retina()];
- 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));
+ if (window->damage()) {
+ d->Fl_Window_Driver::flush();
+ if (!aux_bitmap) [self create_aux_bitmap:gc retina:d->mapped_to_retina()];
+ 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;
- }
+ } else
#endif
+ d->Fl_Window_Driver::flush();
+ if (!through_Fl_X_flush) window->clear_damage();
through_drawRect = NO;
fl_unlock_function();
}