| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #include "SkJpegDecoderMgr.h" | 8 #include "SkJpegDecoderMgr.h" |
| 9 #include "SkJpegUtility_codec.h" | 9 #include "SkJpegUtility_codec.h" |
| 10 | 10 |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 default: | 44 default: |
| 45 return kN32_SkColorType; | 45 return kN32_SkColorType; |
| 46 } | 46 } |
| 47 } | 47 } |
| 48 | 48 |
| 49 JpegDecoderMgr::JpegDecoderMgr(SkStream* stream) | 49 JpegDecoderMgr::JpegDecoderMgr(SkStream* stream) |
| 50 : fSrcMgr(stream) | 50 : fSrcMgr(stream) |
| 51 , fInit(false) | 51 , fInit(false) |
| 52 { | 52 { |
| 53 // Error manager must be set before any calls to libjeg in order to handle f
ailures | 53 // Error manager must be set before any calls to libjeg in order to handle f
ailures |
| 54 fDInfo.err = turbo_jpeg_std_error(&fErrorMgr); | 54 fDInfo.err = chromium_jpeg_std_error(&fErrorMgr); |
| 55 fErrorMgr.error_exit = skjpeg_err_exit; | 55 fErrorMgr.error_exit = skjpeg_err_exit; |
| 56 } | 56 } |
| 57 | 57 |
| 58 void JpegDecoderMgr::init() { | 58 void JpegDecoderMgr::init() { |
| 59 jpeg_create_decompress(&fDInfo); | 59 jpeg_create_decompress(&fDInfo); |
| 60 fInit = true; | 60 fInit = true; |
| 61 fDInfo.src = &fSrcMgr; | 61 fDInfo.src = &fSrcMgr; |
| 62 fDInfo.err->emit_message = &emit_message; | 62 fDInfo.err->emit_message = &emit_message; |
| 63 fDInfo.err->output_message = &output_message; | 63 fDInfo.err->output_message = &output_message; |
| 64 } | 64 } |
| 65 | 65 |
| 66 JpegDecoderMgr::~JpegDecoderMgr() { | 66 JpegDecoderMgr::~JpegDecoderMgr() { |
| 67 if (fInit) { | 67 if (fInit) { |
| 68 jpeg_destroy_decompress(&fDInfo); | 68 jpeg_destroy_decompress(&fDInfo); |
| 69 } | 69 } |
| 70 } | 70 } |
| 71 | 71 |
| 72 jmp_buf& JpegDecoderMgr::getJmpBuf() { | 72 jmp_buf& JpegDecoderMgr::getJmpBuf() { |
| 73 return fErrorMgr.fJmpBuf; | 73 return fErrorMgr.fJmpBuf; |
| 74 } | 74 } |
| 75 | 75 |
| 76 jpeg_decompress_struct* JpegDecoderMgr::dinfo() { | 76 jpeg_decompress_struct* JpegDecoderMgr::dinfo() { |
| 77 return &fDInfo; | 77 return &fDInfo; |
| 78 } | 78 } |
| OLD | NEW |