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

Commit 471ef097 authored by Leon Scroggins III's avatar Leon Scroggins III
Browse files

Stop using skjpeg_error_mgr in YuvToJpegEncoder

Bug: None
Test: compile

skjpeg_error_mgr is only different from the standard one in that it
includes a jmp_buf. A recent change to skjpeg_error_mgr stores a stack
of jmp_bufs (see https://skia-review.googlesource.com/c/skia/+/79241).
This complexity is unnecessary for YuvToJpegEncoder, which only contains
a single method with libjpeg calls (which might call longjmp). Simplify
this code by placing the jmp_buf on the stack. This fixes the Skia to
Android roll, which includes the above Skia change.

Change-Id: If9a33ed10ea60131906a632a7030e0b69a21f4ea
parent c51777b9
Loading
Loading
Loading
Loading
+5 −4
Original line number Diff line number Diff line
@@ -26,12 +26,13 @@ YuvToJpegEncoder::YuvToJpegEncoder(int* strides) : fStrides(strides) {
bool YuvToJpegEncoder::encode(SkWStream* stream, void* inYuv, int width,
        int height, int* offsets, int jpegQuality) {
    jpeg_compress_struct    cinfo;
    skjpeg_error_mgr        sk_err;
    jpeg_error_mgr          err;
    skjpeg_destination_mgr  sk_wstream(stream);

    cinfo.err = jpeg_std_error(&sk_err);
    sk_err.error_exit = skjpeg_error_exit;
    if (setjmp(sk_err.fJmpBuf)) {
    cinfo.err = jpeg_std_error(&err);
    err.error_exit = skjpeg_error_exit;
    jmp_buf jmp;
    if (setjmp(jmp)) {
        return false;
    }
    jpeg_create_compress(&cinfo);