diff options
author | Brian Salomon <bsalomon@google.com> | 2018-01-26 12:17:43 -0500 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2018-01-26 18:51:40 +0000 |
commit | dcb086bd79665930f108444f1d3bcc6466dc346e (patch) | |
tree | 55bad1783f36d1828a710ef92a0c201211ea8ccf | |
parent | d08c682620a16e96301477de78d6189d55ef500d (diff) |
Remove unused SkPictureContentInfo
Change-Id: I398151efcd87b26345499f688403cf0a41d15e59
Reviewed-on: https://skia-review.googlesource.com/99783
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
-rw-r--r-- | gn/core.gni | 2 | ||||
-rw-r--r-- | src/core/SkPictureContentInfo.cpp | 140 | ||||
-rw-r--r-- | src/core/SkPictureContentInfo.h | 87 | ||||
-rw-r--r-- | src/core/SkPictureData.cpp | 2 | ||||
-rw-r--r-- | src/core/SkPictureData.h | 7 | ||||
-rw-r--r-- | src/core/SkPictureRecord.cpp | 13 | ||||
-rw-r--r-- | src/core/SkPictureRecord.h | 7 |
7 files changed, 0 insertions, 258 deletions
diff --git a/gn/core.gni b/gn/core.gni index f61887d54a..f0612cb973 100644 --- a/gn/core.gni +++ b/gn/core.gni @@ -217,8 +217,6 @@ skia_core_sources = [ "$_src/core/SkPathRef.cpp", "$_src/core/SkPicture.cpp", "$_src/core/SkPictureCommon.h", - "$_src/core/SkPictureContentInfo.cpp", - "$_src/core/SkPictureContentInfo.h", "$_src/core/SkPictureData.cpp", "$_src/core/SkPictureData.h", "$_src/core/SkPictureFlat.cpp", diff --git a/src/core/SkPictureContentInfo.cpp b/src/core/SkPictureContentInfo.cpp deleted file mode 100644 index 0afe8f2fb9..0000000000 --- a/src/core/SkPictureContentInfo.cpp +++ /dev/null @@ -1,140 +0,0 @@ -/* - * Copyright 2014 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#include "SkPaint.h" -#include "SkPathEffect.h" -#include "SkPictureContentInfo.h" - -void SkPictureContentInfo::onDrawPoints(size_t count, const SkPaint& paint) { - if (paint.getPathEffect() != nullptr) { - SkPathEffect::DashInfo info; - SkPathEffect::DashType dashType = paint.getPathEffect()->asADash(&info); - if (2 == count && SkPaint::kRound_Cap != paint.getStrokeCap() && - SkPathEffect::kDash_DashType == dashType && 2 == info.fCount) { - ++fNumFastPathDashEffects; - } - } -} - -void SkPictureContentInfo::onDrawPath(const SkPath& path, const SkPaint& paint) { - if (paint.isAntiAlias() && !path.isConvex()) { - ++fNumAAConcavePaths; - - SkPaint::Style paintStyle = paint.getStyle(); - const SkRect& pathBounds = path.getBounds(); - if (SkPaint::kStroke_Style == paint.getStyle() && 0 == paint.getStrokeWidth()) { - ++fNumAAHairlineConcavePaths; - } else if (SkPaint::kFill_Style == paintStyle && pathBounds.width() < 64.f && - pathBounds.height() < 64.f && !path.isVolatile()) { - ++fNumAADFEligibleConcavePaths; - } - } -} - -void SkPictureContentInfo::onAddPaintPtr(const SkPaint* paint) { - if (paint && paint->getPathEffect()) { - ++fNumPaintWithPathEffectUses; - } -} - -void SkPictureContentInfo::onSaveLayer() { - *fSaveStack.append() = kSaveLayer_Flag; -} - -void SkPictureContentInfo::onSave() { - *fSaveStack.append() = kSave_Flag; -} - -void SkPictureContentInfo::onRestore() { - SkASSERT(fSaveStack.count() > 0); - - bool containedSaveLayer = fSaveStack.top() & kContainedSaveLayer_Flag; - - if (fSaveStack.top() & kSaveLayer_Flag) { - ++fNumLayers; - if (containedSaveLayer) { - ++fNumInteriorLayers; - } else { - ++fNumLeafLayers; - } - containedSaveLayer = true; - } - - fSaveStack.pop(); - - if (containedSaveLayer && fSaveStack.count() > 0) { - fSaveStack.top() |= kContainedSaveLayer_Flag; - } -} - -void SkPictureContentInfo::rescindLastSave() { - SkASSERT(fSaveStack.count() > 0); - SkASSERT(fSaveStack.top() & kSave_Flag); - - bool containedSaveLayer = fSaveStack.top() & kContainedSaveLayer_Flag; - - fSaveStack.pop(); - - if (containedSaveLayer && fSaveStack.count() > 0) { - fSaveStack.top() |= kContainedSaveLayer_Flag; - } -} - -void SkPictureContentInfo::rescindLastSaveLayer() { - SkASSERT(fSaveStack.count() > 0); - SkASSERT(fSaveStack.top() & kSaveLayer_Flag); - - bool containedSaveLayer = fSaveStack.top() & kContainedSaveLayer_Flag; - - fSaveStack.pop(); - - if (containedSaveLayer && fSaveStack.count() > 0) { - fSaveStack.top() |= kContainedSaveLayer_Flag; - } -} - -void SkPictureContentInfo::set(const SkPictureContentInfo& src) { - fNumOperations = src.fNumOperations; - fNumTexts = src.fNumTexts; - fNumPaintWithPathEffectUses = src.fNumPaintWithPathEffectUses; - fNumFastPathDashEffects = src.fNumFastPathDashEffects; - fNumAAConcavePaths = src.fNumAAConcavePaths; - fNumAAHairlineConcavePaths = src.fNumAAHairlineConcavePaths; - fNumAADFEligibleConcavePaths = src.fNumAADFEligibleConcavePaths; - fNumLayers = src.fNumLayers; - fNumInteriorLayers = src.fNumInteriorLayers; - fNumLeafLayers = src.fNumLeafLayers; - fSaveStack = src.fSaveStack; -} - -void SkPictureContentInfo::reset() { - fNumOperations = 0; - fNumTexts = 0; - fNumPaintWithPathEffectUses = 0; - fNumFastPathDashEffects = 0; - fNumAAConcavePaths = 0; - fNumAAHairlineConcavePaths = 0; - fNumAADFEligibleConcavePaths = 0; - fNumLayers = 0; - fNumInteriorLayers = 0; - fNumLeafLayers = 0; - fSaveStack.rewind(); -} - -void SkPictureContentInfo::swap(SkPictureContentInfo* other) { - SkTSwap(fNumOperations, other->fNumOperations); - SkTSwap(fNumTexts, other->fNumTexts); - SkTSwap(fNumPaintWithPathEffectUses, other->fNumPaintWithPathEffectUses); - SkTSwap(fNumFastPathDashEffects, other->fNumFastPathDashEffects); - SkTSwap(fNumAAConcavePaths, other->fNumAAConcavePaths); - SkTSwap(fNumAAHairlineConcavePaths, other->fNumAAHairlineConcavePaths); - SkTSwap(fNumAADFEligibleConcavePaths, other->fNumAADFEligibleConcavePaths); - SkTSwap(fNumLayers, other->fNumLayers); - SkTSwap(fNumInteriorLayers, other->fNumInteriorLayers); - SkTSwap(fNumLeafLayers, other->fNumLeafLayers); - fSaveStack.swap(other->fSaveStack); -} diff --git a/src/core/SkPictureContentInfo.h b/src/core/SkPictureContentInfo.h deleted file mode 100644 index cc5ac3dce0..0000000000 --- a/src/core/SkPictureContentInfo.h +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Copyright 2014 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkPictureContentInfo_DEFINED -#define SkPictureContentInfo_DEFINED - -#include "SkPaint.h" -#include "SkTDArray.h" - -class GrContext; - -class SkPictureContentInfo { -public: - SkPictureContentInfo() { this->reset(); } - SkPictureContentInfo(const SkPictureContentInfo& src) { this->set(src); } - - int numOperations() const { return fNumOperations; } - bool hasText() const { return fNumTexts > 0; } - - int numLayers() const { return fNumLayers; } - int numInteriorLayers() const { return fNumInteriorLayers; } - int numLeafLayers() const { return fNumLeafLayers; } - - void addOperation() { ++fNumOperations; } - - void onDrawPoints(size_t count, const SkPaint& paint); - void onDrawPath(const SkPath& path, const SkPaint& paint); - void onAddPaintPtr(const SkPaint* paint); - void onDrawText() { ++fNumTexts; } - - void onSaveLayer(); - void onSave(); - void onRestore(); - void rescindLastSave(); - void rescindLastSaveLayer(); - - void set(const SkPictureContentInfo& src); - void reset(); - void swap(SkPictureContentInfo* other); - -private: - // Raw count of operations in the picture - int fNumOperations; - // Count of all forms of drawText - int fNumTexts; - - // 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 a paint with a path effect that is - // dashed, we are drawing a line, and we can use the gpu fast path - int fNumFastPathDashEffects; - // 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; - // This field is incremented every time a drawPath call is - // issued for a concave path that can be rendered with distance fields - int fNumAADFEligibleConcavePaths; - // These fields track the different layer flavors. fNumLayers is just - // a count of all saveLayers, fNumInteriorLayers is the number of layers - // with a layer inside them, fNumLeafLayers is the number of layers with - // no layer inside them. - int fNumLayers; - int fNumInteriorLayers; - int fNumLeafLayers; - - enum Flags { - kSave_Flag = 0x1, - kSaveLayer_Flag = 0x2, - - // Did the current save or saveLayer contain another saveLayer. - // Percolated back down the save stack. - kContainedSaveLayer_Flag = 0x4 - }; - - // Stack of save vs saveLayer information to track nesting - SkTDArray<uint32_t> fSaveStack; -}; - -#endif diff --git a/src/core/SkPictureData.cpp b/src/core/SkPictureData.cpp index d4f361839a..3024e5cfa3 100644 --- a/src/core/SkPictureData.cpp +++ b/src/core/SkPictureData.cpp @@ -44,8 +44,6 @@ SkPictureData::SkPictureData(const SkPictureRecord& record, fOpData = record.opData(); - fContentInfo.set(record.fContentInfo); - fPaints = record.fPaints; fPaths.reset(record.fPaths.count()); diff --git a/src/core/SkPictureData.h b/src/core/SkPictureData.h index 8fb5918c27..0927f7727a 100644 --- a/src/core/SkPictureData.h +++ b/src/core/SkPictureData.h @@ -11,7 +11,6 @@ #include "SkBitmap.h" #include "SkDrawable.h" #include "SkPicture.h" -#include "SkPictureContentInfo.h" #include "SkPictureFlat.h" class SkData; @@ -81,10 +80,6 @@ public: void serialize(SkWStream*, const SkSerialProcs&, SkRefCntSet*) const; void flatten(SkWriteBuffer&) const; - bool hasText() const { return fContentInfo.hasText(); } - - int opCount() const { return fContentInfo.numOperations(); } - const sk_sp<SkData>& opData() const { return fOpData; } protected: @@ -169,8 +164,6 @@ private: const SkImage** fBitmapImageRefs; int fBitmapImageCount; - SkPictureContentInfo fContentInfo; - SkTypefacePlayback fTFPlayback; SkFactoryPlayback* fFactoryPlayback; diff --git a/src/core/SkPictureRecord.cpp b/src/core/SkPictureRecord.cpp index 911cecae38..6268584aa0 100644 --- a/src/core/SkPictureRecord.cpp +++ b/src/core/SkPictureRecord.cpp @@ -60,8 +60,6 @@ void SkPictureRecord::willSave() { } void SkPictureRecord::recordSave() { - fContentInfo.onSave(); - // op only size_t size = sizeof(kUInt32Size); size_t initialOffset = this->addDraw(SAVE, &size); @@ -85,8 +83,6 @@ SkCanvas::SaveLayerStrategy SkPictureRecord::getSaveLayerStrategy(const SaveLaye } void SkPictureRecord::recordSaveLayer(const SaveLayerRec& rec) { - fContentInfo.onSaveLayer(); - // op + flatflags size_t size = 2 * kUInt32Size; uint32_t flatFlags = 0; @@ -177,8 +173,6 @@ void SkPictureRecord::willRestore() { } void SkPictureRecord::recordRestore(bool fillInSkips) { - fContentInfo.onRestore(); - if (fillInSkips) { this->fillRestoreOffsetPlaceholdersForCurrentStackLevel((uint32_t)fWriter.bytesWritten()); } @@ -417,8 +411,6 @@ void SkPictureRecord::onDrawPaint(const SkPaint& paint) { void SkPictureRecord::onDrawPoints(PointMode mode, size_t count, const SkPoint pts[], const SkPaint& paint) { - fContentInfo.onDrawPoints(count, paint); - // op + paint index + mode + count + point data size_t size = 4 * kUInt32Size + count * sizeof(SkPoint); size_t initialOffset = this->addDraw(DRAW_POINTS, &size); @@ -493,8 +485,6 @@ void SkPictureRecord::onDrawDRRect(const SkRRect& outer, const SkRRect& inner, } void SkPictureRecord::onDrawPath(const SkPath& path, const SkPaint& paint) { - fContentInfo.onDrawPath(path, paint); - // op + paint index + path index size_t size = 3 * kUInt32Size; size_t initialOffset = this->addDraw(DRAW_PATH, &size); @@ -839,8 +829,6 @@ void SkPictureRecord::addMatrix(const SkMatrix& matrix) { } void SkPictureRecord::addPaintPtr(const SkPaint* paint) { - fContentInfo.onAddPaintPtr(paint); - if (paint) { fPaints.push_back(*paint); this->addInt(fPaints.count()); @@ -924,7 +912,6 @@ void SkPictureRecord::addRegion(const SkRegion& region) { } void SkPictureRecord::addText(const void* text, size_t byteLength) { - fContentInfo.onDrawText(); addInt(SkToInt(byteLength)); fWriter.writePad(text, byteLength); } diff --git a/src/core/SkPictureRecord.h b/src/core/SkPictureRecord.h index 4b6750cd93..f67573d717 100644 --- a/src/core/SkPictureRecord.h +++ b/src/core/SkPictureRecord.h @@ -61,10 +61,6 @@ public: return fWriter.snapshotAsData(); } - const SkPictureContentInfo& contentInfo() const { - return fContentInfo; - } - void setFlags(uint32_t recordFlags) { fRecordFlags = recordFlags; } @@ -104,7 +100,6 @@ private: size_t offset = fWriter.bytesWritten(); this->predrawNotify(); - fContentInfo.addOperation(); SkASSERT(0 != *size); SkASSERT(((uint8_t) drawType) == drawType); @@ -246,8 +241,6 @@ protected: } private: - SkPictureContentInfo fContentInfo; - SkTArray<SkPaint> fPaints; struct PathHash { |