forked from qt/qtbase
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
include QtC WIP patch https://codereview.qt-project.org/#/c/154637/
Cocoa: Flush backing store on the attached QWindow only Up until now, we would flush the backing store on the passed QWindow. This had the effect of marking dirty the specified region on the QWindow's NSView. In turn, Cocoa would call -[QNSView drawRect:] and cover the dirty region while possibly optimizing overlapping areas. However, this approach doesn't work as well for a hierarchy of QWindow since it doesn't take advantage of the fact that the backingstore is shared among all the descendants of the toplevel QWindow. Therefore, it results on the same pixels being copied over several times for the same backing store. It is important to notice that Cocoa doesn't have any way of optimizing this process since it doesn't know that we share the backing store contents among several QNSViews on the same toplevel window. Our approach takes advantage of the shared backing store contents by stating that, in the end, we can display everything on the toplevel QNSView. This requires the child QNSViews to never be marked dirty in Cocoa's eyes (but that's no longer necessary since they don't need to be rendered anyway). By doing so, Cocoa can minimize the number of calls to -[QNSView drawRect:]. Notice that this approach also guarantees that late updates to child QWindows will get drawn properly because that QWindow flush will always result in a call to -[NSView setNeedsDisplayInRect:]. Note about the 'opaque' property value: In order to avoid child QNSViews in front of the backing store QNSView to obfuscate the latter, we need to ensure the child views are not opaque. This doesn't introduce any pessimization since those non-opaque views are never marked as needing to be displayed.
- Loading branch information
1 parent
216facc
commit 72e3fbb
Showing
5 changed files
with
48 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters