Avoid useless code when drawing directly.

This commit is contained in:
ManoloFLTK 2019-10-20 15:37:05 +02:00
parent 4d350b61c1
commit 80f5740468

View File

@ -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();
}