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

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: Created 4 years, 9 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
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 #include "SkJpegUtility_codec.h" 9 #include "SkJpegUtility_codec.h"
10 10
(...skipping 16 matching lines...) Expand all
27 bool JpegDecoderMgr::returnFalse(const char caller[]) { 27 bool JpegDecoderMgr::returnFalse(const char caller[]) {
28 print_message((j_common_ptr) &fDInfo, caller); 28 print_message((j_common_ptr) &fDInfo, caller);
29 return false; 29 return false;
30 } 30 }
31 31
32 SkCodec::Result JpegDecoderMgr::returnFailure(const char caller[], SkCodec::Resu lt result) { 32 SkCodec::Result JpegDecoderMgr::returnFailure(const char caller[], SkCodec::Resu lt result) {
33 print_message((j_common_ptr) &fDInfo, caller); 33 print_message((j_common_ptr) &fDInfo, caller);
34 return result; 34 return result;
35 } 35 }
36 36
37 SkColorType JpegDecoderMgr::getColorType() { 37 SkEncodedInfo::Color JpegDecoderMgr::getEncodedColor() {
38 switch (fDInfo.jpeg_color_space) { 38 switch (fDInfo.jpeg_color_space) {
39 case JCS_GRAYSCALE: 39 case JCS_GRAYSCALE:
40 return kGray_8_SkColorType; 40 return SkEncodedInfo::kGray_Color;
41 case JCS_YCbCr:
42 return SkEncodedInfo::kYUV_Color;
43 case JCS_RGB:
44 return SkEncodedInfo::kRGB_Color;
45 case JCS_YCCK:
46 return SkEncodedInfo::kYCCK_Color;
47 case JCS_CMYK:
48 return SkEncodedInfo::kInvertedCMYK_Color;
41 default: 49 default:
42 return kN32_SkColorType; 50 return SkEncodedInfo::kYUV_Color;
scroggo 2016/03/23 14:48:50 What types fall into the default case? Why not be
msarett 2016/03/24 16:20:44 Other JPEG_COLOR_SPACES include RGBA, BGRA, 565 et
43 } 51 }
44 } 52 }
45 53
46 JpegDecoderMgr::JpegDecoderMgr(SkStream* stream) 54 JpegDecoderMgr::JpegDecoderMgr(SkStream* stream)
47 : fSrcMgr(stream) 55 : fSrcMgr(stream)
48 , fInit(false) 56 , fInit(false)
49 { 57 {
50 // Error manager must be set before any calls to libjeg in order to handle f ailures 58 // Error manager must be set before any calls to libjeg in order to handle f ailures
51 fDInfo.err = jpeg_std_error(&fErrorMgr); 59 fDInfo.err = jpeg_std_error(&fErrorMgr);
52 fErrorMgr.error_exit = skjpeg_err_exit; 60 fErrorMgr.error_exit = skjpeg_err_exit;
(...skipping 12 matching lines...) Expand all
65 } 73 }
66 } 74 }
67 75
68 jmp_buf& JpegDecoderMgr::getJmpBuf() { 76 jmp_buf& JpegDecoderMgr::getJmpBuf() {
69 return fErrorMgr.fJmpBuf; 77 return fErrorMgr.fJmpBuf;
70 } 78 }
71 79
72 jpeg_decompress_struct* JpegDecoderMgr::dinfo() { 80 jpeg_decompress_struct* JpegDecoderMgr::dinfo() {
73 return &fDInfo; 81 return &fDInfo;
74 } 82 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698