Commit Graph

202 Commits

Author SHA1 Message Date
mtklein
04038eba9f public SkNVRefCnt<SnapshotArray>
Should fix broken build.

NOTRY=true
TBR=reed@google.com

BUG=skia:

Review URL: https://codereview.chromium.org/748143002
2014-11-21 11:13:15 -08:00
mtklein
b7ee349f10 SkData -> SkPicture::SnapshotArray
Restores type safety with all the same features.

(Also note, less code: 29 insertions, 50 deletions.)

BUG=skia:

Review URL: https://codereview.chromium.org/746553002
2014-11-21 11:06:04 -08:00
reed
41d2c2e434 simplify uniqueID code in picture
patch from issue 750003002 at patchset 1 (http://crrev.com/750003002#ps1)

BUG=skia:

Review URL: https://codereview.chromium.org/752573002
2014-11-21 08:07:41 -08:00
mtklein
08d1fccf6e Add SkNVRefCnt, prune down SkPicture's size
SkNVRefCnt is a variant of SkRefCnt that's Not Virtual, so weighs 4 bytes
instead of 8 or 16.  There's only benefit to doing this if the deriving class
does not otherwise need a vtable, e.g. SkPicture.

I've stripped out some cruft from SkPicture, rearranged fields to pack tightly,
and added compile asserts for the sizes of SkPicture, SkRecord, and
SkVarAlloc.

BUG=skia:3144

Review URL: https://codereview.chromium.org/741793002
2014-11-20 09:18:32 -08:00
tomhudson
158fcaa031 Implement SkPicture::bytesUsed() for SkRecord backend
BUG=chromium:230419
R=mtklein@google.com,reed@google.com

Review URL: https://codereview.chromium.org/490253003
2014-11-19 10:41:14 -08:00
reed
78e2768897 Allow pictures to have a full bounds
This reverts commit 7c4cdd2c5b.

BUG=skia:

Review URL: https://codereview.chromium.org/738083002
2014-11-19 08:04:34 -08:00
reed
7c4cdd2c5b Revert of allow pictures to have a full bounds (patchset #3 id:40001 of https://codereview.chromium.org/736583004/)
Reason for revert:
needed to update legacy width() helpers

Original issue's description:
> allow pictures to have a full bounds
>
> BUG=skia:
>
> Committed: https://skia.googlesource.com/skia/+/7e76bff26e7c74902841ca4f607eb0b24a833a4a

TBR=fmalita@google.com,mtklein@google.com,robertphillips@google.com,fmalita@chromium.org
NOTREECHECKS=true
NOTRY=true
BUG=skia:

Review URL: https://codereview.chromium.org/722043005
2014-11-19 07:17:17 -08:00
reed
7e76bff26e allow pictures to have a full bounds
BUG=skia:

Review URL: https://codereview.chromium.org/736583004
2014-11-19 06:59:41 -08:00
reed
6be2aa9a25 wip for drawables
Idea:

1. in its mutable recording state, keep a table of drawables on the side, and store an index in the record list.

2. In "immediate-mode" draw, just call the clients drawable directly (need access to our private list to turn the stored index into a proc)

3. when we "snap", we replace the list of drawables with a list of (sub) pictures, and then during playback of the snapped picture, we invoke a private drawable which just calls "drawPicture" on the index'd subpicture.

Review URL: https://codereview.chromium.org/727363003
2014-11-18 11:08:05 -08:00
mtklein
c6ad9eefa0 More SkPicture cleanup
- move field declarations together and pack them a little tighter
 - get rid of fData
 - remove dead code in debugger, including unused SkPicturePlayback subclass

There are now no more long-lived SkPictureData!  (Really, there never were,
but now we don't pretend to support them.)

BUG=skia:

No API changes.
TBR=reed@google.com

Review URL: https://codereview.chromium.org/725143002
2014-11-17 06:45:18 -08:00
robertphillips
8236591547 Rename GrAccelData to SkLayerInfo and move it to src/core
Review URL: https://codereview.chromium.org/719133002
2014-11-12 09:32:34 -08:00
robertphillips
4e8e3421aa Move SkRecordComputeLayers and CollectLayers into SkRecordDraw.cpp
Rather then exposing parts of FillBounds (as in Expose FillBounds to allow GrPictureUtils::CollectLayers to be layered on top of it - https://codereview.chromium.org/698643002/), this CL moves CollectLayers into SkRecordDraw.cpp to accomplish the layering.

Review URL: https://codereview.chromium.org/716913003
2014-11-12 06:46:08 -08:00
robertphillips
6beeb8f3cc Small refactoring of layer discovery code
This CL removes CollectLayers' reliance on having the top most picture (by removing the unused fPictureID member). This then allows making CollectLayers' API closer to that of SkRecordFillBounds in order to facilitate using them interchangeably.

Review URL: https://codereview.chromium.org/714533002
2014-11-10 08:48:29 -08:00
jvanverth
f7007b023d Enable distance field path rendering in Chrome.
- Add stat tracking for df-renderable paths
- Modify GPU rasterization veto to account for df-renderable paths
- Remove #define hiding df paths from Chromium and Android

BUG=skia:2935

Review URL: https://codereview.chromium.org/685113003
2014-11-04 07:59:01 -08:00
robertphillips
d8aa7b74c8 Upgrade GPUOptimize
This will be a bit hairy to review.

The FillBounds and CollectLayers code has diverged significantly resulting in the rendering path seeing different bounds than the hoisting path. This CL merges the FillBounds changes into CollectLayers. A follow on CL will, hopefully, find a way to layer CollectLayers on top of FillBounds.

The only code in CollectLayers that is different from FillBounds is bracketed by "LAYER HOISTING" comments.

NOTREECHECKS=true

Review URL: https://codereview.chromium.org/685263004
2014-10-30 16:45:02 -07:00
sugoi
234f036b3e Adding an option to render only the shadow in SkDropShadowImageFilter
This is basically how blink uses the filter. Currently, I can't use it for "ShadowOnly" mode with the filter at all, but instead of copying the code and risking to have the codepaths diverge, I'm simply going to add the option here.

BUG=skia:

Review URL: https://codereview.chromium.org/646213004
2014-10-23 13:59:52 -07:00
mtklein
8e12656096 Remove DEPRECATED_beginRecording().
This removes:
  1) ability to record old pictures with SkPictureRecorder;
  2) a couple tests specific to the old backend.

The functionality of DEPRECATED_beginRecording() now lives in
(private) SkPicture::Backport(), which is the only place we
need it now.

BUG=skia:
TBR=reed@google.com

Review URL: https://codereview.chromium.org/618303002
2014-10-01 09:29:35 -07:00
robertphillips
68cd2aa797 Update GrRecordReplaceDraw to use SkTDynamicHash & add ReplaceDraw
Having hoisted layers from different pictures invalidates the assumptions of the old GrReplacements object. This is fixed by switching to a SkTDynamicHash-based back-end.

Sub-picture-layers also require that the replacement drawing occur for the sub-pictures too. The ReplaceDraw object is added to make this happen and limit the replacement lookup to saveLayer draw commands.

This is split out of (Fix sub-picture layer rendering bugs - https://codereview.chromium.org/597293002/).

BUG=skia:2315

Review URL: https://codereview.chromium.org/607763008
2014-10-01 09:24:06 -07:00
mtklein
46616af01b Strip old backend recording down to essentials
Feature-wise, this removes:
  1) BBH support;
  2) peephole optimizations;
  3) record-time text op specializations;
  4) the guarantee that SkPaints are flattened.

This deletes the optimizations GM, which only exists to test the peepholes of
the old backend.  SkRecord optimizations are unit tested, and if that ever fails we
can think about adding another GM like this, but they're different enough we'd
want to start from scratch anyway.

We need to keep the code that plays back the specialized text ops around for
a while for compatibility with existing .SKPs that have those ops recorded.

BUG=skia:

CQ_EXTRA_TRYBOTS=tryserver.skia:Canary-Chrome-Ubuntu13.10-Ninja-x86_64-ToT-Trybot
R=robertphillips@google.com, reed@google.com, mtklein@google.com

Author: mtklein@chromium.org

Review URL: https://codereview.chromium.org/617953002
2014-09-30 14:47:10 -07:00
mtklein
5bc760a6a6 Remove support for SkPicture::clone().
This folds SK_SUPPORT_LEGACY_PICTURE_CLONE through as undefined.

Chrome's not used clone() for a month or two, and we don't use it ourselves.
Don't think Android ever did.

CQ_EXTRA_TRYBOTS=tryserver.skia:Canary-Chrome-Ubuntu13.10-Ninja-x86_64-ToT-Trybot

BUG=skia:
R=reed@google.com, mtklein@google.com, robertphillips@google.com

Author: mtklein@chromium.org

Review URL: https://codereview.chromium.org/620533002
2014-09-30 11:14:38 -07:00
reed
c5e15a1afa remove alphatype from colortable
the owning bitmap is (already) responsible for knowing the alphatype

BUG=skia:
R=djsollen@google.com

Author: reed@google.com

Review URL: https://codereview.chromium.org/611093002
2014-09-29 12:10:27 -07:00
robertphillips
ee6631ef90 Update RecordReplaceDrawTest to generate and pass pictures
This CL splits the unit test changes out of (Fix sub-picture layer rendering bugs - https://codereview.chromium.org/597293002/).

For various reasons GrRecordReplaceDraw now needs to take an SkPicture (rather than an SkRecord and a BBH).

R=egdaniel@google.com, bsalomon@google.com

Author: robertphillips@google.com

Review URL: https://codereview.chromium.org/608823002
2014-09-29 05:32:50 -07:00
robertphillips
c5ba71d2e5 Change SkPicture::draw to playback
R=reed@google.com

Author: robertphillips@google.com

Review URL: https://codereview.chromium.org/540963002
2014-09-04 08:42:50 -07:00
robertphillips
274b4ba6bd Switch Layer Hoisting over to SkRecord backend
R=bsalomon@google.com
TBR=bsalomon@google.com

Author: robertphillips@google.com

Review URL: https://codereview.chromium.org/540543002
2014-09-04 07:24:18 -07:00
robertphillips
2ed8a75c28 Remove use of EXPERIMENTAL_getActiveOps from layer hoisting code
This is getting in the way of switching to the SkRecord backend and is of questionable value.

R=bsalomon@google.com

Author: robertphillips@google.com

Review URL: https://codereview.chromium.org/539693002
2014-09-03 13:46:02 -07:00
djsollen
5ee785d9c7 Remove legacy (and also broken) SkPicture constructor.
R=robertphillips@google.com, reed@google.com

Author: djsollen@google.com

Review URL: https://codereview.chromium.org/532703004
2014-09-02 13:34:49 -07:00
robertphillips
98d709bc8d Reorganize Layer Hoisting code
With the new MultiPictureDraw API the GrContext will be performing the layer hoisting (instead of the SkGpuDevice). This CL being moving the layer hoisting functionality to GrLayerHoister rather then dumping it straight into GrContext.

R=bsalomon@google.com

Author: robertphillips@google.com

Review URL: https://codereview.chromium.org/531733003
2014-09-02 10:20:50 -07:00
robertphillips
a8d7f0b13c Try out scalar picture sizes
This paves the way for removing the 'fTile' parameter from SkPictureShader (although that should be a different CL). If we like this we could also move to providing an entire cull SkRect.

R=reed@google.com, mtklein@google.com, fmalita@google.com, fmalita@chromium.org

Author: robertphillips@google.com

Review URL: https://codereview.chromium.org/513983002
2014-08-29 08:03:56 -07:00
robertphillips
d62833079f Switch GPU Optimization code to SkRecord
R=mtklein@google.com, bsalomon@google.com

Author: robertphillips@google.com

Review URL: https://codereview.chromium.org/504393002
2014-08-27 11:53:28 -07:00
mtklein
533eb782ed Convert BBH APIs to use SkRect.
Still TODO: convert internals of SkTileGrid.cpp and SkRTree.cpp to work in floats too.

NOTREECHECKS=true

BUG=skia:1021
R=robertphillips@google.com, reed@google.com, mtklein@google.com

Author: mtklein@chromium.org

Review URL: https://codereview.chromium.org/511613002
2014-08-27 10:39:42 -07:00
fmalita
b7425173f9 SkTextBlob plumbing
Add SkTextBlob serialization + drawTextBlob() overrides.

R=mtklein@google.com, reed@google.com, robertphillips@google.com
BUG=269080

Author: fmalita@chromium.org

Review URL: https://codereview.chromium.org/499413002
2014-08-26 07:56:44 -07:00
mtklein
53fecfb15d Our SkPicture::Analysis visitors should recurse into nested pictures.
BUG=skia:
R=tomhudson@google.com, mtklein@google.com, reed@google.com

Author: mtklein@chromium.org

Review URL: https://codereview.chromium.org/495793002
2014-08-21 09:11:38 -07:00
reed
9fa60daad4 Simplify flattening to just write enough to call the factory/public-constructor for the class. We want to *not* rely on private constructors, and not rely on calling through the inheritance hierarchy for either flattening or unflattening(CreateProc).
Refactoring pattern:

1. guard the existing constructor(readbuffer) with the legacy build-flag
2. If you are a instancable subclass, implement CreateProc(readbuffer) to create a new instances from the buffer params (or return NULL).

If you're a shader subclass
1. You must read/write the local matrix if your class accepts that in its factory/constructor, else ignore it.

R=robertphillips@google.com, mtklein@google.com, senorblanco@google.com, senorblanco@chromium.org, sugoi@chromium.org

Author: reed@google.com

Review URL: https://codereview.chromium.org/395603002
2014-08-21 07:59:51 -07:00
mtklein
7b705bb17e Always read .skp files and other serialized pictures into SkRecord.
This should switch all our internal tools that aren't clever about it over to SkRecord pictures.  (The clever tools know what they're doing.)

Also, deletes the old SkPicture::clone() path.  return this or die.

BUG=skia:
R=robertphillips@google.com, mtklein@google.com, reed@google.com

Author: mtklein@chromium.org

Review URL: https://codereview.chromium.org/481743003
2014-08-20 14:22:58 -07:00
mtklein
c551d9fcae Implement SkPicture::hasText() for SkRecord backend.
Plus, some small tweaks to the existing code surrounding it.  Just proposals,
will undo whatever you don't like.

BUG=skia:
R=mtklein@google.com, tomhudson@google.com, reed@google.com

Author: mtklein@chromium.org

Review URL: https://codereview.chromium.org/494683003
2014-08-20 08:09:46 -07:00
tomhudson
3a0f279167 Move the code over using the same template type approach previously used for willPlayBackBitmaps in http://skbug.com/2702.
Also unifies that flag and this one into a struct so they and others can be computed together. The struct is stored const to enforce lifetime expectations. Adds a few new cases to the unit test.

BUG=skia:2700
R=mtklein@google.com, reed@google.com, robertphillips@google.com, tomhudson@google.com

Committed: https://skia.googlesource.com/skia/+/60c2a79cfa8ceebcbafc243407564dc71f5e3b4f

Author: tomhudson@chromium.org

Review URL: https://codereview.chromium.org/364823009
2014-08-20 05:29:41 -07:00
Mike Klein
27dc17c297 Revert "Move the code over using the same template type approach previously used for willPlayBackBitmaps in http://skbug.com/2702."
This reverts commit 60c2a79cfa.

BUG=skia:

Review URL: https://codereview.chromium.org/481173003
2014-08-18 18:35:16 -04:00
tomhudson
60c2a79cfa Move the code over using the same template type approach previously used for willPlayBackBitmaps in http://skbug.com/2702.
Also unifies that flag and this one into a struct so they and others can be computed together. The struct is stored const to enforce lifetime expectations. Adds a few new cases to the unit test.

BUG=skia:2700
R=mtklein@google.com, reed@google.com, robertphillips@google.com, tomhudson@google.com

Author: tomhudson@chromium.org

Review URL: https://codereview.chromium.org/364823009
2014-08-18 15:07:13 -07:00
ajuma
750ae26745 Expose API for whether an SkPicture contains text
BUG=chromium:399728
R=reed@google.com, nduca@chromium.org

Author: ajuma@chromium.org

Review URL: https://codereview.chromium.org/478673002
2014-08-18 12:59:55 -07:00
mtklein
5a246bb487 int SkPicture::approximateOpCount()
NOTREECHECKS=true

BUG=skia:
R=reed@google.com, mtklein@google.com

Author: mtklein@chromium.org

Review URL: https://codereview.chromium.org/470333002
2014-08-14 19:17:21 -07:00
djsollen
3b6255493e Remove SkPaintOptionsAndroid
Committed: https://skia.googlesource.com/skia/+/f32331ffdb5de0440bb337aa7cbdd6f33e9ff23b

R=reed@google.com, mtklein@google.com, tomhudson@google.com

Author: djsollen@google.com

Review URL: https://codereview.chromium.org/447873003
2014-08-14 06:29:03 -07:00
bsalomon
c15e28a522 Revert of Remove SkPaintOptionsAndroid (patchset #5 of https://codereview.chromium.org/447873003/)
Reason for revert:
Breaks the Chromium build: http://108.170.220.120:10117/builders/Canary-Chrome-Ubuntu13.10-Ninja-x86_64-DRT/builds/2469/steps/BuildContentShell_1/logs/stdio

Original issue's description:
> Remove SkPaintOptionsAndroid
>
> Committed: https://skia.googlesource.com/skia/+/f32331ffdb5de0440bb337aa7cbdd6f33e9ff23b

R=reed@google.com, mtklein@google.com, tomhudson@google.com, djsollen@google.com
TBR=djsollen@google.com, mtklein@google.com, reed@google.com, tomhudson@google.com
NOTREECHECKS=true
NOTRY=true

Author: bsalomon@google.com

Review URL: https://codereview.chromium.org/473543004
2014-08-13 15:18:46 -07:00
djsollen
f32331ffdb Remove SkPaintOptionsAndroid
R=reed@google.com, mtklein@google.com, tomhudson@google.com

Author: djsollen@google.com

Review URL: https://codereview.chromium.org/447873003
2014-08-13 13:09:49 -07:00
mtklein
5ad6ee1b2c Plumbing for using a BBH in SkRecordDraw.
For now this only creates a degenerate bounding box hierarchy where all ops
just have maximal bounds.  I will flesh out FillBounds in future CL(s).

Not quite sure why QuadTree and TileGrid aren't drawing right---haven't even
looked at the diffs yet---so I've disabled those test modes for now.  RTree
seems fine, so that'll at least get us coverage for all this new plumbing.

BUG=skia:
R=robertphillips@google.com, mtklein@google.com, reed@google.com

Author: mtklein@chromium.org

Review URL: https://codereview.chromium.org/454123003
2014-08-11 08:08:43 -07:00
Derek Sollenberger
da7a944e29 Revert "Remove SkPaintOptionsAndroid"
This reverts commit 27fb94999b.

Review URL: https://codereview.chromium.org/450513002
2014-08-06 16:34:40 -04:00
Derek Sollenberger
27fb94999b Remove SkPaintOptionsAndroid
Review URL: https://codereview.chromium.org/447873003
2014-08-06 16:30:51 -04:00
senorblanco
55b6d8be99 Implement a persistent uniqueID-based cache for SkImageFilter.
Add a unique ID to SkImageFilter, and use it as part
of a persistent cache of image-filtered results. This is used for
caching frame-to-frame coherent filters.

We also keep track of which filter subtrees do not reference the
src input, and use a GenID of zero for the src input in that case.
That way, subtrees which are not dependent on the filter input can be
cached independently of it.

This gives approximately a 4X speedup on
letmespellitoutforyou.com/samples/svg/filter_terrain.svg on Z620
and Nexus10. The cache key consists of the uniqueID of the filter, the
clip bounds, the CTM and the genID of the input bitmap.

Since this does not yet handle the case where the input primitives
(and part of the resulting filter tree) are unchanged, we have
to keep around the external cache for that painting case.
When the work to cache unchanging input primitives is done, the
old cache can be removed, and the new UniqueIDCache will be renamed
to Cache.

R=bsalomon@google.com, mtklein@google.com

Author: senorblanco@chromium.org

Review URL: https://codereview.chromium.org/414483003
2014-07-30 11:26:46 -07:00
robertphillips
d771f6bc27 Add auto purging for SkPicture-related Ganesh resources (esp. layers)
This is intended to lower the bookkeeping burden for the Layer Caching feature. Cached layers are now automatically purged when a picture is deleted.

R=bsalomon@google.com

Author: robertphillips@google.com

Review URL: https://codereview.chromium.org/408923002
2014-07-22 10:18:06 -07:00
Robert Phillips
cfaeec446d Remove Skia's use of the default SkPicture constructor and multi-clone
This cannot be landed until (Chrome: Switch to one-at-a-time SkPicture::clone interface - https://codereview.chromium.org/380323002/) has landed.

R=mtklein@google.com
TBR=reed@google.com

Review URL: https://codereview.chromium.org/388833003
2014-07-13 12:00:50 -04:00
robertphillips
dd528967fc Remove SkPicture copy constructor
Given where we're heading with SkPicture why would you need to make a copy?

R=reed@google.com, mtklein@google.com

Author: robertphillips@google.com

Review URL: https://codereview.chromium.org/381133002
2014-07-13 07:55:53 -07:00