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

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

Issue 2389983002: Refactored SkColorSpace and added in a Lab PCS GM (Closed)
Patch Set: migrated call from SkColorSpace_Base::makeLinearGamma() to SkColorSpace_XYZ::makeLinearGamma() Created 4 years, 2 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 | « samplecode/SampleApp.cpp ('k') | src/core/SkColorSpace.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 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 394 matching lines...) Expand 10 before | Expand all | Expand 10 after
405 } 405 }
406 return true; 406 return true;
407 case kGray_8_SkColorType: 407 case kGray_8_SkColorType:
408 if (fColorXform || JCS_GRAYSCALE != encodedColorType) { 408 if (fColorXform || JCS_GRAYSCALE != encodedColorType) {
409 return false; 409 return false;
410 } 410 }
411 411
412 fDecoderMgr->dinfo()->out_color_space = JCS_GRAYSCALE; 412 fDecoderMgr->dinfo()->out_color_space = JCS_GRAYSCALE;
413 return true; 413 return true;
414 case kRGBA_F16_SkColorType: 414 case kRGBA_F16_SkColorType:
415 SkASSERT(fColorXform); 415 if (!fColorXform) {
416 return false;
417 }
416 if (!dstInfo.colorSpace()->gammaIsLinear()) { 418 if (!dstInfo.colorSpace()->gammaIsLinear()) {
417 return false; 419 return false;
418 } 420 }
419 421
420 if (isCMYK) { 422 if (isCMYK) {
421 fDecoderMgr->dinfo()->out_color_space = JCS_CMYK; 423 fDecoderMgr->dinfo()->out_color_space = JCS_CMYK;
422 } else { 424 } else {
423 fDecoderMgr->dinfo()->out_color_space = JCS_EXT_RGBA; 425 fDecoderMgr->dinfo()->out_color_space = JCS_EXT_RGBA;
424 } 426 }
425 return true; 427 return true;
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
628 swizzlerOptions.fSubset = &fSwizzlerSubset; 630 swizzlerOptions.fSubset = &fSwizzlerSubset;
629 } 631 }
630 fSwizzler.reset(SkSwizzler::CreateSwizzler(swizzlerInfo, nullptr, dstInfo, s wizzlerOptions, 632 fSwizzler.reset(SkSwizzler::CreateSwizzler(swizzlerInfo, nullptr, dstInfo, s wizzlerOptions,
631 nullptr, preSwizzled)); 633 nullptr, preSwizzled));
632 SkASSERT(fSwizzler); 634 SkASSERT(fSwizzler);
633 } 635 }
634 636
635 void SkJpegCodec::initializeColorXform(const SkImageInfo& dstInfo) { 637 void SkJpegCodec::initializeColorXform(const SkImageInfo& dstInfo) {
636 if (needs_color_xform(dstInfo, this->getInfo())) { 638 if (needs_color_xform(dstInfo, this->getInfo())) {
637 fColorXform = SkColorSpaceXform::New(this->getInfo().colorSpace(), dstIn fo.colorSpace()); 639 fColorXform = SkColorSpaceXform::New(this->getInfo().colorSpace(), dstIn fo.colorSpace());
638 SkASSERT(fColorXform);
639 } 640 }
640 } 641 }
641 642
642 SkSampler* SkJpegCodec::getSampler(bool createIfNecessary) { 643 SkSampler* SkJpegCodec::getSampler(bool createIfNecessary) {
643 if (!createIfNecessary || fSwizzler) { 644 if (!createIfNecessary || fSwizzler) {
644 SkASSERT(!fSwizzler || (fSwizzleSrcRow && fStorage.get() == fSwizzleSrcR ow)); 645 SkASSERT(!fSwizzler || (fSwizzleSrcRow && fStorage.get() == fSwizzleSrcR ow));
645 return fSwizzler; 646 return fSwizzler;
646 } 647 }
647 648
648 this->initializeSwizzler(this->dstInfo(), this->options()); 649 this->initializeSwizzler(this->dstInfo(), this->options());
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after
926 927
927 JDIMENSION linesRead = jpeg_read_raw_data(dinfo, yuv, numRowsPerBlock); 928 JDIMENSION linesRead = jpeg_read_raw_data(dinfo, yuv, numRowsPerBlock);
928 if (linesRead < remainingRows) { 929 if (linesRead < remainingRows) {
929 // FIXME: Handle incomplete YUV decodes without signalling an error. 930 // FIXME: Handle incomplete YUV decodes without signalling an error.
930 return kInvalidInput; 931 return kInvalidInput;
931 } 932 }
932 } 933 }
933 934
934 return kSuccess; 935 return kSuccess;
935 } 936 }
OLDNEW
« no previous file with comments | « samplecode/SampleApp.cpp ('k') | src/core/SkColorSpace.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698