diff options
author | mtklein <mtklein@chromium.org> | 2014-12-12 08:46:25 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-12-12 08:46:25 -0800 |
commit | f0f14113431ace669f278fdd97b50950f2cf4c80 (patch) | |
tree | 1fab64f424d97fdd089622f10b3d5335bc4f1380 /src | |
parent | 59dba146fe4170c4986b2494414c08be2c93d4a2 (diff) |
Cull pushCull and popCull from Skia.
These calls are unused and going away. Waiting on crrev.com/796083002.
BUG=skia:
Review URL: https://codereview.chromium.org/794263002
Diffstat (limited to 'src')
-rw-r--r-- | src/core/SkCanvas.cpp | 69 | ||||
-rw-r--r-- | src/core/SkPictureFlat.h | 4 | ||||
-rw-r--r-- | src/core/SkPicturePlayback.cpp | 14 | ||||
-rw-r--r-- | src/core/SkPictureRecord.cpp | 30 | ||||
-rw-r--r-- | src/core/SkPictureRecord.h | 2 | ||||
-rw-r--r-- | src/core/SkRecordDraw.cpp | 4 | ||||
-rw-r--r-- | src/core/SkRecorder.cpp | 8 | ||||
-rw-r--r-- | src/core/SkRecorder.h | 3 | ||||
-rw-r--r-- | src/core/SkRecords.h | 5 | ||||
-rw-r--r-- | src/utils/SkDumpCanvas.cpp | 9 | ||||
-rw-r--r-- | src/utils/debugger/SkDebugCanvas.cpp | 22 | ||||
-rw-r--r-- | src/utils/debugger/SkDebugCanvas.h | 8 | ||||
-rw-r--r-- | src/utils/debugger/SkDrawCommand.cpp | 26 | ||||
-rw-r--r-- | src/utils/debugger/SkDrawCommand.h | 35 |
14 files changed, 11 insertions, 228 deletions
diff --git a/src/core/SkCanvas.cpp b/src/core/SkCanvas.cpp index 294562ad92..a72b58c7cb 100644 --- a/src/core/SkCanvas.cpp +++ b/src/core/SkCanvas.cpp @@ -417,7 +417,6 @@ SkBaseDevice* SkCanvas::init(SkBaseDevice* device, InitFlags flags) { fDeviceCMDirty = true; fSaveCount = 1; fSaveLayerCount = 0; - fCullCount = 0; fMetaData = NULL; fMCRec = (MCRec*)fMCStack.push_back(); @@ -696,7 +695,7 @@ bool SkCanvas::readPixels(const SkImageInfo& dstInfo, void* dstP, size_t rowByte return false; } const SkISize size = this->getBaseLayerSize(); - + SkReadPixelsRec rec(dstInfo, dstP, rowBytes, x, y); if (!rec.trim(size.width(), size.height())) { return false; @@ -844,7 +843,7 @@ void SkCanvas::restoreToCount(int count) { if (count < 1) { count = 1; } - + int n = this->getSaveCount() - count; for (int i = 0; i < n; ++i) { this->restore(); @@ -1119,71 +1118,7 @@ bool SkAutoROCanvasPixels::asROBitmap(SkBitmap* bitmap) const { } } -void SkCanvas::onPushCull(const SkRect& cullRect) { - // do nothing. Subclasses may do something -} - -void SkCanvas::onPopCull() { - // do nothing. Subclasses may do something -} - ///////////////////////////////////////////////////////////////////////////// -#ifdef SK_DEBUG -// Ensure that cull rects are monotonically nested in device space. -void SkCanvas::validateCull(const SkIRect& devCull) { - if (fCullStack.isEmpty() - || devCull.isEmpty() - || fCullStack.top().contains(devCull)) { - return; - } - - SkDEBUGF(("Invalid cull: [%d %d %d %d] (previous cull: [%d %d %d %d])\n", - devCull.x(), devCull.y(), devCull.right(), devCull.bottom(), - fCullStack.top().x(), fCullStack.top().y(), - fCullStack.top().right(), fCullStack.top().bottom())); - -#ifdef ASSERT_NESTED_CULLING - SkDEBUGFAIL("Invalid cull."); -#endif -} -#endif - -void SkCanvas::pushCull(const SkRect& cullRect) { - this->checkForDeferredSave(); - ++fCullCount; - this->onPushCull(cullRect); - -#ifdef SK_DEBUG - // Map the cull rect into device space. - SkRect mappedCull; - this->getTotalMatrix().mapRect(&mappedCull, cullRect); - - // Take clipping into account. - SkIRect devClip, devCull; - mappedCull.roundOut(&devCull); - this->getClipDeviceBounds(&devClip); - if (!devCull.intersect(devClip)) { - devCull.setEmpty(); - } - - this->validateCull(devCull); - fCullStack.push(devCull); // balanced in popCull -#endif -} - -void SkCanvas::popCull() { - SkASSERT(fCullStack.count() == fCullCount); - - if (fCullCount > 0) { - --fCullCount; - this->onPopCull(); - - SkDEBUGCODE(fCullStack.pop()); - } -} - -///////////////////////////////////////////////////////////////////////////// - void SkCanvas::internalDrawBitmap(const SkBitmap& bitmap, const SkMatrix& matrix, const SkPaint* paint) { if (bitmap.drawsNothing()) { diff --git a/src/core/SkPictureFlat.h b/src/core/SkPictureFlat.h index 73248051eb..103eeceb16 100644 --- a/src/core/SkPictureFlat.h +++ b/src/core/SkPictureFlat.h @@ -63,8 +63,8 @@ enum DrawType { // new ops -- feel free to re-alphabetize on next version bump DRAW_DRRECT, - PUSH_CULL, - POP_CULL, + PUSH_CULL, // deprecated, M41 was last Chromium version to write this to an .skp + POP_CULL, // deprecated, M41 was last Chromium version to write this to an .skp DRAW_PATCH, // could not add in aphabetical order DRAW_PICTURE_MATRIX_PAINT, diff --git a/src/core/SkPicturePlayback.cpp b/src/core/SkPicturePlayback.cpp index b4cac52dd4..1c9b13e445 100644 --- a/src/core/SkPicturePlayback.cpp +++ b/src/core/SkPicturePlayback.cpp @@ -148,18 +148,8 @@ void SkPicturePlayback::handleOp(SkReader32* reader, reader->setOffset(offsetToRestore); } } break; - case PUSH_CULL: { - const SkRect& cullRect = reader->skipT<SkRect>(); - size_t offsetToRestore = reader->readInt(); - if (offsetToRestore && canvas->quickReject(cullRect)) { - reader->setOffset(offsetToRestore); - } else { - canvas->pushCull(cullRect); - } - } break; - case POP_CULL: - canvas->popCull(); - break; + case PUSH_CULL: break; // Deprecated, safe to ignore both push and pop. + case POP_CULL: break; case CONCAT: { SkMatrix matrix; reader->readMatrix(&matrix); diff --git a/src/core/SkPictureRecord.cpp b/src/core/SkPictureRecord.cpp index 67c4229e3d..eec6bc0bcb 100644 --- a/src/core/SkPictureRecord.cpp +++ b/src/core/SkPictureRecord.cpp @@ -847,36 +847,6 @@ void SkPictureRecord::endCommentGroup() { this->validate(initialOffset, size); } -// [op/size] [rect] [skip offset] -static const uint32_t kPushCullOpSize = 2 * kUInt32Size + sizeof(SkRect); -void SkPictureRecord::onPushCull(const SkRect& cullRect) { - size_t size = kPushCullOpSize; - size_t initialOffset = this->addDraw(PUSH_CULL, &size); - // PUSH_CULL's size should stay constant (used to rewind). - SkASSERT(size == kPushCullOpSize); - - this->addRect(cullRect); - fCullOffsetStack.push(SkToU32(fWriter.bytesWritten())); - this->addInt(0); - this->validate(initialOffset, size); -} - -void SkPictureRecord::onPopCull() { - SkASSERT(!fCullOffsetStack.isEmpty()); - - uint32_t cullSkipOffset = fCullOffsetStack.top(); - fCullOffsetStack.pop(); - - // op only - size_t size = kUInt32Size; - size_t initialOffset = this->addDraw(POP_CULL, &size); - - // update the cull skip offset to point past this op. - fWriter.overwriteTAt<uint32_t>(cullSkipOffset, SkToU32(fWriter.bytesWritten())); - - this->validate(initialOffset, size); -} - /////////////////////////////////////////////////////////////////////////////// SkSurface* SkPictureRecord::onNewSurface(const SkImageInfo& info, const SkSurfaceProps&) { diff --git a/src/core/SkPictureRecord.h b/src/core/SkPictureRecord.h index e8ce4bde56..facf30d748 100644 --- a/src/core/SkPictureRecord.h +++ b/src/core/SkPictureRecord.h @@ -186,8 +186,6 @@ protected: virtual void didSetMatrix(const SkMatrix&) SK_OVERRIDE; virtual void onDrawDRRect(const SkRRect&, const SkRRect&, const SkPaint&) SK_OVERRIDE; - virtual void onPushCull(const SkRect&) SK_OVERRIDE; - virtual void onPopCull() SK_OVERRIDE; virtual void onDrawText(const void* text, size_t byteLength, SkScalar x, SkScalar y, const SkPaint&) SK_OVERRIDE; diff --git a/src/core/SkRecordDraw.cpp b/src/core/SkRecordDraw.cpp index b714e75901..86621f2170 100644 --- a/src/core/SkRecordDraw.cpp +++ b/src/core/SkRecordDraw.cpp @@ -81,8 +81,6 @@ template <> void Draw::draw(const NoOp&) {} DRAW(Restore, restore()); DRAW(Save, save()); DRAW(SaveLayer, saveLayer(r.bounds, r.paint, r.flags)); -DRAW(PopCull, popCull()); -DRAW(PushCull, pushCull(r.rect)); DRAW(Clear, clear(r.color)); DRAW(SetMatrix, setMatrix(SkMatrix::Concat(fInitialCTM, r.matrix))); @@ -286,8 +284,6 @@ private: void trackBounds(const ClipRRect&) { this->pushControl(); } void trackBounds(const ClipPath&) { this->pushControl(); } void trackBounds(const ClipRegion&) { this->pushControl(); } - void trackBounds(const PushCull&) { this->pushControl(); } - void trackBounds(const PopCull&) { this->pushControl(); } void trackBounds(const BeginCommentGroup&) { this->pushControl(); } void trackBounds(const AddComment&) { this->pushControl(); } void trackBounds(const EndCommentGroup&) { this->pushControl(); } diff --git a/src/core/SkRecorder.cpp b/src/core/SkRecorder.cpp index e29d43d7d8..71a1167543 100644 --- a/src/core/SkRecorder.cpp +++ b/src/core/SkRecorder.cpp @@ -295,14 +295,6 @@ void SkRecorder::didRestore() { APPEND(Restore, this->devBounds(), this->getTotalMatrix()); } -void SkRecorder::onPushCull(const SkRect& rect) { - APPEND(PushCull, rect); -} - -void SkRecorder::onPopCull() { - APPEND(PopCull); -} - void SkRecorder::didConcat(const SkMatrix& matrix) { this->didSetMatrix(this->getTotalMatrix()); } diff --git a/src/core/SkRecorder.h b/src/core/SkRecorder.h index 102aac5a1d..5d80ac107d 100644 --- a/src/core/SkRecorder.h +++ b/src/core/SkRecorder.h @@ -130,9 +130,6 @@ public: void onDrawPicture(const SkPicture*, const SkMatrix*, const SkPaint*) SK_OVERRIDE; - void onPushCull(const SkRect& cullRect) SK_OVERRIDE; - void onPopCull() SK_OVERRIDE; - void beginCommentGroup(const char*) SK_OVERRIDE; void addComment(const char*, const char*) SK_OVERRIDE; void endCommentGroup() SK_OVERRIDE; diff --git a/src/core/SkRecords.h b/src/core/SkRecords.h index d8dfb2b937..ed5eaf3491 100644 --- a/src/core/SkRecords.h +++ b/src/core/SkRecords.h @@ -30,8 +30,6 @@ namespace SkRecords { M(Restore) \ M(Save) \ M(SaveLayer) \ - M(PushCull) \ - M(PopCull) \ M(SetMatrix) \ M(ClipPath) \ M(ClipRRect) \ @@ -225,9 +223,6 @@ RECORD2(Restore, SkIRect, devBounds, TypedMatrix, matrix); RECORD0(Save); RECORD3(SaveLayer, Optional<SkRect>, bounds, Optional<SkPaint>, paint, SkCanvas::SaveFlags, flags); -RECORD1(PushCull, SkRect, rect); -RECORD0(PopCull); - RECORD1(SetMatrix, TypedMatrix, matrix); struct RegionOpAndAA { diff --git a/src/utils/SkDumpCanvas.cpp b/src/utils/SkDumpCanvas.cpp index b7867a69db..d6192482f0 100644 --- a/src/utils/SkDumpCanvas.cpp +++ b/src/utils/SkDumpCanvas.cpp @@ -292,15 +292,6 @@ void SkDumpCanvas::onClipRegion(const SkRegion& deviceRgn, SkRegion::Op op) { this->INHERITED::onClipRegion(deviceRgn, op); } -void SkDumpCanvas::onPushCull(const SkRect& cullRect) { - SkString str; - toString(cullRect, &str); - this->dump(kCull_Verb, NULL, "pushCull(%s)", str.c_str()); -} - -void SkDumpCanvas::onPopCull() { - this->dump(kCull_Verb, NULL, "popCull()"); -} /////////////////////////////////////////////////////////////////////////////// void SkDumpCanvas::drawPaint(const SkPaint& paint) { diff --git a/src/utils/debugger/SkDebugCanvas.cpp b/src/utils/debugger/SkDebugCanvas.cpp index 40277b047e..f2f92b8492 100644 --- a/src/utils/debugger/SkDebugCanvas.cpp +++ b/src/utils/debugger/SkDebugCanvas.cpp @@ -209,7 +209,6 @@ private: // return true in their 'active' method void SkDebugCanvas::markActiveCommands(int index) { fActiveLayers.rewind(); - fActiveCulls.rewind(); for (int i = 0; i < fCommandVector.count(); ++i) { fCommandVector[i]->setActive(false); @@ -221,10 +220,6 @@ void SkDebugCanvas::markActiveCommands(int index) { fActiveLayers.push(fCommandVector[i]); } else if (SkDrawCommand::kPopLayer_Action == result) { fActiveLayers.pop(); - } else if (SkDrawCommand::kPushCull_Action == result) { - fActiveCulls.push(fCommandVector[i]); - } else if (SkDrawCommand::kPopCull_Action == result) { - fActiveCulls.pop(); } } @@ -232,9 +227,6 @@ void SkDebugCanvas::markActiveCommands(int index) { fActiveLayers[i]->setActive(true); } - for (int i = 0; i < fActiveCulls.count(); ++i) { - fActiveCulls[i]->setActive(true); - } } void SkDebugCanvas::drawTo(SkCanvas* canvas, int index) { @@ -315,7 +307,7 @@ void SkDebugCanvas::drawTo(SkCanvas* canvas, int index) { } if (fMegaVizMode) { - SkRect r = SkRect::MakeWH(SkIntToScalar(fWindowSize.fWidth), + SkRect r = SkRect::MakeWH(SkIntToScalar(fWindowSize.fWidth), SkIntToScalar(fWindowSize.fHeight)); r.outset(SK_Scalar1, SK_Scalar1); @@ -505,8 +497,8 @@ void SkDebugCanvas::drawPath(const SkPath& path, const SkPaint& paint) { this->addDrawCommand(new SkDrawPathCommand(path, paint)); } -void SkDebugCanvas::onDrawPicture(const SkPicture* picture, - const SkMatrix* matrix, +void SkDebugCanvas::onDrawPicture(const SkPicture* picture, + const SkMatrix* matrix, const SkPaint* paint) { this->addDrawCommand(new SkDrawPictureCommand(picture, matrix, paint)); } @@ -570,14 +562,6 @@ void SkDebugCanvas::drawVertices(VertexMode vmode, int vertexCount, texs, colors, NULL, indices, indexCount, paint)); } -void SkDebugCanvas::onPushCull(const SkRect& cullRect) { - this->addDrawCommand(new SkPushCullCommand(cullRect)); -} - -void SkDebugCanvas::onPopCull() { - this->addDrawCommand(new SkPopCullCommand()); -} - void SkDebugCanvas::willRestore() { this->addDrawCommand(new SkRestoreCommand()); this->INHERITED::willRestore(); diff --git a/src/utils/debugger/SkDebugCanvas.h b/src/utils/debugger/SkDebugCanvas.h index 6ec26e2581..18f4c8d713 100644 --- a/src/utils/debugger/SkDebugCanvas.h +++ b/src/utils/debugger/SkDebugCanvas.h @@ -237,8 +237,6 @@ protected: const SkMatrix* matrix, const SkPaint&) SK_OVERRIDE; virtual void onDrawTextBlob(const SkTextBlob* blob, SkScalar x, SkScalar y, const SkPaint& paint) SK_OVERRIDE; - virtual void onPushCull(const SkRect& cullRect) SK_OVERRIDE; - virtual void onPopCull() SK_OVERRIDE; virtual void onClipRect(const SkRect&, SkRegion::Op, ClipEdgeStyle) SK_OVERRIDE; virtual void onClipRRect(const SkRRect&, SkRegion::Op, ClipEdgeStyle) SK_OVERRIDE; @@ -286,12 +284,6 @@ private: SkTDArray<SkDrawCommand*> fActiveLayers; /** - The active cull commands at a given point in the rendering. - Only used when "mega" visualization is enabled. - */ - SkTDArray<SkDrawCommand*> fActiveCulls; - - /** Adds the command to the classes vector of commands. @param command The draw command for execution */ diff --git a/src/utils/debugger/SkDrawCommand.cpp b/src/utils/debugger/SkDrawCommand.cpp index 02beee7ced..e7989cc001 100644 --- a/src/utils/debugger/SkDrawCommand.cpp +++ b/src/utils/debugger/SkDrawCommand.cpp @@ -65,8 +65,6 @@ const char* SkDrawCommand::GetCommandString(DrawType type) { case COMMENT: return "Comment"; case END_COMMENT_GROUP: return "EndCommentGroup"; case DRAW_DRRECT: return "Draw DRRect"; - case PUSH_CULL: return "PushCull"; - case POP_CULL: return "PopCull"; default: SkDebugf("DrawType error 0x%08x\n", type); SkASSERT(0); @@ -972,27 +970,3 @@ void SkTranslateCommand::execute(SkCanvas* canvas) const { canvas->translate(fDx, fDy); } -SkPushCullCommand::SkPushCullCommand(const SkRect& cullRect) - : INHERITED(PUSH_CULL) - , fCullRect(cullRect) { - fInfo.push(SkObjectParser::RectToString(cullRect)); -} - -void SkPushCullCommand::execute(SkCanvas* canvas) const { - canvas->pushCull(fCullRect); -} - -void SkPushCullCommand::vizExecute(SkCanvas* canvas) const { - canvas->pushCull(fCullRect); - - SkPaint p; - p.setColor(SK_ColorCYAN); - p.setStyle(SkPaint::kStroke_Style); - canvas->drawRect(fCullRect, p); -} - -SkPopCullCommand::SkPopCullCommand() : INHERITED(POP_CULL) { } - -void SkPopCullCommand::execute(SkCanvas* canvas) const { - canvas->popCull(); -} diff --git a/src/utils/debugger/SkDrawCommand.h b/src/utils/debugger/SkDrawCommand.h index 6da419e23a..951d15e195 100644 --- a/src/utils/debugger/SkDrawCommand.h +++ b/src/utils/debugger/SkDrawCommand.h @@ -46,23 +46,16 @@ public: subclasses to track unresolved save() calls. */ virtual void trackSaveState(int* state) {} - // The next "active" system is only used by save, saveLayer, restore, - // pushCull and popCull. It is used in two ways: - // To determine which saveLayers are currently active (at a + // The next "active" system is only used by save, saveLayer, and restore. + // It is used to determine which saveLayers are currently active (at a // given point in the rendering). // saves just return a kPushLayer action but don't track active state // restores just return a kPopLayer action // saveLayers return kPushLayer but also track the active state - // To determine which culls are currently active (at a given point) - // in the rendering). - // pushCulls return a kPushCull action - // popCulls return a kPopCull action enum Action { kNone_Action, kPopLayer_Action, kPushLayer_Action, - kPopCull_Action, - kPushCull_Action }; virtual Action action() const { return kNone_Action; } virtual void setActive(bool active) {} @@ -613,28 +606,4 @@ private: typedef SkDrawCommand INHERITED; }; -class SkPushCullCommand : public SkDrawCommand { -public: - SkPushCullCommand(const SkRect&); - virtual void execute(SkCanvas*) const SK_OVERRIDE; - virtual void vizExecute(SkCanvas* canvas) const SK_OVERRIDE; - virtual Action action() const { return kPushCull_Action; } - virtual void setActive(bool active) { fActive = active; } - virtual bool active() const { return fActive; } -private: - SkRect fCullRect; - bool fActive; - - typedef SkDrawCommand INHERITED; -}; - -class SkPopCullCommand : public SkDrawCommand { -public: - SkPopCullCommand(); - virtual void execute(SkCanvas* canvas) const SK_OVERRIDE; - virtual Action action() const { return kPopCull_Action; } -private: - typedef SkDrawCommand INHERITED; -}; - #endif |