Commit Graph

9 Commits

Author SHA1 Message Date
Mike Klein
b89c88311d keep SkRSXforms aligned in SkLiteDL
We've been copying the text first, then the transforms.
That's a good way to get the transforms out of alignment.

This CL swaps the order of the two.

Bug: skia:7133

Change-Id: If8cd402b9ffba1787345dc4b5ffd4ee6abb14f33
Reviewed-on: https://skia-review.googlesource.com/57941
Reviewed-by: Derek Sollenberger <djsollen@google.com>
Commit-Queue: Mike Klein <mtklein@chromium.org>
2017-10-11 13:06:19 +00:00
Mike Klein
7cc49d65fc Record SkCanvas::flush().
We can record multiple frames in an .skp by recording SkCanvas::flush().
This should make SkPictures, SkLiteDL, and .skp files all record flush().

Change-Id: I6cf6e0e4ef993530d9f92fa168a53702ffce7d5e
Reviewed-on: https://skia-review.googlesource.com/34081
Reviewed-by: Derek Sollenberger <djsollen@google.com>
Commit-Queue: Mike Klein <mtklein@chromium.org>
2017-08-14 15:29:05 +00:00
Derek Sollenberger
d7875f57bd Refactor SkLiteDL to no longer extend SkDrawable.
Change-Id: Ieaa849bceba0e98e4c99491c721fe945a0694e68
Reviewed-on: https://skia-review.googlesource.com/9111
Reviewed-by: Mike Klein <mtklein@chromium.org>
Reviewed-by: Herb Derby <herb@google.com>
Reviewed-by: Stan Iliev <stani@google.com>
Commit-Queue: Derek Sollenberger <djsollen@google.com>
2017-03-02 20:16:17 +00:00
Mike Reed
c1f7774e8d Revert[2] "remove SK_SUPPORT_LEGACY_CLIP_REGIONOPS"
This reverts commit a129dfef2a.

BUG=skia:

Change-Id: I717de6e5fcd4516aa684b014b1414b0f82ac2b91
Reviewed-on: https://skia-review.googlesource.com/5722
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Derek Sollenberger <djsollen@google.com>
2016-12-09 14:33:41 +00:00
Mike Reed
a129dfef2a Revert "remove SK_SUPPORT_LEGACY_CLIP_REGIONOPS"
This reverts commit 8e7432b7f9.

Reason for revert: <INSERT REASONING HERE>

external/skia/bench/../tools/android/SkAndroidSDKCanvas.h:103:36: error: C++ requires a type specifier for all declarations
    void onClipRect(const SkRect&, ClipOp, ClipEdgeStyle) override;

Original change's description:
> remove SK_SUPPORT_LEGACY_CLIP_REGIONOPS
> 
> 
> switch over to SkClipOps now that SK_SUPPORT_LEGACY_CLIP_REGIONOPS is gone
> 
> BUG=skia:
> 
> Change-Id: Ifdc8b3746d508348a40cc009a4e529a1cb3c405d
> Reviewed-on: https://skia-review.googlesource.com/5714
> Commit-Queue: Mike Reed <reed@google.com>
> Reviewed-by: Mike Reed <reed@google.com>
> 

TBR=reed@google.com,reviews@skia.org
BUG=skia:
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true

Change-Id: If26ea91d7464615e43c1d3d2f726e337ff56b55c
Reviewed-on: https://skia-review.googlesource.com/5721
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Mike Reed <reed@google.com>
2016-12-09 13:14:41 +00:00
Mike Reed
8e7432b7f9 remove SK_SUPPORT_LEGACY_CLIP_REGIONOPS
switch over to SkClipOps now that SK_SUPPORT_LEGACY_CLIP_REGIONOPS is gone

BUG=skia:

Change-Id: Ifdc8b3746d508348a40cc009a4e529a1cb3c405d
Reviewed-on: https://skia-review.googlesource.com/5714
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Mike Reed <reed@google.com>
2016-12-08 21:45:27 +00:00
reed
73603f3c52 abstract name of clipping ops, to transtion to a more restricted set
SkRegion::Op --> SkCanvas::ClipOp (alias) --> SkClipOp

pre-CL needed in chrome : https://codereview.chromium.org/2355583002/

BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2355483002

Review-Url: https://codereview.chromium.org/2355483002
2016-09-20 08:42:39 -07:00
mtklein
883c8efae7 SkLiteDL: remove freelisting, add reset() and SKLITEDL_PAGE knob.
We think Android can cache these better than a global freelist allows.
This removes the freelisting but adds reset() to allow reuse.

I took the opportunity to abstract 4096 as a define SKLITEDL_PAGE.

BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2248693004

Review-Url: https://codereview.chromium.org/2248693004
2016-08-16 09:36:18 -07:00
mtklein
9c5052f16b SkLite*
SkLiteRecorder, a new SkCanvas, fills out SkLiteDL, a new SkDrawable.

This SkDrawable is a display list similar to SkRecord and SkBigPicture / SkRecordedDrawable, but with a few new design points inspired by Android and slimming paint:

  1) SkLiteDL is structured as one big contiguous array rather than the two layer structure of SkRecord.  This trades away flexibility and large-op-count performance for better data locality for small to medium size pictures.

  2) We keep a global freelist of SkLiteDLs, both reusing the SkLiteDL struct itself and its contiguous byte array.  This keeps the expected number of mallocs per display list allocation <1 (really, ~0) for cyclical use cases.

These two together mean recording is faster.  Measuring against the code we use at head, SkLiteRecorder trends about ~3x faster across various size pictures, matching speed at 0 draws and beating the special-case 1-draw pictures we have today.  (I.e. we won't need those special case implementations anymore, because they're slower than this new generic code.)  This new strategy records 10 drawRects() in about the same time the old strategy took for 2.

This strategy stays the winner until at least 500 drawRect()s on my laptop, where I stopped checking.

A simpler alternative to freelisting is also possible (but not implemented here), where we allow the client to manually reset() an SkLiteDL for reuse when its refcnt is 1.  That's essentially what we're doing with the freelist, except tracking what's available for reuse globally instead of making the client do it.

This code is not fully capable yet, but most of the key design points are there.  The internal structure of SkLiteDL is the area I expect to be most volatile (anything involving Op), but its interface and the whole of SkLiteRecorder ought to be just about done.

You can run nanobench --match picture_overhead as a demo.  Everything it exercises is fully fleshed out, so what it tests is an apples-to-apples comparison as far as recording costs go.  I have not yet compared playback performance.

It should be simple to wrap this into an SkPicture subclass if we want.

I won't start proposing we replace anything old with anything new quite yet until I have more ducks in a row, but this does look pretty promising (similar to the SkRecord over old SkPicture change a couple years ago) and I'd like to land, experiment, iterate, especially with an eye toward Android.

BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2213333002

Review-Url: https://codereview.chromium.org/2213333002
2016-08-06 12:51:51 -07:00