gfx/skia/trunk/src/images/SkJpegUtility.h

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     2 /*
     3  * Copyright 2010 The Android Open Source Project
     4  *
     5  * Use of this source code is governed by a BSD-style license that can be
     6  * found in the LICENSE file.
     7  */
    10 #ifndef SkJpegUtility_DEFINED
    11 #define SkJpegUtility_DEFINED
    13 #include "SkImageDecoder.h"
    14 #include "SkStream.h"
    16 extern "C" {
    17     #include "jpeglib.h"
    18     #include "jerror.h"
    19 }
    21 #include <setjmp.h>
    23 /* Our error-handling struct.
    24  *
    25 */
    26 struct skjpeg_error_mgr : jpeg_error_mgr {
    27     jmp_buf fJmpBuf;
    28 };
    31 void skjpeg_error_exit(j_common_ptr cinfo);
    33 ///////////////////////////////////////////////////////////////////////////
    34 /* Our source struct for directing jpeg to our stream object.
    35 */
    36 struct skjpeg_source_mgr : jpeg_source_mgr {
    37     skjpeg_source_mgr(SkStream* stream, SkImageDecoder* decoder);
    38     ~skjpeg_source_mgr();
    40     // fStream is ref'ed and unref'ed
    41     SkStream*       fStream;
    42     // Unowned pointer to the decoder, used to check if the decoding process
    43     // has been cancelled.
    44     SkImageDecoder* fDecoder;
    45     enum {
    46         kBufferSize = 1024
    47     };
    48     char    fBuffer[kBufferSize];
    49 };
    51 /////////////////////////////////////////////////////////////////////////////
    52 /* Our destination struct for directing decompressed pixels to our stream
    53  * object.
    54  */
    55 struct skjpeg_destination_mgr : jpeg_destination_mgr {
    56     skjpeg_destination_mgr(SkWStream* stream);
    58     SkWStream*  fStream;
    60     enum {
    61         kBufferSize = 1024
    62     };
    63     uint8_t fBuffer[kBufferSize];
    64 };
    66 #endif

mercurial