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

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

Issue 1088093003: Return cropBitmap (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 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 | « AUTHORS ('k') | src/images/SkImageDecoder_libwebp.cpp » ('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 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 1107 matching lines...) Expand 10 before | Expand all | Expand 10 after
1118 } 1118 }
1119 if (this->shouldCancelDecode()) { 1119 if (this->shouldCancelDecode()) {
1120 return return_false(*cinfo, bitmap, "shouldCancelDecode"); 1120 return return_false(*cinfo, bitmap, "shouldCancelDecode");
1121 } 1121 }
1122 rowTotalCount += rowCount; 1122 rowTotalCount += rowCount;
1123 rowptr += bpr; 1123 rowptr += bpr;
1124 } 1124 }
1125 1125
1126 if (swapOnly) { 1126 if (swapOnly) {
1127 bm->swap(bitmap); 1127 bm->swap(bitmap);
1128 } else { 1128 return true;
1129 cropBitmap(bm, &bitmap, actualSampleSize, region.x(), region.y(),
1130 region.width(), region.height(), startX, startY);
1131 } 1129 }
1132 return true; 1130
1131 return cropBitmap(bm, &bitmap, actualSampleSize, region.x(), region.y(),
1132 region.width(), region.height(), startX, startY);
1133 } 1133 }
1134 #endif 1134 #endif
1135 1135
1136 // check for supported formats 1136 // check for supported formats
1137 SkScaledBitmapSampler::SrcConfig sc; 1137 SkScaledBitmapSampler::SrcConfig sc;
1138 int srcBytesPerPixel; 1138 int srcBytesPerPixel;
1139 1139
1140 if (!get_src_config(*cinfo, &sc, &srcBytesPerPixel)) { 1140 if (!get_src_config(*cinfo, &sc, &srcBytesPerPixel)) {
1141 return return_false(*cinfo, *bm, "jpeg colorspace"); 1141 return return_false(*cinfo, *bm, "jpeg colorspace");
1142 } 1142 }
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
1177 break; 1177 break;
1178 } 1178 }
1179 1179
1180 if (!skip_src_rows_tile(cinfo, fImageIndex->huffmanIndex(), srcRow, 1180 if (!skip_src_rows_tile(cinfo, fImageIndex->huffmanIndex(), srcRow,
1181 sampler.srcDY() - 1)) { 1181 sampler.srcDY() - 1)) {
1182 return return_false(*cinfo, bitmap, "skip rows"); 1182 return return_false(*cinfo, bitmap, "skip rows");
1183 } 1183 }
1184 } 1184 }
1185 if (swapOnly) { 1185 if (swapOnly) {
1186 bm->swap(bitmap); 1186 bm->swap(bitmap);
1187 } else { 1187 return true;
1188 cropBitmap(bm, &bitmap, actualSampleSize, region.x(), region.y(),
1189 region.width(), region.height(), startX, startY);
1190 } 1188 }
1191 return true; 1189 return cropBitmap(bm, &bitmap, actualSampleSize, region.x(), region.y(),
1190 region.width(), region.height(), startX, startY);
1192 } 1191 }
1193 #endif 1192 #endif
1194 1193
1195 /////////////////////////////////////////////////////////////////////////////// 1194 ///////////////////////////////////////////////////////////////////////////////
1196 1195
1197 #include "SkColorPriv.h" 1196 #include "SkColorPriv.h"
1198 1197
1199 // taken from jcolor.c in libjpeg 1198 // taken from jcolor.c in libjpeg
1200 #if 0 // 16bit - precise but slow 1199 #if 0 // 16bit - precise but slow
1201 #define CYR 19595 // 0.299 1200 #define CYR 19595 // 0.299
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
1467 return SkImageDecoder::kUnknown_Format; 1466 return SkImageDecoder::kUnknown_Format;
1468 } 1467 }
1469 1468
1470 static SkImageEncoder* sk_libjpeg_efactory(SkImageEncoder::Type t) { 1469 static SkImageEncoder* sk_libjpeg_efactory(SkImageEncoder::Type t) {
1471 return (SkImageEncoder::kJPEG_Type == t) ? SkNEW(SkJPEGImageEncoder) : NULL; 1470 return (SkImageEncoder::kJPEG_Type == t) ? SkNEW(SkJPEGImageEncoder) : NULL;
1472 } 1471 }
1473 1472
1474 static SkImageDecoder_DecodeReg gDReg(sk_libjpeg_dfactory); 1473 static SkImageDecoder_DecodeReg gDReg(sk_libjpeg_dfactory);
1475 static SkImageDecoder_FormatReg gFormatReg(get_format_jpeg); 1474 static SkImageDecoder_FormatReg gFormatReg(get_format_jpeg);
1476 static SkImageEncoder_EncodeReg gEReg(sk_libjpeg_efactory); 1475 static SkImageEncoder_EncodeReg gEReg(sk_libjpeg_efactory);
OLDNEW
« no previous file with comments | « AUTHORS ('k') | src/images/SkImageDecoder_libwebp.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698