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

Commit 4127417b 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

am: 26486153

Change-Id: I3b31e298517327f2400d5e060fb09e79f393fc0f
parents b786c10a 26486153
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));