Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2ab8ce7c authored by Kevin Lubick's avatar Kevin Lubick
Browse files

Replace encodeToData with SkPngEncoder

This was deprecated in https://skia-review.googlesource.com/c/skia/+/667296

Change-Id: Id05f4ce870165726e267ab642378178ece99ff01
parent a6a3a653
Loading
Loading
Loading
Loading
+12 −1
Original line number Diff line number Diff line
@@ -35,6 +35,7 @@
#include <SkTypeface.h>
#include <dlfcn.h>
#include <gui/TraceUtils.h>
#include <include/encode/SkPngEncoder.h>
#include <inttypes.h>
#include <media/NdkImage.h>
#include <media/NdkImageReader.h>
@@ -54,6 +55,7 @@

#include <algorithm>
#include <atomic>
#include <log/log.h>
#include <vector>

#include "JvmErrorReporter.h"
@@ -520,7 +522,16 @@ public:
        if (iter != context->mTextureMap.end()) {
            img = iter->second.get();
        }
        return img->encodeToData();
        if (!img) {
            return nullptr;
        }
        // The following encode (specifically the pixel readback) will fail on a
        // texture-backed image. They should already be raster images, but on
        // the off-chance they aren't, we will just serialize it as nothing.
        if (img->isTextureBacked()) {
            return SkData::MakeEmpty();
        }
        return SkPngEncoder::Encode(nullptr, img, {});
    }

    void serialize(SkWStream* stream) const override {