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

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

Issue 14031013: Only use JDCT_IFAST if it's supported. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 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 | Annotate | Revision Log
« 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 /* 2 /*
3 * Copyright 2007 The Android Open Source Project 3 * Copyright 2007 The Android Open Source Project
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 9
10 #include "SkImageDecoder.h" 10 #include "SkImageDecoder.h"
(...skipping 947 matching lines...) Expand 10 before | Expand all | Expand 10 after
958 cinfo.input_components = 3; 958 cinfo.input_components = 3;
959 #ifdef WE_CONVERT_TO_YUV 959 #ifdef WE_CONVERT_TO_YUV
960 cinfo.in_color_space = JCS_YCbCr; 960 cinfo.in_color_space = JCS_YCbCr;
961 #else 961 #else
962 cinfo.in_color_space = JCS_RGB; 962 cinfo.in_color_space = JCS_RGB;
963 #endif 963 #endif
964 cinfo.input_gamma = 1; 964 cinfo.input_gamma = 1;
965 965
966 jpeg_set_defaults(&cinfo); 966 jpeg_set_defaults(&cinfo);
967 jpeg_set_quality(&cinfo, quality, TRUE /* limit to baseline-JPEG values */); 967 jpeg_set_quality(&cinfo, quality, TRUE /* limit to baseline-JPEG values */);
968 #ifdef DCT_IFAST_SUPPORTED
968 cinfo.dct_method = JDCT_IFAST; 969 cinfo.dct_method = JDCT_IFAST;
970 #endif
969 971
970 jpeg_start_compress(&cinfo, TRUE); 972 jpeg_start_compress(&cinfo, TRUE);
971 973
972 const int width = bm.width(); 974 const int width = bm.width();
973 uint8_t* oneRowP = (uint8_t*)oneRow.reset(width * 3); 975 uint8_t* oneRowP = (uint8_t*)oneRow.reset(width * 3);
974 976
975 const SkPMColor* colors = ctLocker.lockColors(bm); 977 const SkPMColor* colors = ctLocker.lockColors(bm);
976 const void* srcRow = bm.getPixels(); 978 const void* srcRow = bm.getPixels();
977 979
978 while (cinfo.next_scanline < cinfo.image_height) { 980 while (cinfo.next_scanline < cinfo.image_height) {
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
1014 return SkNEW(SkJPEGImageDecoder); 1016 return SkNEW(SkJPEGImageDecoder);
1015 } 1017 }
1016 1018
1017 static SkImageEncoder* sk_libjpeg_efactory(SkImageEncoder::Type t) { 1019 static SkImageEncoder* sk_libjpeg_efactory(SkImageEncoder::Type t) {
1018 return (SkImageEncoder::kJPEG_Type == t) ? SkNEW(SkJPEGImageEncoder) : NULL; 1020 return (SkImageEncoder::kJPEG_Type == t) ? SkNEW(SkJPEGImageEncoder) : NULL;
1019 } 1021 }
1020 1022
1021 1023
1022 static SkTRegistry<SkImageDecoder*, SkStream*> gDReg(sk_libjpeg_dfactory); 1024 static SkTRegistry<SkImageDecoder*, SkStream*> gDReg(sk_libjpeg_dfactory);
1023 static SkTRegistry<SkImageEncoder*, SkImageEncoder::Type> gEReg(sk_libjpeg_efact ory); 1025 static SkTRegistry<SkImageEncoder*, SkImageEncoder::Type> gEReg(sk_libjpeg_efact ory);
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