Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(207)

Issue 5430058: Canvas variant for deferred drawing (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
12 years, 7 months ago by junov1
Modified:
12 years, 5 months ago
CC:
vangelis
Base URL:
http://skia.googlecode.com/svn/trunk/
Visibility:
Public.

Description

This 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 #

Unified diffs Side-by-side diffs Delta from patch set Stats (+999 lines, -11 lines) Patch
M gm/gmmain.cpp View 1 2 3 4 5 7 chunks +60 lines, -8 lines 0 comments Download
M gyp/utils.gyp View 1 2 3 4 5 6 2 chunks +2 lines, -0 lines 0 comments Download
M include/core/SkCanvas.h View 1 2 3 4 5 6 7 4 chunks +9 lines, -3 lines 0 comments Download
A include/utils/SkDeferredCanvas.h View 1 2 3 4 5 6 7 8 9 10 1 chunk +298 lines, -0 lines 0 comments Download
M src/core/SkCanvas.cpp View 1 2 3 4 5 6 2 chunks +5 lines, -0 lines 0 comments Download
A src/utils/SkDeferredCanvas.cpp View 1 2 3 4 5 6 7 8 9 10 1 chunk +625 lines, -0 lines 0 comments Download

Messages

Total messages: 30
junov1
PTAL
12 years, 7 months ago (2011-11-23 22:46:40 UTC) #1
reed1
Can we break this into smaller CLs? SkCanvas.h seems like it can be stand alone. ...
12 years, 7 months ago (2011-11-28 14:24:00 UTC) #2
reed1
SkDevice.cpp - is this change a necessary part of the larger change? - What is ...
12 years, 7 months ago (2011-11-28 14:24:44 UTC) #3
junov1
On 2011/11/28 14:24:00, reed1 wrote: > Can we break this into smaller CLs? > > ...
12 years, 7 months ago (2011-11-28 15:49:02 UTC) #4
junov1
On 2011/11/28 14:24:44, reed1 wrote: > SkDevice.cpp > - is this change a necessary part ...
12 years, 7 months ago (2011-11-28 15:55:19 UTC) #5
reed1
On 2011/11/28 15:55:19, junov1 wrote: > On 2011/11/28 14:24:44, reed1 wrote: > > SkDevice.cpp > ...
12 years, 7 months ago (2011-11-28 16:11:20 UTC) #6
reed1
On 2011/11/28 15:49:02, junov1 wrote: > On 2011/11/28 14:24:00, reed1 wrote: > > Can we ...
12 years, 7 months ago (2011-11-28 16:11:56 UTC) #7
junov1
Patch 2 uploaded: using observer pattern to receive notifyPixelsChanged signal from pixelref objects. This CL ...
12 years, 6 months ago (2011-12-06 14:49:17 UTC) #8
reed1
I like the attempt at factoring out separable changes into different CLs, and some of ...
12 years, 6 months ago (2011-12-06 15:01:29 UTC) #9
junov1
Done.
12 years, 6 months ago (2011-12-08 15:53:58 UTC) #10
junov1
On 2011/12/08 15:53:58, junov1 wrote: > Done. New patch corrects style issues, mostly 80 col ...
12 years, 6 months ago (2011-12-08 18:49:39 UTC) #11
reed1
Question: Is the addition of notifiers just to make Pictures behave correctly when drawBitmap is ...
12 years, 6 months ago (2011-12-08 21:03:18 UTC) #12
reed1
Maintaining the list of notifiers in SkPixelRef is not thread-safe. SkPixelRefs love to live in ...
12 years, 6 months ago (2011-12-08 21:06:20 UTC) #13
junov1
On 2011/12/08 21:03:18, reed1 wrote: > Question: > > Is the addition of notifiers just ...
12 years, 6 months ago (2011-12-09 15:14:03 UTC) #14
junov1
As discussed by e-mail, I have reduced the scope of the change. The problem of ...
12 years, 5 months ago (2012-01-12 19:23:14 UTC) #15
reed1
What would it take to not make SkDevice.h aware of this new subclass (friend)? As ...
12 years, 5 months ago (2012-01-12 19:48:05 UTC) #16
junov1
On 2012/01/12 19:48:05, reed1 wrote: > What would it take to not make SkDevice.h aware ...
12 years, 5 months ago (2012-01-12 21:33:49 UTC) #17
reed1
I would like the comment, just to make it clear this method is not a ...
12 years, 5 months ago (2012-01-12 21:46:21 UTC) #18
reed1
http://codereview.appspot.com/5430058/diff/23001/src/core/SkCanvas.cpp File src/core/SkCanvas.cpp (left): http://codereview.appspot.com/5430058/diff/23001/src/core/SkCanvas.cpp#oldcode216 src/core/SkCanvas.cpp:216: SkDrawIter(SkCanvas* canvas, bool skipEmptyClips = true) { Lets recode ...
12 years, 5 months ago (2012-01-12 21:47:49 UTC) #19
junov1
Done.
12 years, 5 months ago (2012-01-16 16:30:45 UTC) #20
reed1
http://codereview.appspot.com/5430058/diff/29001/src/utils/SkDeferredCanvas.cpp File src/utils/SkDeferredCanvas.cpp (right): http://codereview.appspot.com/5430058/diff/29001/src/utils/SkDeferredCanvas.cpp#newcode626 src/utils/SkDeferredCanvas.cpp:626: flushPending(); OMG -- this looks way too tricky. Can ...
12 years, 5 months ago (2012-01-17 14:29:24 UTC) #21
junov1
This trickery, along with the whole factory pattern is all so that we can defer ...
12 years, 5 months ago (2012-01-17 15:11:46 UTC) #22
junov1
Latest patch gets rid of DeviceFactory in favor of a much simpler DeviceContext class.
12 years, 5 months ago (2012-01-17 21:12:23 UTC) #23
reed1
Wow, much smallerer. LGTM on the SkCanvas changes for sure. Just a small question on ...
12 years, 5 months ago (2012-01-17 21:38:22 UTC) #24
junov1
On 2012/01/17 21:38:22, reed1 wrote: > May not be clean to overload the name setDevice ...
12 years, 5 months ago (2012-01-17 21:52:18 UTC) #25
reed1
On 2012/01/17 21:52:18, junov1 wrote: > On 2012/01/17 21:38:22, reed1 wrote: > > May not ...
12 years, 5 months ago (2012-01-17 21:57:09 UTC) #26
junov1
New adds setDeviceContext, and remove the 2 argument version of setDevice.
12 years, 5 months ago (2012-01-17 22:36:35 UTC) #27
junov1
Additional minor correction in patch 11
12 years, 5 months ago (2012-01-17 22:41:59 UTC) #28
reed1
Will be valuable to test for memory leaks just in case, given all of the ...
12 years, 5 months ago (2012-01-18 13:15:25 UTC) #29
junov1
12 years, 5 months ago (2012-01-18 16:11:53 UTC) #30
On 2012/01/18 13:15:25, reed1 wrote:
> Will be valuable to test for memory leaks just in case, given all of the extra
> objects holding objects.
> 
> lgtm

Valgrind on chromium says we're good.
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b