diff options
author | mtklein <mtklein@google.com> | 2015-05-18 14:53:43 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-05-18 14:53:43 -0700 |
commit | 72743b165424efc4ef6f6614add9033ea1ef31db (patch) | |
tree | 26ebea2ec4df12ec4d94cb3089b4f3d82a032322 /src/core/SkPictureRecorder.cpp | |
parent | 4f2dba625dd858ea3591974d793ef18c10c2ca67 (diff) |
Revert of Sketch splitting SkPicture into an interface and SkBigPicture. (patchset #25 id:480001 of https://codereview.chromium.org/1112523006/)
Reason for revert:
win_chromium_compile_dbg_ng
FAILED: ninja -t msvc -e environment.x86 -- E:\b\build\goma/gomacc "E:\b\depot_tools\win_toolchain\vs2013_files\VC\bin\amd64_x86\cl.exe" /nologo /showIncludes /FC @obj\third_party\skia\src\core\skia.SkBitmapHeap.obj.rsp /c ..\..\third_party\skia\src\core\SkBitmapHeap.cpp /Foobj\third_party\skia\src\core\skia.SkBitmapHeap.obj /Fdobj\skia\skia.cc.pdb
e:\b\build\slave\win\build\src\third_party\skia\include\core\skpicture.h(176) : error C2487: 'CURRENT_PICTURE_VERSION' : member of dll interface class may not be declared with dll interface
Original issue's description:
> Sketch splitting SkPicture into an interface and SkBigPicture.
>
> Adds small pictures for drawRect(), drawTextBlob(), and drawPath().
> These cover about 89% of draw calls from Blink SKPs,
> and about 25% of draw calls from our GMs.
>
> SkPicture handles:
> - serialization and deserialization
> - unique IDs
>
> Everything else is left to the subclasses:
> - playback(), cullRect()
> - hasBitmap(), hasText(), suitableForGPU(), etc.
> - LayerInfo / AccelData if applicable.
>
> The time to record a 1-op picture improves a good chunk
> (2 mallocs to 1), and the time to record a 0-op picture
> greatly improves (2 mallocs to none):
>
> picture_overhead_draw: 450ns -> 350ns
> picture_overhead_nodraw: 300ns -> 90ns
>
> BUG=skia:
>
> Committed: https://skia.googlesource.com/skia/+/c92c129ff85b05a714bd1bf921c02d5e14651f8b
>
> Latest blink_linux_rel:
>
> http://build.chromium.org/p/tryserver.blink/builders/linux_blink_rel/builds/61248
>
> Committed: https://skia.googlesource.com/skia/+/15877b6eae33a9282458bdb904a6d00440eca0ec
TBR=reed@google.com,robertphillips@google.com,fmalita@chromium.org,mtklein@chromium.org
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=skia:
Review URL: https://codereview.chromium.org/1130283004
Diffstat (limited to 'src/core/SkPictureRecorder.cpp')
-rw-r--r-- | src/core/SkPictureRecorder.cpp | 55 |
1 files changed, 24 insertions, 31 deletions
diff --git a/src/core/SkPictureRecorder.cpp b/src/core/SkPictureRecorder.cpp index c110e0a2db..282e2c22dd 100644 --- a/src/core/SkPictureRecorder.cpp +++ b/src/core/SkPictureRecorder.cpp @@ -5,7 +5,6 @@ * found in the LICENSE file. */ -#include "SkBigPicture.h" #include "SkData.h" #include "SkDrawable.h" #include "SkLayerInfo.h" @@ -19,7 +18,7 @@ SkPictureRecorder::SkPictureRecorder() { fActivelyRecording = false; - fRecorder.reset(SkNEW_ARGS(SkRecorder, (nullptr, SkRect::MakeWH(0,0), &fMiniRecorder))); + fRecorder.reset(SkNEW_ARGS(SkRecorder, (nullptr, SkRect::MakeWH(0,0)))); } SkPictureRecorder::~SkPictureRecorder() {} @@ -35,10 +34,8 @@ SkCanvas* SkPictureRecorder::beginRecording(const SkRect& cullRect, SkASSERT(fBBH.get()); } - if (!fRecord) { - fRecord.reset(SkNEW(SkRecord)); - } - fRecorder->reset(fRecord.get(), cullRect, &fMiniRecorder); + fRecord.reset(SkNEW(SkRecord)); + fRecorder->reset(fRecord.get(), cullRect); fActivelyRecording = true; return this->getRecordingCanvas(); } @@ -50,23 +47,19 @@ SkCanvas* SkPictureRecorder::getRecordingCanvas() { SkPicture* SkPictureRecorder::endRecordingAsPicture() { fActivelyRecording = false; fRecorder->restoreToCount(1); // If we were missing any restores, add them now. - - if (fRecord->count() == 0) { - return fMiniRecorder.detachAsPicture(fCullRect); - } - // TODO: delay as much of this work until just before first playback? SkRecordOptimize(fRecord); SkAutoTUnref<SkLayerInfo> saveLayerData; if (fBBH && (fFlags & kComputeSaveLayerInfo_RecordFlag)) { - saveLayerData.reset(SkNEW(SkLayerInfo)); + SkPicture::AccelData::Key key = SkLayerInfo::ComputeKey(); + + saveLayerData.reset(SkNEW_ARGS(SkLayerInfo, (key))); } SkDrawableList* drawableList = fRecorder->getDrawableList(); - SkBigPicture::SnapshotArray* pictList = - drawableList ? drawableList->newDrawableSnapshot() : NULL; + SkPicture::SnapshotArray* pictList = drawableList ? drawableList->newDrawableSnapshot() : NULL; if (fBBH.get()) { if (saveLayerData) { @@ -84,12 +77,12 @@ SkPicture* SkPictureRecorder::endRecordingAsPicture() { for (int i = 0; pictList && i < pictList->count(); i++) { subPictureBytes += SkPictureUtils::ApproximateBytesUsed(pictList->begin()[i]); } - return SkNEW_ARGS(SkBigPicture, (fCullRect, - fRecord.detach(), - pictList, - fBBH.detach(), - saveLayerData.detach(), - subPictureBytes)); + return SkNEW_ARGS(SkPicture, (fCullRect, + fRecord.detach(), + pictList, + fBBH.detach(), + saveLayerData.detach(), + subPictureBytes)); } void SkPictureRecorder::partialReplay(SkCanvas* canvas) const { @@ -140,7 +133,7 @@ protected: } SkPicture* onNewPictureSnapshot() override { - SkBigPicture::SnapshotArray* pictList = NULL; + SkPicture::SnapshotArray* pictList = NULL; if (fDrawableList) { // TODO: should we plumb-down the BBHFactory and recordFlags from our host // PictureRecorder? @@ -150,7 +143,9 @@ protected: SkAutoTUnref<SkLayerInfo> saveLayerData; if (fBBH && fDoSaveLayerInfo) { - saveLayerData.reset(SkNEW(SkLayerInfo)); + SkPicture::AccelData::Key key = SkLayerInfo::ComputeKey(); + + saveLayerData.reset(SkNEW_ARGS(SkLayerInfo, (key))); SkBBoxHierarchy* bbh = NULL; // we've already computed fBBH (received in constructor) // TODO: update saveLayer info computation to reuse the already computed @@ -162,22 +157,20 @@ protected: for (int i = 0; pictList && i < pictList->count(); i++) { subPictureBytes += SkPictureUtils::ApproximateBytesUsed(pictList->begin()[i]); } - // SkBigPicture will take ownership of a ref on both fRecord and fBBH. + // SkPicture will take ownership of a ref on both fRecord and fBBH. // We're not willing to give up our ownership, so we must ref them for SkPicture. - return SkNEW_ARGS(SkBigPicture, (fBounds, - SkRef(fRecord.get()), - pictList, - SkSafeRef(fBBH.get()), - saveLayerData.detach(), - subPictureBytes)); + return SkNEW_ARGS(SkPicture, (fBounds, + SkRef(fRecord.get()), + pictList, + SkSafeRef(fBBH.get()), + saveLayerData.detach(), + subPictureBytes)); } }; SkDrawable* SkPictureRecorder::endRecordingAsDrawable() { fActivelyRecording = false; - fRecorder->flushMiniRecorder(); 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); |