diff options
author | 2014-04-24 21:53:13 +0000 | |
---|---|---|
committer | 2014-04-24 21:53:13 +0000 | |
commit | e2cb12a82ad924f7b134a9459b190213485c6a50 (patch) | |
tree | f9527651ee8bdfa3975eed15b7a1b15d5f607805 /include/core | |
parent | d70fa2013adccaa52d1f3e6ca501a4d4ab1520f3 (diff) |
First pass at GPU veto
As a short term solution this CL collects information during the recording process for use in suitableForGpuRasterization.
BUG=366495
R=bsalomon@google.com, reed@google.com, alokp@chromium.org
Author: robertphillips@google.com
Review URL: https://codereview.chromium.org/251533004
git-svn-id: http://skia.googlecode.com/svn/trunk@14368 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'include/core')
-rw-r--r-- | include/core/SkPicture.h | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/include/core/SkPicture.h b/include/core/SkPicture.h index 8fa89656c9..f5d53c5592 100644 --- a/include/core/SkPicture.h +++ b/include/core/SkPicture.h @@ -365,6 +365,67 @@ private: SkAutoTUnref<SkPathHeap> fPathHeap; // reference counted + // ContentInfo is not serialized! It is intended solely for use + // with suitableForGpuRasterization. + class ContentInfo { + public: + ContentInfo() { this->reset(); } + + ContentInfo(const ContentInfo& src) { this->set(src); } + + void set(const ContentInfo& src) { + fNumPaintWithPathEffectUses = src.fNumPaintWithPathEffectUses; + fNumAAConcavePaths = src.fNumAAConcavePaths; + fNumAAHairlineConcavePaths = src.fNumAAHairlineConcavePaths; + } + + void reset() { + fNumPaintWithPathEffectUses = 0; + fNumAAConcavePaths = 0; + fNumAAHairlineConcavePaths = 0; + } + + void swap(ContentInfo* other) { + SkTSwap(fNumPaintWithPathEffectUses, other->fNumPaintWithPathEffectUses); + SkTSwap(fNumAAConcavePaths, other->fNumAAConcavePaths); + SkTSwap(fNumAAHairlineConcavePaths, other->fNumAAHairlineConcavePaths); + } + + // This field is incremented every time a paint with a path effect is + // used (i.e., it is not a de-duplicated count) + int fNumPaintWithPathEffectUses; + // This field is incremented every time an anti-aliased drawPath call is + // issued with a concave path + int fNumAAConcavePaths; + // This field is incremented every time a drawPath call is + // issued for a hairline stroked concave path. + int fNumAAHairlineConcavePaths; + }; + + ContentInfo fContentInfo; + + void incPaintWithPathEffectUses() { + ++fContentInfo.fNumPaintWithPathEffectUses; + } + int numPaintWithPathEffectUses() const { + return fContentInfo.fNumPaintWithPathEffectUses; + } + + void incAAConcavePaths() { + ++fContentInfo.fNumAAConcavePaths; + } + int numAAConcavePaths() const { + return fContentInfo.fNumAAConcavePaths; + } + + void incAAHairlineConcavePaths() { + ++fContentInfo.fNumAAHairlineConcavePaths; + SkASSERT(fContentInfo.fNumAAHairlineConcavePaths <= fContentInfo.fNumAAConcavePaths); + } + int numAAHairlineConcavePaths() const { + return fContentInfo.fNumAAHairlineConcavePaths; + } + const SkPath& getPath(int index) const; int addPathToHeap(const SkPath& path); |