I think this is a bad trend for performance -- making query methods on SkCanvas ...
12 years, 11 months ago
(2012-02-24 16:07:45 UTC)
#2
I think this is a bad trend for performance -- making query methods on SkCanvas
become virtual. This makes them a little slower to call, and it means we cannot
inline them in the future.
For example: were are in the midst of measuring the win of making quickRejectY
inline for android. If all of the clip query methods need to become virtual,
then this one will as well, eliminating our ability to make it inline.
As another approach, consider what SkPictureRecording does. For all matrix and
clip functions (the mutating methods which are already virtual), it sends those
to its inherited (i.e. SkCanvas) and then also sends those to its recorder. In
this way the base class sees the current clip/region/matrix state, so that all
of the non-virtual query methods still work. Can we do that fir DeferredCanvas
as well?
Ok, I can do that. In the case of SkDeferredCanvas, that will mean the state ...
12 years, 11 months ago
(2012-02-24 18:08:52 UTC)
#3
Ok, I can do that. In the case of SkDeferredCanvas, that will mean the
state will be entirely duplicated, which seems wasteful to me, but I guess
it is worth it to avoid imposing an unnecessary burden on all the other
canvas use cases that do not care about deferred canvas. I will try that
out.
On Fri, Feb 24, 2012 at 11:07 AM, <reed@google.com> wrote:
> I think this is a bad trend for performance -- making query methods on
> SkCanvas become virtual. This makes them a little slower to call, and it
> means we cannot inline them in the future.
>
> For example: were are in the midst of measuring the win of making
> quickRejectY inline for android. If all of the clip query methods need
> to become virtual, then this one will as well, eliminating our ability
> to make it inline.
>
> As another approach, consider what SkPictureRecording does. For all
> matrix and clip functions (the mutating methods which are already
> virtual), it sends those to its inherited (i.e. SkCanvas) and then also
> sends those to its recorder. In this way the base class sees the current
> clip/region/matrix state, so that all of the non-virtual query methods
> still work. Can we do that fir DeferredCanvas as well?
>
>
http://codereview.appspot.com/**5697052/<http://codereview.appspot.com/5697052/>
>
lgtm with possible name change: clipLayerBounds actually isn't really about layers per-se. clipRectBounds(...) Indicating that ...
12 years, 11 months ago
(2012-02-24 19:49:36 UTC)
#6
lgtm with possible name change: clipLayerBounds actually isn't really about
layers per-se.
clipRectBounds(...)
Indicating that its like clipRect, but it takes the conservative bounds of the
transformed rect (e.g. a rotated rect becomes another rect, not a polygon).
Uploaded new patch. Note: There is some diff because I rebased my working copy. The ...
12 years, 11 months ago
(2012-02-24 21:30:13 UTC)
#7
Uploaded new patch.
Note: There is some diff because I rebased my working copy. The only changes
since patch 2 are:
* the rename to clipRectBounds
* SkCanvas.cpp, line 1060
That second change was necessary to prevent a re-entry in SkPicture that was
corrupting the recording. The problem had to do with the call to accessBitmap
causing a deferred canvas flush while recording a canvas operation. Fix was
very simple since all we needed from the bitmap was its size, so no need for
pixel access.
Issue 5697052: Making clipping accessor methods virtual in SkCanvas to fix deferred canvas
(Closed)
Created 12 years, 11 months ago by junov1
Modified 12 years, 7 months ago
Reviewers: reed1
Base URL: http://skia.googlecode.com/svn/trunk/
Comments: 0