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/core | |
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/core')
-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 |
9 files changed, 6 insertions, 133 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 { |