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

Side by Side Diff: src/images/SkImageDecoder_libjpeg.cpp

Issue 858323003: Revert of Muck with the right cinfo. (Closed) Base URL: https://skia.googlesource.com/skia.git@anotherFix
Patch Set: Created 5 years, 11 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 | « no previous file | no next file » | 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 2007 The Android Open Source Project 2 * Copyright 2007 The Android Open Source Project
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 8
9 #include "SkImageDecoder.h" 9 #include "SkImageDecoder.h"
10 #include "SkImageEncoder.h" 10 #include "SkImageEncoder.h"
(...skipping 922 matching lines...) Expand 10 before | Expand all | Expand 10 after
933 933
934 return true; 934 return true;
935 } 935 }
936 936
937 /////////////////////////////////////////////////////////////////////////////// 937 ///////////////////////////////////////////////////////////////////////////////
938 938
939 #ifdef SK_BUILD_FOR_ANDROID 939 #ifdef SK_BUILD_FOR_ANDROID
940 bool SkJPEGImageDecoder::onBuildTileIndex(SkStreamRewindable* stream, int *width , int *height) { 940 bool SkJPEGImageDecoder::onBuildTileIndex(SkStreamRewindable* stream, int *width , int *height) {
941 941
942 SkAutoTDelete<SkJPEGImageIndex> imageIndex(SkNEW_ARGS(SkJPEGImageIndex, (str eam, this))); 942 SkAutoTDelete<SkJPEGImageIndex> imageIndex(SkNEW_ARGS(SkJPEGImageIndex, (str eam, this)));
943 jpeg_decompress_struct* cinfo = imageIndex->cinfo();
943 944
944 skjpeg_error_mgr sk_err; 945 skjpeg_error_mgr sk_err;
946 set_error_mgr(cinfo, &sk_err);
945 947
946 // All objects need to be instantiated before this setjmp call so that 948 // All objects need to be instantiated before this setjmp call so that
947 // they will be cleaned up properly if an error occurs. 949 // they will be cleaned up properly if an error occurs.
948 if (setjmp(sk_err.fJmpBuf)) { 950 if (setjmp(sk_err.fJmpBuf)) {
949 return false; 951 return false;
950 } 952 }
951 953
952 // create the cinfo used to create/build the huffmanIndex 954 // create the cinfo used to create/build the huffmanIndex
953 if (!imageIndex->initializeInfoAndReadHeader()) { 955 if (!imageIndex->initializeInfoAndReadHeader()) {
954 return false; 956 return false;
955 } 957 }
956 958
957 if (!imageIndex->buildHuffmanIndex()) { 959 if (!imageIndex->buildHuffmanIndex()) {
958 return false; 960 return false;
959 } 961 }
960 962
961 // destroy the cinfo used to create/build the huffman index 963 // destroy the cinfo used to create/build the huffman index
962 imageIndex->destroyInfo(); 964 imageIndex->destroyInfo();
963 965
964 // Init decoder to image decode mode 966 // Init decoder to image decode mode
965 if (!imageIndex->initializeInfoAndReadHeader()) { 967 if (!imageIndex->initializeInfoAndReadHeader()) {
966 return false; 968 return false;
967 } 969 }
968 970
969 jpeg_decompress_struct* cinfo = imageIndex->cinfo();
970 set_error_mgr(cinfo, &sk_err);
971
972 // FIXME: This sets cinfo->out_color_space, which we may change later 971 // FIXME: This sets cinfo->out_color_space, which we may change later
973 // based on the config in onDecodeSubset. This should be fine, since 972 // based on the config in onDecodeSubset. This should be fine, since
974 // jpeg_init_read_tile_scanline will check out_color_space again after 973 // jpeg_init_read_tile_scanline will check out_color_space again after
975 // that change (when it calls jinit_color_deconverter). 974 // that change (when it calls jinit_color_deconverter).
976 (void) this->getBitmapColorType(cinfo); 975 (void) this->getBitmapColorType(cinfo);
977 976
978 turn_off_visual_optimizations(cinfo); 977 turn_off_visual_optimizations(cinfo);
979 978
980 // instead of jpeg_start_decompress() we start a tiled decompress 979 // instead of jpeg_start_decompress() we start a tiled decompress
981 if (!imageIndex->startTileDecompress()) { 980 if (!imageIndex->startTileDecompress()) {
(...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after
1443 return SkImageDecoder::kUnknown_Format; 1442 return SkImageDecoder::kUnknown_Format;
1444 } 1443 }
1445 1444
1446 static SkImageEncoder* sk_libjpeg_efactory(SkImageEncoder::Type t) { 1445 static SkImageEncoder* sk_libjpeg_efactory(SkImageEncoder::Type t) {
1447 return (SkImageEncoder::kJPEG_Type == t) ? SkNEW(SkJPEGImageEncoder) : NULL; 1446 return (SkImageEncoder::kJPEG_Type == t) ? SkNEW(SkJPEGImageEncoder) : NULL;
1448 } 1447 }
1449 1448
1450 static SkImageDecoder_DecodeReg gDReg(sk_libjpeg_dfactory); 1449 static SkImageDecoder_DecodeReg gDReg(sk_libjpeg_dfactory);
1451 static SkImageDecoder_FormatReg gFormatReg(get_format_jpeg); 1450 static SkImageDecoder_FormatReg gFormatReg(get_format_jpeg);
1452 static SkImageEncoder_EncodeReg gEReg(sk_libjpeg_efactory); 1451 static SkImageEncoder_EncodeReg gEReg(sk_libjpeg_efactory);
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698