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

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

Issue 2196743002: Add SkColorSpace::Equals() API (Closed) Base URL: https://skia.googlesource.com/skia.git@cscleanup
Patch Set: Fix logic Created 4 years, 4 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 | « include/core/SkImageInfo.h ('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 457 matching lines...) Expand 10 before | Expand all | Expand 10 after
468 num -= 1; 468 num -= 1;
469 calc_output_dimensions(&dinfo, num, denom); 469 calc_output_dimensions(&dinfo, num, denom);
470 } 470 }
471 471
472 fDecoderMgr->dinfo()->scale_num = num; 472 fDecoderMgr->dinfo()->scale_num = num;
473 fDecoderMgr->dinfo()->scale_denom = denom; 473 fDecoderMgr->dinfo()->scale_denom = denom;
474 return true; 474 return true;
475 } 475 }
476 476
477 static bool needs_color_xform(const SkImageInfo& dstInfo, const SkImageInfo& src Info) { 477 static bool needs_color_xform(const SkImageInfo& dstInfo, const SkImageInfo& src Info) {
478 // FIXME (msarett):
479 // Do a better check for color space equality.
480 return (kRGBA_F16_SkColorType == dstInfo.colorType()) || 478 return (kRGBA_F16_SkColorType == dstInfo.colorType()) ||
481 (dstInfo.colorSpace() && (dstInfo.colorSpace() != srcInfo.colorSpace( ))); 479 (dstInfo.colorSpace() && !SkColorSpace::Equals(srcInfo.colorSpace(),
480 dstInfo.colorSpace())) ;
482 } 481 }
483 482
484 int SkJpegCodec::readRows(const SkImageInfo& dstInfo, void* dst, size_t rowBytes , int count) { 483 int SkJpegCodec::readRows(const SkImageInfo& dstInfo, void* dst, size_t rowBytes , int count) {
485 // Set the jump location for libjpeg-turbo errors 484 // Set the jump location for libjpeg-turbo errors
486 if (setjmp(fDecoderMgr->getJmpBuf())) { 485 if (setjmp(fDecoderMgr->getJmpBuf())) {
487 return 0; 486 return 0;
488 } 487 }
489 488
490 // When fSwizzleSrcRow is non-null, it means that we need to swizzle. In th is case, 489 // When fSwizzleSrcRow is non-null, it means that we need to swizzle. In th is case,
491 // we will always decode into fSwizzlerSrcRow before swizzling into the next buffer. 490 // we will always decode into fSwizzlerSrcRow before swizzling into the next buffer.
(...skipping 501 matching lines...) Expand 10 before | Expand all | Expand 10 after
993 992
994 JDIMENSION linesRead = jpeg_read_raw_data(dinfo, yuv, numRowsPerBlock); 993 JDIMENSION linesRead = jpeg_read_raw_data(dinfo, yuv, numRowsPerBlock);
995 if (linesRead < remainingRows) { 994 if (linesRead < remainingRows) {
996 // FIXME: Handle incomplete YUV decodes without signalling an error. 995 // FIXME: Handle incomplete YUV decodes without signalling an error.
997 return kInvalidInput; 996 return kInvalidInput;
998 } 997 }
999 } 998 }
1000 999
1001 return kSuccess; 1000 return kSuccess;
1002 } 1001 }
OLDNEW
« no previous file with comments | « include/core/SkImageInfo.h ('k') | src/core/SkColorSpace.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698