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/SkBigPicture.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/SkBigPicture.cpp')
-rw-r--r-- | src/core/SkBigPicture.cpp | 98 |
1 files changed, 0 insertions, 98 deletions
diff --git a/src/core/SkBigPicture.cpp b/src/core/SkBigPicture.cpp deleted file mode 100644 index 6609586ca2..0000000000 --- a/src/core/SkBigPicture.cpp +++ /dev/null @@ -1,98 +0,0 @@ -/* - * Copyright 2015 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#include "SkBBoxHierarchy.h" -#include "SkBigPicture.h" -#include "SkPictureCommon.h" -#include "SkRecord.h" -#include "SkRecordDraw.h" - -SkBigPicture::SkBigPicture(const SkRect& cull, - SkRecord* record, - SnapshotArray* drawablePicts, - SkBBoxHierarchy* bbh, - AccelData* accelData, - size_t approxBytesUsedBySubPictures) - : fCullRect(cull) - , fApproxBytesUsedBySubPictures(approxBytesUsedBySubPictures) - , fRecord(record) // Take ownership of caller's ref. - , fDrawablePicts(drawablePicts) // Take ownership. - , fBBH(bbh) // Take ownership of caller's ref. - , fAccelData(accelData) // Take ownership of caller's ref. -{} - -void SkBigPicture::playback(SkCanvas* canvas, AbortCallback* callback) const { - SkASSERT(canvas); - - // If the query contains the whole picture, don't bother with the BBH. - SkRect clipBounds = { 0, 0, 0, 0 }; - (void)canvas->getClipBounds(&clipBounds); - const bool useBBH = !clipBounds.contains(this->cullRect()); - - SkRecordDraw(*fRecord, - canvas, - this->drawablePicts(), - nullptr, - this->drawableCount(), - useBBH ? fBBH.get() : nullptr, - callback); -} - -void SkBigPicture::partialPlayback(SkCanvas* canvas, - unsigned start, - unsigned stop, - const SkMatrix& initialCTM) const { - SkASSERT(canvas); - SkRecordPartialDraw(*fRecord, - canvas, - this->drawablePicts(), - this->drawableCount(), - start, - stop, - initialCTM); -} - -const SkBigPicture::Analysis& SkBigPicture::analysis() const { - auto create = [&]() { return SkNEW_ARGS(Analysis, (*fRecord)); }; - return *fAnalysis.get(create); -} - -SkRect SkBigPicture::cullRect() const { return fCullRect; } -bool SkBigPicture::hasText() const { return this->analysis().fHasText; } -bool SkBigPicture::willPlayBackBitmaps() const { return this->analysis().fWillPlaybackBitmaps; } -int SkBigPicture::numSlowPaths() const { return this->analysis().fNumSlowPathsAndDashEffects; } -int SkBigPicture::approximateOpCount() const { return fRecord->count(); } -size_t SkBigPicture::approximateBytesUsed() const { - size_t bytes = sizeof(*this) + fRecord->bytesUsed() + fApproxBytesUsedBySubPictures; - if (fBBH) { bytes += fBBH->bytesUsed(); } - return bytes; -} - -int SkBigPicture::drawableCount() const { - return fDrawablePicts ? fDrawablePicts->count() : 0; -} - -SkPicture const* const* SkBigPicture::drawablePicts() const { - return fDrawablePicts ? fDrawablePicts->begin() : nullptr; -} - -SkBigPicture::Analysis::Analysis(const SkRecord& record) { - SkTextHunter text; - SkBitmapHunter bitmap; - SkPathCounter path; - - bool hasText = false, hasBitmap = false; - for (unsigned i = 0; i < record.count(); i++) { - hasText = hasText || record.visit<bool>(i, text); - hasBitmap = hasBitmap || record.visit<bool>(i, bitmap); - record.visit<void>(i, path); - } - - fHasText = hasText; - fWillPlaybackBitmaps = hasBitmap; - fNumSlowPathsAndDashEffects = SkTMin<int>(path.fNumSlowPathsAndDashEffects, 255); -} |