diff options
author | 2016-08-15 12:56:00 -0700 | |
---|---|---|
committer | 2016-08-15 12:56:00 -0700 | |
commit | 8bbbb696cdc1351f615bc52ee119cfa384f77f30 (patch) | |
tree | 095e68caa0c3ea745c096a519d952565455a5788 | |
parent | 6fb0648c35aead138e65133c031d2b4fe5c8f0c7 (diff) |
Revert of add parallel public API for recording SkLiteDL. (patchset #1 id:1 of https://codereview.chromium.org/2246893002/ )
Reason for revert:
looking like we won't need this
Original issue's description:
> add parallel public API for recording SkLiteDL.
>
> The API is restricted to pretty much just what Derek calls,
> but it's enough that we can switch testing over to use it.
>
> BUG=skia:
> GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2246893002
>
> Committed: https://skia.googlesource.com/skia/+/ced26a3d6b77d3a6744a8ccb8eff23eda45fc867
TBR=djsollen@google.com,reed@google.com,mtklein@chromium.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=skia:
Review-Url: https://codereview.chromium.org/2243393002
-rw-r--r-- | dm/DMSrcSink.cpp | 15 | ||||
-rw-r--r-- | include/core/SkPictureRecorder.h | 26 | ||||
-rw-r--r-- | src/core/SkPictureRecorder.cpp | 23 |
3 files changed, 10 insertions, 54 deletions
diff --git a/dm/DMSrcSink.cpp b/dm/DMSrcSink.cpp index 31e1574191..638af13b7b 100644 --- a/dm/DMSrcSink.cpp +++ b/dm/DMSrcSink.cpp @@ -21,6 +21,8 @@ #include "SkImageGenerator.h" #include "SkImageGeneratorCG.h" #include "SkImageGeneratorWIC.h" +#include "SkLiteDL.h" +#include "SkLiteRecorder.h" #include "SkMallocPixelRef.h" #include "SkMultiPictureDraw.h" #include "SkNullCanvas.h" @@ -1613,15 +1615,18 @@ Error ViaSingletonPictures::draw( Error ViaLite::draw(const Src& src, SkBitmap* bitmap, SkWStream* stream, SkString* log) const { auto size = src.size(); + SkRect bounds = {0,0, (SkScalar)size.width(), (SkScalar)size.height()}; return draw_to_canvas(fSink, bitmap, stream, log, size, [&](SkCanvas* canvas) -> Error { - SkPictureRecorder_Lite recorder; - Error err = src.draw(recorder.beginRecording(SkIntToScalar(size.width()), - SkIntToScalar(size.height()))); + sk_sp<SkLiteDL> dl = SkLiteDL::New(bounds); + + SkLiteRecorder rec; + rec.reset(dl.get()); + + Error err = src.draw(&rec); if (!err.isEmpty()) { return err; } - sk_sp<SkDrawable> dl = recorder.finishRecordingAsDrawable(); - canvas->drawDrawable(dl.get()); + dl->draw(canvas); return check_against_reference(bitmap, src, fSink); }); } diff --git a/include/core/SkPictureRecorder.h b/include/core/SkPictureRecorder.h index 96e7aa019d..f20a06adf4 100644 --- a/include/core/SkPictureRecorder.h +++ b/include/core/SkPictureRecorder.h @@ -140,30 +140,4 @@ private: typedef SkNoncopyable INHERITED; }; -class SkLiteDL; -class SkLiteRecorder; - -// A similar API to SkPictureRecorder, wrapping SkLiteRecorder and SkLiteDL. -class SK_API SkPictureRecorder_Lite : SkNoncopyable { -public: - SkPictureRecorder_Lite(); - ~SkPictureRecorder_Lite(); - - SkCanvas* beginRecording(const SkRect& bounds); - SkCanvas* beginRecording(SkScalar w, SkScalar h) { - return this->beginRecording(SkRect::MakeWH(w,h)); - } - - SkCanvas* getRecordingCanvas(); - - void optimizeFor(GrContext* ctx) { fGrContextToOptimizeFor = ctx; } - - sk_sp<SkDrawable> finishRecordingAsDrawable(uint32_t ignored = 0); - -private: - std::unique_ptr<SkLiteRecorder> fRecorder; - sk_sp<SkLiteDL> fDL; - GrContext* fGrContextToOptimizeFor = nullptr; -}; - #endif diff --git a/src/core/SkPictureRecorder.cpp b/src/core/SkPictureRecorder.cpp index 00450b085a..8e7c7f3b06 100644 --- a/src/core/SkPictureRecorder.cpp +++ b/src/core/SkPictureRecorder.cpp @@ -196,26 +196,3 @@ sk_sp<SkDrawable> SkPictureRecorder::finishRecordingAsDrawable(uint32_t finishFl return drawable; } - -#include "SkLiteDL.h" -#include "SkLiteRecorder.h" - -SkPictureRecorder_Lite:: SkPictureRecorder_Lite() : fRecorder(new SkLiteRecorder) {} -SkPictureRecorder_Lite::~SkPictureRecorder_Lite() {} - -SkCanvas* SkPictureRecorder_Lite::beginRecording(const SkRect& bounds) { - fDL = SkLiteDL::New(bounds); - fRecorder->reset(fDL.get()); - return this->getRecordingCanvas(); -} - -SkCanvas* SkPictureRecorder_Lite::getRecordingCanvas() { - return fDL ? fRecorder.get() : nullptr; -} - -sk_sp<SkDrawable> SkPictureRecorder_Lite::finishRecordingAsDrawable(uint32_t) { - if (fGrContextToOptimizeFor) { - fDL->optimizeFor(fGrContextToOptimizeFor); - } - return std::move(fDL); -} |