diff options
author | mtklein <mtklein@google.com> | 2014-08-11 15:20:23 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-08-11 15:20:23 -0700 |
commit | 3b73e0163c03a2cb1ee9efa9fddb931751415026 (patch) | |
tree | c4ff484f4a5097daa7af5628b073899e14e2ab46 /src | |
parent | 4a2b2e8ed2e35171bf98bad68a69daaced11ec7c (diff) |
Revert of Add layer counting to SkPictureRecord (https://codereview.chromium.org/464433002/)
Reason for revert:
DM's all segfaulty
http://108.170.220.120:10117/builders/Test-Mac10.7-MacMini4.1-GeForce320M-x86_64-Debug/builds/3866/steps/RunDM/logs/stdio
Original issue's description:
> Add layer counting to SkPictureRecord
>
> This will be used for a SkPicture::suitableForOptimization entry point.
>
> Committed: https://skia.googlesource.com/skia/+/4a2b2e8ed2e35171bf98bad68a69daaced11ec7c
R=bsalomon@google.com, robertphillips@google.com
TBR=bsalomon@google.com, robertphillips@google.com
NOTREECHECKS=true
NOTRY=true
Author: mtklein@google.com
Review URL: https://codereview.chromium.org/452673003
Diffstat (limited to 'src')
-rw-r--r-- | src/core/SkPictureContentInfo.cpp | 68 | ||||
-rw-r--r-- | src/core/SkPictureContentInfo.h | 30 | ||||
-rw-r--r-- | src/core/SkPictureData.cpp | 3 | ||||
-rw-r--r-- | src/core/SkPictureData.h | 2 | ||||
-rw-r--r-- | src/core/SkPictureRecord.cpp | 24 | ||||
-rw-r--r-- | src/gpu/SkGpuDevice.cpp | 4 |
6 files changed, 5 insertions, 126 deletions
diff --git a/src/core/SkPictureContentInfo.cpp b/src/core/SkPictureContentInfo.cpp index 1d19f352f4..8185d850b8 100644 --- a/src/core/SkPictureContentInfo.cpp +++ b/src/core/SkPictureContentInfo.cpp @@ -71,62 +71,6 @@ void SkPictureContentInfo::onAddPaintPtr(const SkPaint* paint) { } } -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; @@ -134,10 +78,6 @@ void SkPictureContentInfo::set(const SkPictureContentInfo& src) { fNumFastPathDashEffects = src.fNumFastPathDashEffects; fNumAAConcavePaths = src.fNumAAConcavePaths; fNumAAHairlineConcavePaths = src.fNumAAHairlineConcavePaths; - fNumLayers = src.fNumLayers; - fNumInteriorLayers = src.fNumInteriorLayers; - fNumLeafLayers = src.fNumLeafLayers; - fSaveStack = src.fSaveStack; } void SkPictureContentInfo::reset() { @@ -147,10 +87,6 @@ void SkPictureContentInfo::reset() { fNumFastPathDashEffects = 0; fNumAAConcavePaths = 0; fNumAAHairlineConcavePaths = 0; - fNumLayers = 0; - fNumInteriorLayers = 0; - fNumLeafLayers = 0; - fSaveStack.rewind(); } void SkPictureContentInfo::swap(SkPictureContentInfo* other) { @@ -160,8 +96,4 @@ void SkPictureContentInfo::swap(SkPictureContentInfo* other) { SkTSwap(fNumFastPathDashEffects, other->fNumFastPathDashEffects); SkTSwap(fNumAAConcavePaths, other->fNumAAConcavePaths); SkTSwap(fNumAAHairlineConcavePaths, other->fNumAAHairlineConcavePaths); - 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 index d4d1d4fc5f..cfeedcf483 100644 --- a/src/core/SkPictureContentInfo.h +++ b/src/core/SkPictureContentInfo.h @@ -17,11 +17,6 @@ public: 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; } - bool suitableForGpuRasterization(GrContext* context, const char **reason, int sampleCount) const; @@ -32,12 +27,6 @@ public: 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); @@ -60,25 +49,6 @@ private: // This field is incremented every time a drawPath call is // issued for a hairline stroked concave path. int fNumAAHairlineConcavePaths; - // 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 ea9da79aa3..140ca88b34 100644 --- a/src/core/SkPictureData.cpp +++ b/src/core/SkPictureData.cpp @@ -617,9 +617,6 @@ bool SkPictureData::suitableForGpuRasterization(GrContext* context, const char * } } -bool SkPictureData::suitableForLayerOptimization() const { - return fContentInfo.numLayers() > 0; -} #endif /////////////////////////////////////////////////////////////////////////////// diff --git a/src/core/SkPictureData.h b/src/core/SkPictureData.h index 3e3ab59a44..e3f3d020e6 100644 --- a/src/core/SkPictureData.h +++ b/src/core/SkPictureData.h @@ -150,8 +150,6 @@ public: */ bool suitableForGpuRasterization(GrContext* context, const char **reason, GrPixelConfig config, SkScalar dpi) const; - - bool suitableForLayerOptimization() const; #endif private: diff --git a/src/core/SkPictureRecord.cpp b/src/core/SkPictureRecord.cpp index fc0b291912..d9239ddcca 100644 --- a/src/core/SkPictureRecord.cpp +++ b/src/core/SkPictureRecord.cpp @@ -151,8 +151,6 @@ void SkPictureRecord::willSave() { } void SkPictureRecord::recordSave() { - fContentInfo.onSave(); - // op only size_t size = kSaveSize; size_t initialOffset = this->addDraw(SAVE, &size); @@ -181,8 +179,6 @@ SkCanvas::SaveLayerStrategy SkPictureRecord::willSaveLayer(const SkRect* bounds, void SkPictureRecord::recordSaveLayer(const SkRect* bounds, const SkPaint* paint, SaveFlags flags) { - fContentInfo.onSaveLayer(); - // op + bool for 'bounds' size_t size = 2 * kUInt32Size; if (NULL != bounds) { @@ -512,10 +508,8 @@ enum PictureRecordOptType { }; enum PictureRecordOptFlags { - kSkipIfBBoxHierarchy_Flag = 0x1, // Optimization should be skipped if the - // SkPicture has a bounding box hierarchy. - kRescindLastSave_Flag = 0x2, - kRescindLastSaveLayer_Flag = 0x4, + kSkipIfBBoxHierarchy_Flag = 0x1, // Optimization should be skipped if the + // SkPicture has a bounding box hierarchy. }; struct PictureRecordOpt { @@ -534,10 +528,9 @@ static const PictureRecordOpt gPictureRecordOpts[] = { // SkPictureStateTree, and applying the optimization introduces significant // record time overhead because it requires rewinding contents that were // recorded into the BBoxHierarchy. - { collapse_save_clip_restore, kRewind_OptType, - kSkipIfBBoxHierarchy_Flag|kRescindLastSave_Flag }, - { remove_save_layer1, kCollapseSaveLayer_OptType, kRescindLastSaveLayer_Flag }, - { remove_save_layer2, kCollapseSaveLayer_OptType, kRescindLastSaveLayer_Flag } + { collapse_save_clip_restore, kRewind_OptType, kSkipIfBBoxHierarchy_Flag }, + { remove_save_layer1, kCollapseSaveLayer_OptType, 0 }, + { remove_save_layer2, kCollapseSaveLayer_OptType, 0 } }; // This is called after an optimization has been applied to the command stream @@ -592,11 +585,6 @@ void SkPictureRecord::willRestore() { // Some optimization fired so don't add the RESTORE apply_optimization_to_bbh(gPictureRecordOpts[opt].fType, fStateTree, fBoundingHierarchy); - if (gPictureRecordOpts[opt].fFlags & kRescindLastSave_Flag) { - fContentInfo.rescindLastSave(); - } else if (gPictureRecordOpts[opt].fFlags & kRescindLastSaveLayer_Flag) { - fContentInfo.rescindLastSaveLayer(); - } break; } } @@ -613,8 +601,6 @@ void SkPictureRecord::willRestore() { } void SkPictureRecord::recordRestore(bool fillInSkips) { - fContentInfo.onRestore(); - if (fillInSkips) { this->fillRestoreOffsetPlaceholdersForCurrentStackLevel((uint32_t)fWriter.bytesWritten()); } diff --git a/src/gpu/SkGpuDevice.cpp b/src/gpu/SkGpuDevice.cpp index f623f984fb..3e6bf1b6e4 100644 --- a/src/gpu/SkGpuDevice.cpp +++ b/src/gpu/SkGpuDevice.cpp @@ -1850,10 +1850,6 @@ SkSurface* SkGpuDevice::newSurface(const SkImageInfo& info) { void SkGpuDevice::EXPERIMENTAL_optimize(const SkPicture* picture) { fContext->getLayerCache()->processDeletedPictures(); - if (NULL != picture->fData.get() && picture->fData->suitableForLayerOptimization()) { - return; - } - SkPicture::AccelData::Key key = GPUAccelData::ComputeAccelDataKey(); const SkPicture::AccelData* existing = picture->EXPERIMENTAL_getAccelData(key); |