diff options
author | mtklein <mtklein@chromium.org> | 2016-08-15 08:05:39 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-08-15 08:05:39 -0700 |
commit | ced26a3d6b77d3a6744a8ccb8eff23eda45fc867 (patch) | |
tree | 8b3153cc421fc66c0d8db7754c27ee45be821b45 /src/core/SkPictureRecorder.cpp | |
parent | 851d68aa5692103db67433354c7421863d01dbda (diff) |
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
Review-Url: https://codereview.chromium.org/2246893002
Diffstat (limited to 'src/core/SkPictureRecorder.cpp')
-rw-r--r-- | src/core/SkPictureRecorder.cpp | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/core/SkPictureRecorder.cpp b/src/core/SkPictureRecorder.cpp index 8e7c7f3b06..00450b085a 100644 --- a/src/core/SkPictureRecorder.cpp +++ b/src/core/SkPictureRecorder.cpp @@ -196,3 +196,26 @@ 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); +} |