macOS: implement (BOOL)[FLView isOpaque] to improve drawing performance.
This commit is contained in:
parent
63dcdcec0a
commit
75016cb853
@ -505,8 +505,9 @@ void Fl_Cocoa_Screen_Driver::breakMacEventLoop()
|
|||||||
BOOL need_handle; // YES means Fl::handle(FL_KEYBOARD,) is needed after handleEvent processing
|
BOOL need_handle; // YES means Fl::handle(FL_KEYBOARD,) is needed after handleEvent processing
|
||||||
NSInteger identifier;
|
NSInteger identifier;
|
||||||
NSRange selectedRange;
|
NSRange selectedRange;
|
||||||
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_14
|
|
||||||
@public
|
@public
|
||||||
|
BOOL is_opaque;
|
||||||
|
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_14
|
||||||
CGContextRef aux_bitmap; // all drawing to view goes there and is finally copied to the CALayer
|
CGContextRef aux_bitmap; // all drawing to view goes there and is finally copied to the CALayer
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@ -684,11 +685,14 @@ void Fl_Cocoa_Screen_Driver::breakMacEventLoop()
|
|||||||
if (!CGRectEqualToRect(srect, current_clip)) { // if new clip differs from current clip
|
if (!CGRectEqualToRect(srect, current_clip)) { // if new clip differs from current clip
|
||||||
delete r;
|
delete r;
|
||||||
FLWindow *xid = fl_xid(w);
|
FLWindow *xid = fl_xid(w);
|
||||||
NSView *view = [xid contentView];
|
FLView *view = (FLView*)[xid contentView];
|
||||||
if (CGRectEqualToRect(srect, full)) r = NULL;
|
if (CGRectEqualToRect(srect, full)) {
|
||||||
else {
|
r = NULL;
|
||||||
|
view->is_opaque = (w->shape() == NULL);
|
||||||
|
} else {
|
||||||
r = new CGRect(srect);
|
r = new CGRect(srect);
|
||||||
if (r->size.width == 0 && r->size.height == 0) r->origin.x = r->origin.y = 0;
|
if (r->size.width == 0 && r->size.height == 0) r->origin.x = r->origin.y = 0;
|
||||||
|
view->is_opaque = NO;
|
||||||
}
|
}
|
||||||
d->subRect(r);
|
d->subRect(r);
|
||||||
w->redraw();
|
w->redraw();
|
||||||
@ -698,7 +702,7 @@ void Fl_Cocoa_Screen_Driver::breakMacEventLoop()
|
|||||||
[xid orderWindow:NSWindowAbove relativeTo:parent_num];
|
[xid orderWindow:NSWindowAbove relativeTo:parent_num];
|
||||||
}
|
}
|
||||||
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_14
|
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_14
|
||||||
if (!views_use_CA || ((FLView*)view)->aux_bitmap)
|
if (!views_use_CA || view->aux_bitmap)
|
||||||
#endif
|
#endif
|
||||||
[view display]; // subwindow needs redrawn
|
[view display]; // subwindow needs redrawn
|
||||||
}
|
}
|
||||||
@ -2199,6 +2203,9 @@ static FLTextInputContext* fltextinputcontext_instance = nil;
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
@implementation FLView
|
@implementation FLView
|
||||||
|
- (BOOL)isOpaque {
|
||||||
|
return is_opaque;
|
||||||
|
}
|
||||||
- (BOOL)did_view_resolution_change {
|
- (BOOL)did_view_resolution_change {
|
||||||
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7
|
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7
|
||||||
if (fl_mac_os_version >= 100700) { // determine whether window is mapped to a retina display
|
if (fl_mac_os_version >= 100700) { // determine whether window is mapped to a retina display
|
||||||
@ -2994,6 +3001,7 @@ Fl_X* Fl_Cocoa_Window_Driver::makeWindow()
|
|||||||
[cw setContentView:myview];
|
[cw setContentView:myview];
|
||||||
[myview release];
|
[myview release];
|
||||||
[cw setLevel:winlevel];
|
[cw setLevel:winlevel];
|
||||||
|
myview->is_opaque = (w->shape() == NULL);
|
||||||
|
|
||||||
q_set_window_title(cw, w->label(), w->iconlabel());
|
q_set_window_title(cw, w->label(), w->iconlabel());
|
||||||
NSImage *icon = icon_image; // is a window or default icon present?
|
NSImage *icon = icon_image; // is a window or default icon present?
|
||||||
|
Loading…
Reference in New Issue
Block a user