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

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

Issue 1582083005: Clean up unused or overly complex modes in SkSwizzler (Closed) Base URL: https://skia.googlesource.com/skia.git@neon-unpremul
Patch Set: Response to comments Created 4 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 | « src/codec/SkCodec_libpng.cpp ('k') | src/codec/SkSwizzler.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 "SkCodec.h" 8 #include "SkCodec.h"
9 #include "SkJpegCodec.h" 9 #include "SkJpegCodec.h"
10 #include "SkJpegDecoderMgr.h" 10 #include "SkJpegDecoderMgr.h"
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after
322 } 322 }
323 323
324 return kSuccess; 324 return kSuccess;
325 } 325 }
326 326
327 void SkJpegCodec::initializeSwizzler(const SkImageInfo& dstInfo, const Options& options) { 327 void SkJpegCodec::initializeSwizzler(const SkImageInfo& dstInfo, const Options& options) {
328 SkSwizzler::SrcConfig srcConfig = SkSwizzler::kUnknown; 328 SkSwizzler::SrcConfig srcConfig = SkSwizzler::kUnknown;
329 if (JCS_CMYK == fDecoderMgr->dinfo()->out_color_space) { 329 if (JCS_CMYK == fDecoderMgr->dinfo()->out_color_space) {
330 srcConfig = SkSwizzler::kCMYK; 330 srcConfig = SkSwizzler::kCMYK;
331 } else { 331 } else {
332 // If the out_color_space is not CMYK, the only reason we would need a s wizzler is
333 // for sampling and/or subsetting.
332 switch (dstInfo.colorType()) { 334 switch (dstInfo.colorType()) {
333 case kGray_8_SkColorType: 335 case kGray_8_SkColorType:
334 srcConfig = SkSwizzler::kGray; 336 srcConfig = SkSwizzler::kNoOp8;
335 break; 337 break;
336 case kRGBA_8888_SkColorType: 338 case kN32_SkColorType:
337 srcConfig = SkSwizzler::kRGBX; 339 srcConfig = SkSwizzler::kNoOp32;
338 break;
339 case kBGRA_8888_SkColorType:
340 srcConfig = SkSwizzler::kBGRX;
341 break; 340 break;
342 case kRGB_565_SkColorType: 341 case kRGB_565_SkColorType:
343 srcConfig = SkSwizzler::kRGB_565; 342 srcConfig = SkSwizzler::kNoOp16;
344 break; 343 break;
345 default: 344 default:
346 // This function should only be called if the colorType is suppo rted by jpeg 345 // This function should only be called if the colorType is suppo rted by jpeg
347 SkASSERT(false); 346 SkASSERT(false);
348 } 347 }
349 } 348 }
350 349
351 fSwizzler.reset(SkSwizzler::CreateSwizzler(srcConfig, nullptr, dstInfo, opti ons)); 350 fSwizzler.reset(SkSwizzler::CreateSwizzler(srcConfig, nullptr, dstInfo, opti ons));
352 fStorage.reset(get_row_bytes(fDecoderMgr->dinfo())); 351 fStorage.reset(get_row_bytes(fDecoderMgr->dinfo()));
353 fSrcRow = fStorage.get(); 352 fSrcRow = fStorage.get();
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
445 #endif 444 #endif
446 445
447 bool SkJpegCodec::onSkipScanlines(int count) { 446 bool SkJpegCodec::onSkipScanlines(int count) {
448 // Set the jump location for libjpeg errors 447 // Set the jump location for libjpeg errors
449 if (setjmp(fDecoderMgr->getJmpBuf())) { 448 if (setjmp(fDecoderMgr->getJmpBuf())) {
450 return fDecoderMgr->returnFalse("setjmp"); 449 return fDecoderMgr->returnFalse("setjmp");
451 } 450 }
452 451
453 return (uint32_t) count == jpeg_skip_scanlines(fDecoderMgr->dinfo(), count); 452 return (uint32_t) count == jpeg_skip_scanlines(fDecoderMgr->dinfo(), count);
454 } 453 }
OLDNEW
« no previous file with comments | « src/codec/SkCodec_libpng.cpp ('k') | src/codec/SkSwizzler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698