DescriptionThis CL adds new class SkDeferredCanvas. This is a subclass of SkCanvas that can be used for deferred drawing. The main difference between this class and SkPictureRecord is that SkPictureRecord only supports write operations. SkDeferredCanvas encapsulates SkPicture in a way that makes it readable as well as writable, and supports direct access to the device. It is a full featured subclass of SkCanvas, so it can be dropped-in anywhere an SkCanvas is used. It also encapsulates a concrete canvas and device, used for flushing when necessary. The creation of the concrete device is also deferred by using a factory pattern for lazy initialization.
The motivation behind the change is that it creates important optimization opportunities. One optimization that was implemented in this CL is the purging of pending draw operations when a full-canvas opaque draw operation is performed. Additional optimizations made possible by this class will be implemented in the skia port of WebKit.
Patch 1 is in an unfinished state, so don't be too nit picky about small details or the lack of comments. I am submitting this to get a preliminary review. Please focus on design.
One comment about the design: I though it preferable to submit this code to skia rather than webkit because I am subclassing SkDevice, which we agreed should no longer be subclassed outside of skia. That being said, it would be pretty straightforward to submit this to WebKit instead.
Patch Set 1 #Patch Set 2 : factored into multiple CLs, using notifyPixelsChanged to trigger flush #
Total comments: 6
Patch Set 3 : response to feedback #Patch Set 4 : Style corrections #
Total comments: 1
Patch Set 5 : adding new pass for deferred rendering to gm, and other bug fixes #Patch Set 6 : Reduced scope of CL: does not defer when drawing a writable bitmap. #
Total comments: 3
Patch Set 7 : response to review #Patch Set 8 : fixed bugs with getTotalMatrix and purgePending #
Total comments: 1
Patch Set 9 : Removed factory for deferred device creation #
Total comments: 1
Patch Set 10 : new method setDeviceContext #Patch Set 11 : Minor corrections #
MessagesTotal messages: 30
|