Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4)

Side by Side Diff: src/codec/SkJpegDecoderMgr.cpp

Issue 1820073002: Add SkEncodedInfo to report properties of encoded image data (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Order of param eval bug Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/codec/SkJpegDecoderMgr.h ('k') | src/codec/SkPngCodec.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 9
10 #include "SkJpegUtility.h" 10 #include "SkJpegUtility.h"
(...skipping 17 matching lines...) Expand all
28 bool JpegDecoderMgr::returnFalse(const char caller[]) { 28 bool JpegDecoderMgr::returnFalse(const char caller[]) {
29 print_message((j_common_ptr) &fDInfo, caller); 29 print_message((j_common_ptr) &fDInfo, caller);
30 return false; 30 return false;
31 } 31 }
32 32
33 SkCodec::Result JpegDecoderMgr::returnFailure(const char caller[], SkCodec::Resu lt result) { 33 SkCodec::Result JpegDecoderMgr::returnFailure(const char caller[], SkCodec::Resu lt result) {
34 print_message((j_common_ptr) &fDInfo, caller); 34 print_message((j_common_ptr) &fDInfo, caller);
35 return result; 35 return result;
36 } 36 }
37 37
38 SkColorType JpegDecoderMgr::getColorType() { 38 SkEncodedInfo::Color JpegDecoderMgr::getEncodedColor() {
39 switch (fDInfo.jpeg_color_space) { 39 switch (fDInfo.jpeg_color_space) {
40 case JCS_GRAYSCALE: 40 case JCS_GRAYSCALE:
41 return kGray_8_SkColorType; 41 return SkEncodedInfo::kGray_Color;
42 case JCS_YCbCr:
43 return SkEncodedInfo::kYUV_Color;
44 case JCS_RGB:
45 return SkEncodedInfo::kRGB_Color;
46 case JCS_YCCK:
47 return SkEncodedInfo::kYCCK_Color;
48 case JCS_CMYK:
49 return SkEncodedInfo::kInvertedCMYK_Color;
42 default: 50 default:
43 return kN32_SkColorType; 51 return SkEncodedInfo::kUnknown_Color;
44 } 52 }
45 } 53 }
46 54
47 JpegDecoderMgr::JpegDecoderMgr(SkStream* stream) 55 JpegDecoderMgr::JpegDecoderMgr(SkStream* stream)
48 : fSrcMgr(stream) 56 : fSrcMgr(stream)
49 , fInit(false) 57 , fInit(false)
50 { 58 {
51 // Error manager must be set before any calls to libjeg in order to handle f ailures 59 // Error manager must be set before any calls to libjeg in order to handle f ailures
52 fDInfo.err = jpeg_std_error(&fErrorMgr); 60 fDInfo.err = jpeg_std_error(&fErrorMgr);
53 fErrorMgr.error_exit = skjpeg_err_exit; 61 fErrorMgr.error_exit = skjpeg_err_exit;
(...skipping 12 matching lines...) Expand all
66 } 74 }
67 } 75 }
68 76
69 jmp_buf& JpegDecoderMgr::getJmpBuf() { 77 jmp_buf& JpegDecoderMgr::getJmpBuf() {
70 return fErrorMgr.fJmpBuf; 78 return fErrorMgr.fJmpBuf;
71 } 79 }
72 80
73 jpeg_decompress_struct* JpegDecoderMgr::dinfo() { 81 jpeg_decompress_struct* JpegDecoderMgr::dinfo() {
74 return &fDInfo; 82 return &fDInfo;
75 } 83 }
OLDNEW
« no previous file with comments | « src/codec/SkJpegDecoderMgr.h ('k') | src/codec/SkPngCodec.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698