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

Commit f211faba authored by Leon Scroggins's avatar Leon Scroggins Committed by Android (Google) Code Review
Browse files

Merge "Replace encodeToData with SkPngEncoder"

parents a925f58b 2ab8ce7c
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 {