[skottie] Fix skottie2movie after async API change

TBR=
Change-Id: I4793d3540f3b5f5fa06ce7a3d1ce2a281660fb72
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/251255
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
This commit is contained in:
Florin Malita 2019-10-28 18:47:32 -04:00 committed by Skia Commit-Bot
parent d898cc3f26
commit f22dda9601

View File

@ -142,12 +142,17 @@ int main(int argc, char** argv) {
AsyncRec asyncRec = { info, &encoder };
if (context) {
auto read_pixels_cb = [](SkSurface::ReadPixelsContext ctx,
std::unique_ptr<const SkSurface::AsyncReadResult> result) {
if (result && result->count() == 1) {
AsyncRec* rec = reinterpret_cast<AsyncRec*>(ctx);
rec->encoder->addFrame({rec->info, result->data(0), result->rowBytes(0)});
}
};
surf->asyncRescaleAndReadPixels(info, {0, 0, info.width(), info.height()},
SkSurface::RescaleGamma::kSrc, kNone_SkFilterQuality,
[](void* ctx, const void* data, size_t rb) {
AsyncRec* rec = (AsyncRec*)ctx;
rec->encoder->addFrame({rec->info, data, rb});
}, &asyncRec);
SkSurface::RescaleGamma::kSrc,
kNone_SkFilterQuality,
read_pixels_cb, &asyncRec);
} else {
SkPixmap pm;
SkAssertResult(surf->peekPixels(&pm));