From c654e9016a15985ebeb24f94f819d113ad48a251 Mon Sep 17 00:00:00 2001 From: mtklein Date: Tue, 7 Apr 2015 15:27:14 -0700 Subject: Revert of SkCanvas::resetForNextPicture() (patchset #4 id:60001 of https://codereview.chromium.org/1067893002/) Reason for revert: https://uberchromegw.corp.google.com/i/client.skia/builders/Linux%20Tests/builds/1816 Original issue's description: > SkCanvas::resetForNextPicture() > > No diffs against head for DM --config 8888 gpu 2ndpic-8888 2ndpic-gpu. > > picture_overhead_draw 1.62us -> 1.6us 0.99x > picture_overhead_nodraw 792ns -> 342ns 0.43x > > tiles and serialization modes will also test this a bit. > > BUG=chromium:470553 > > Committed: https://skia.googlesource.com/skia/+/f920e468ac66a36c9653d1b11181480295044c7d TBR=mtklein@chromium.org NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=chromium:470553 Review URL: https://codereview.chromium.org/1062353002 --- src/core/SkBitmapDevice.cpp | 5 ----- src/core/SkCanvas.cpp | 28 ---------------------------- src/core/SkPictureRecorder.cpp | 10 ++++------ src/core/SkRecorder.cpp | 6 ------ src/core/SkRecorder.h | 2 -- 5 files changed, 4 insertions(+), 47 deletions(-) (limited to 'src') diff --git a/src/core/SkBitmapDevice.cpp b/src/core/SkBitmapDevice.cpp index 5b2fc38e32..5fae2b5862 100644 --- a/src/core/SkBitmapDevice.cpp +++ b/src/core/SkBitmapDevice.cpp @@ -103,11 +103,6 @@ SkImageInfo SkBitmapDevice::imageInfo() const { return fBitmap.info(); } -void SkBitmapDevice::setNewSize(const SkISize& size) { - SkASSERT(!fBitmap.pixelRef()); - fBitmap.setInfo(fBitmap.info().makeWH(size.fWidth, size.fHeight)); -} - void SkBitmapDevice::replaceBitmapBackendForRasterSurface(const SkBitmap& bm) { SkASSERT(bm.width() == fBitmap.width()); SkASSERT(bm.height() == fBitmap.height()); diff --git a/src/core/SkCanvas.cpp b/src/core/SkCanvas.cpp index 63a9241f60..ec21955235 100644 --- a/src/core/SkCanvas.cpp +++ b/src/core/SkCanvas.cpp @@ -135,13 +135,6 @@ struct DeviceCM { SkDELETE(fPaint); } - void reset(const SkIRect& bounds) { - SkASSERT(!fPaint); - SkASSERT(!fNext); - SkASSERT(fDevice); - fClip.setRect(bounds); - } - void updateMC(const SkMatrix& totalMatrix, const SkRasterClip& totalClip, const SkClipStack& clipStack, SkRasterClip* updateClip) { int x = fDevice->getOrigin().x(); @@ -231,15 +224,6 @@ public: SkDELETE(fLayer); dec_rec(); } - - void reset(const SkIRect& bounds) { - SkASSERT(fLayer); - SkASSERT(fDeferredSaveCount == 0); - - fMatrix.reset(); - fRasterClip.setRect(bounds); - fLayer->reset(bounds); - } }; class SkDrawIter : public SkDraw { @@ -441,18 +425,6 @@ bool AutoDrawLooper::doNext(SkDrawFilter::Type drawType) { //////////////////////////////////////////////////////////////////////////// -void SkCanvas::resetForNextPicture(const SkIRect& bounds) { - this->restoreToCount(1); - fCachedLocalClipBounds.setEmpty(); - fCachedLocalClipBoundsDirty = true; - fClipStack->reset(); - fMCRec->reset(bounds); - - // We're peering through a lot of structs here. Only at this scope do we - // know that the device is an SkBitmapDevice (really an SkNoPixelsBitmapDevice). - static_cast(fMCRec->fLayer->fDevice)->setNewSize(bounds.size()); -} - SkBaseDevice* SkCanvas::init(SkBaseDevice* device, InitFlags flags) { fConservativeRasterClip = SkToBool(flags & kConservativeRasterClip_InitFlag); fCachedLocalClipBounds.setEmpty(); diff --git a/src/core/SkPictureRecorder.cpp b/src/core/SkPictureRecorder.cpp index 7c0abcef74..850be27530 100644 --- a/src/core/SkPictureRecorder.cpp +++ b/src/core/SkPictureRecorder.cpp @@ -15,9 +15,7 @@ #include "SkRecordOpts.h" #include "SkTypes.h" -SkPictureRecorder::SkPictureRecorder() { - fRecorder.reset(SkNEW_ARGS(SkRecorder, (nullptr, SkRect::MakeWH(0,0)))); -} +SkPictureRecorder::SkPictureRecorder() {} SkPictureRecorder::~SkPictureRecorder() {} @@ -33,7 +31,7 @@ SkCanvas* SkPictureRecorder::beginRecording(const SkRect& cullRect, } fRecord.reset(SkNEW(SkRecord)); - fRecorder->reset(fRecord.get(), cullRect); + fRecorder.reset(SkNEW_ARGS(SkRecorder, (fRecord.get(), cullRect))); return this->getRecordingCanvas(); } @@ -42,7 +40,6 @@ SkCanvas* SkPictureRecorder::getRecordingCanvas() { } SkPicture* SkPictureRecorder::endRecordingAsPicture() { - fRecorder->restoreToCount(1); // If we were missing any restores, add them now. // TODO: delay as much of this work until just before first playback? SkRecordOptimize(fRecord); @@ -76,6 +73,7 @@ SkPicture* SkPictureRecorder::endRecordingAsPicture() { } // release our refs now, so only the picture will be the owner. + fRecorder.reset(NULL); fRecord.reset(NULL); fBBH.reset(NULL); @@ -160,7 +158,6 @@ protected: }; SkDrawable* SkPictureRecorder::endRecordingAsDrawable() { - fRecorder->restoreToCount(1); // If we were missing any restores, add them now. // TODO: delay as much of this work until just before first playback? SkRecordOptimize(fRecord); @@ -174,6 +171,7 @@ SkDrawable* SkPictureRecorder::endRecordingAsDrawable() { SkToBool(fFlags & kComputeSaveLayerInfo_RecordFlag))); // release our refs now, so only the drawable will be the owner. + fRecorder.reset(NULL); fRecord.reset(NULL); fBBH.reset(NULL); diff --git a/src/core/SkRecorder.cpp b/src/core/SkRecorder.cpp index 8684a8e2eb..aafb540a05 100644 --- a/src/core/SkRecorder.cpp +++ b/src/core/SkRecorder.cpp @@ -39,12 +39,6 @@ SkRecorder::SkRecorder(SkRecord* record, const SkRect& bounds) : SkCanvas(bounds.roundOut(), SkCanvas::kConservativeRasterClip_InitFlag) , fRecord(record) {} -void SkRecorder::reset(SkRecord* record, const SkRect& bounds) { - this->forgetRecord(); - fRecord = record; - this->resetForNextPicture(bounds.roundOut()); -} - void SkRecorder::forgetRecord() { fDrawableList.reset(NULL); fRecord = NULL; diff --git a/src/core/SkRecorder.h b/src/core/SkRecorder.h index 6842aece58..834a2b65e4 100644 --- a/src/core/SkRecorder.h +++ b/src/core/SkRecorder.h @@ -39,8 +39,6 @@ public: SkRecorder(SkRecord*, int width, int height); // legacy version SkRecorder(SkRecord*, const SkRect& bounds); - void reset(SkRecord*, const SkRect& bounds); - SkDrawableList* getDrawableList() const { return fDrawableList.get(); } SkDrawableList* detachDrawableList() { return fDrawableList.detach(); } -- cgit v1.2.3