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

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

Issue 1918943002: Remove SkEncodedInfo kPreSwizzled_Color from public API (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 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
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 "SkMSAN.h" 9 #include "SkMSAN.h"
10 #include "SkJpegCodec.h" 10 #include "SkJpegCodec.h"
(...skipping 500 matching lines...) Expand 10 before | Expand all | Expand 10 after
511 } 511 }
512 } 512 }
513 513
514 return kSuccess; 514 return kSuccess;
515 } 515 }
516 516
517 void SkJpegCodec::initializeSwizzler(const SkImageInfo& dstInfo, const Options& options) { 517 void SkJpegCodec::initializeSwizzler(const SkImageInfo& dstInfo, const Options& options) {
518 // libjpeg-turbo may have already performed color conversion. We must indic ate the 518 // libjpeg-turbo may have already performed color conversion. We must indic ate the
519 // appropriate format to the swizzler. 519 // appropriate format to the swizzler.
520 SkEncodedInfo swizzlerInfo = this->getEncodedInfo(); 520 SkEncodedInfo swizzlerInfo = this->getEncodedInfo();
521 bool preSwizzled = true;
521 switch (fDecoderMgr->dinfo()->out_color_space) { 522 switch (fDecoderMgr->dinfo()->out_color_space) {
522 case JCS_RGB: 523 case JCS_RGB:
524 preSwizzled = false;
523 swizzlerInfo.setColor(SkEncodedInfo::kRGB_Color); 525 swizzlerInfo.setColor(SkEncodedInfo::kRGB_Color);
524 break; 526 break;
525 case JCS_CMYK: 527 case JCS_CMYK:
528 preSwizzled = false;
526 swizzlerInfo.setColor(SkEncodedInfo::kInvertedCMYK_Color); 529 swizzlerInfo.setColor(SkEncodedInfo::kInvertedCMYK_Color);
527 break; 530 break;
528 default: 531 default:
529 swizzlerInfo.setColor(SkEncodedInfo::kPreSwizzled_Color);
530 break; 532 break;
531 } 533 }
532 534
533 Options swizzlerOptions = options; 535 Options swizzlerOptions = options;
534 if (options.fSubset) { 536 if (options.fSubset) {
535 // Use fSwizzlerSubset if this is a subset decode. This is necessary in the case 537 // Use fSwizzlerSubset if this is a subset decode. This is necessary in the case
536 // where libjpeg-turbo provides a subset and then we need to subset it f urther. 538 // where libjpeg-turbo provides a subset and then we need to subset it f urther.
537 // Also, verify that fSwizzlerSubset is initialized and valid. 539 // Also, verify that fSwizzlerSubset is initialized and valid.
538 SkASSERT(!fSwizzlerSubset.isEmpty() && fSwizzlerSubset.x() <= options.fS ubset->x() && 540 SkASSERT(!fSwizzlerSubset.isEmpty() && fSwizzlerSubset.x() <= options.fS ubset->x() &&
539 fSwizzlerSubset.width() == options.fSubset->width()); 541 fSwizzlerSubset.width() == options.fSubset->width());
540 swizzlerOptions.fSubset = &fSwizzlerSubset; 542 swizzlerOptions.fSubset = &fSwizzlerSubset;
541 } 543 }
542 fSwizzler.reset(SkSwizzler::CreateSwizzler(swizzlerInfo, nullptr, dstInfo, s wizzlerOptions)); 544 fSwizzler.reset(SkSwizzler::CreateSwizzler(swizzlerInfo, nullptr, dstInfo, s wizzlerOptions,
545 nullptr, preSwizzled));
543 SkASSERT(fSwizzler); 546 SkASSERT(fSwizzler);
544 fStorage.reset(get_row_bytes(fDecoderMgr->dinfo())); 547 fStorage.reset(get_row_bytes(fDecoderMgr->dinfo()));
545 fSrcRow = fStorage.get(); 548 fSrcRow = fStorage.get();
546 } 549 }
547 550
548 SkSampler* SkJpegCodec::getSampler(bool createIfNecessary) { 551 SkSampler* SkJpegCodec::getSampler(bool createIfNecessary) {
549 if (!createIfNecessary || fSwizzler) { 552 if (!createIfNecessary || fSwizzler) {
550 SkASSERT(!fSwizzler || (fSrcRow && fStorage.get() == fSrcRow)); 553 SkASSERT(!fSwizzler || (fSrcRow && fStorage.get() == fSrcRow));
551 return fSwizzler; 554 return fSwizzler;
552 } 555 }
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after
887 890
888 JDIMENSION linesRead = jpeg_read_raw_data(dinfo, yuv, numRowsPerBlock); 891 JDIMENSION linesRead = jpeg_read_raw_data(dinfo, yuv, numRowsPerBlock);
889 if (linesRead < remainingRows) { 892 if (linesRead < remainingRows) {
890 // FIXME: Handle incomplete YUV decodes without signalling an error. 893 // FIXME: Handle incomplete YUV decodes without signalling an error.
891 return kInvalidInput; 894 return kInvalidInput;
892 } 895 }
893 } 896 }
894 897
895 return kSuccess; 898 return kSuccess;
896 } 899 }
OLDNEW
« no previous file with comments | « include/codec/SkEncodedInfo.h ('k') | src/codec/SkSwizzler.h » ('j') | src/codec/SkSwizzler.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698