SkPixelSerialize is deprecated (and unneeded in this case)
Test: make Change-Id: Icc421586de82a516cb5e32b60949315d1108a9a3
This commit is contained in:
@@ -22,8 +22,6 @@
|
||||
#include <SkOverdrawColorFilter.h>
|
||||
#include <SkPicture.h>
|
||||
#include <SkPictureRecorder.h>
|
||||
#include <SkPixelSerializer.h>
|
||||
#include <SkStream.h>
|
||||
#include "VectorDrawable.h"
|
||||
#include "utils/TraceUtils.h"
|
||||
|
||||
@@ -207,19 +205,6 @@ void SkiaPipeline::prepareToDraw(const RenderThread& thread, Bitmap* bitmap) {
|
||||
}
|
||||
}
|
||||
|
||||
// Encodes to PNG, unless there is already encoded data, in which case that gets
|
||||
// used.
|
||||
class PngPixelSerializer : public SkPixelSerializer {
|
||||
public:
|
||||
bool onUseEncodedData(const void*, size_t) override { return true; }
|
||||
SkData* onEncode(const SkPixmap& pixmap) override {
|
||||
SkDynamicMemoryWStream buf;
|
||||
return SkEncodeImage(&buf, pixmap, SkEncodedImageFormat::kPNG, 100)
|
||||
? buf.detachAsData().release()
|
||||
: nullptr;
|
||||
}
|
||||
};
|
||||
|
||||
void SkiaPipeline::renderVectorDrawableCache() {
|
||||
if (!mVectorDrawables.empty()) {
|
||||
sp<VectorDrawableAtlas> atlas = mRenderThread.cacheManager().acquireVectorDrawableAtlas();
|
||||
@@ -296,9 +281,7 @@ void SkiaPipeline::endCapture(SkSurface* surface) {
|
||||
sk_sp<SkPicture> picture = mRecorder->finishRecordingAsPicture();
|
||||
surface->getCanvas()->drawPicture(picture);
|
||||
if (picture->approximateOpCount() > 0) {
|
||||
SkDynamicMemoryWStream stream;
|
||||
PngPixelSerializer serializer;
|
||||
picture->serialize(&stream, &serializer);
|
||||
auto data = picture->serialize();
|
||||
|
||||
// offload saving to file in a different thread
|
||||
if (!mSavePictureProcessor.get()) {
|
||||
@@ -307,10 +290,10 @@ void SkiaPipeline::endCapture(SkSurface* surface) {
|
||||
taskManager->canRunTasks() ? taskManager : nullptr);
|
||||
}
|
||||
if (1 == mCaptureSequence) {
|
||||
mSavePictureProcessor->savePicture(stream.detachAsData(), mCapturedFile);
|
||||
mSavePictureProcessor->savePicture(data, mCapturedFile);
|
||||
} else {
|
||||
mSavePictureProcessor->savePicture(
|
||||
stream.detachAsData(),
|
||||
data,
|
||||
mCapturedFile + "_" + std::to_string(mCaptureSequence));
|
||||
}
|
||||
mCaptureSequence--;
|
||||
|
||||
Reference in New Issue
Block a user