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

Commit 26486153 authored by Leon Scroggins's avatar Leon Scroggins Committed by android-build-merger
Browse files

Merge "Allow ImageDecoder to read SkFILEStream directly" into pi-dev

am: b9790fd1

Change-Id: I1f9a56d8e4bcfe2b992faeb529704ba53f825b08
parents 74be891f b9790fd1
Loading
Loading
Loading
Loading
+2 −11
Original line number Diff line number Diff line
@@ -139,20 +139,11 @@ static jobject ImageDecoder_nCreateFd(JNIEnv* env, jobject /*clazz*/,
        return throw_exception(env, ImageDecoder::kSourceMalformedData, "Could not open file",
                               nullptr, source);
    }
    std::unique_ptr<SkFILEStream> fileStream(new SkFILEStream(file));

    if (::lseek(descriptor, 0, SEEK_CUR) == 0) {
    std::unique_ptr<SkFILEStream> fileStream(new SkFILEStream(file));
    return native_create(env, std::move(fileStream), source);
}

    // FIXME: This allows us to pretend the current location is the beginning,
    // but it would be better if SkFILEStream allowed treating its starting
    // point as the beginning.
    std::unique_ptr<SkStream> stream(SkFrontBufferedStream::Make(std::move(fileStream),
                SkCodec::MinBufferedBytesNeeded()));
    return native_create(env, std::move(stream), source);
}

static jobject ImageDecoder_nCreateInputStream(JNIEnv* env, jobject /*clazz*/,
        jobject is, jbyteArray storage, jobject source) {
    std::unique_ptr<SkStream> stream(CreateJavaInputStreamAdaptor(env, is, storage, false));