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

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

Issue 1641273003: Support decoding opaque to *premul (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Test opaque to premul in dm Created 4 years, 10 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 "SkJpegCodec.h" 9 #include "SkJpegCodec.h"
10 #include "SkJpegDecoderMgr.h" 10 #include "SkJpegDecoderMgr.h"
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 * Sets the output color space 157 * Sets the output color space
158 */ 158 */
159 bool SkJpegCodec::setOutputColorSpace(const SkImageInfo& dst) { 159 bool SkJpegCodec::setOutputColorSpace(const SkImageInfo& dst) {
160 const SkImageInfo& src = this->getInfo(); 160 const SkImageInfo& src = this->getInfo();
161 161
162 // Ensure that the profile type is unchanged 162 // Ensure that the profile type is unchanged
163 if (dst.profileType() != src.profileType()) { 163 if (dst.profileType() != src.profileType()) {
164 return false; 164 return false;
165 } 165 }
166 166
167 // Ensure that the alpha type is opaque 167 if (kUnknown_SkAlphaType == dst.alphaType()) {
168 if (kOpaque_SkAlphaType != dst.alphaType()) {
169 return false; 168 return false;
170 } 169 }
171 170
172 // Check if we will decode to CMYK because a conversion to RGBA is not suppo rted 171 // Check if we will decode to CMYK because a conversion to RGBA is not suppo rted
173 J_COLOR_SPACE colorSpace = fDecoderMgr->dinfo()->jpeg_color_space; 172 J_COLOR_SPACE colorSpace = fDecoderMgr->dinfo()->jpeg_color_space;
174 bool isCMYK = JCS_CMYK == colorSpace || JCS_YCCK == colorSpace; 173 bool isCMYK = JCS_CMYK == colorSpace || JCS_YCCK == colorSpace;
175 174
176 // Check for valid color types and set the output color space 175 // Check for valid color types and set the output color space
177 switch (dst.colorType()) { 176 switch (dst.colorType()) {
178 case kN32_SkColorType: 177 case kN32_SkColorType:
(...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after
637 636
638 JDIMENSION linesRead = jpeg_read_raw_data(dinfo, yuv, numRowsPerBlock); 637 JDIMENSION linesRead = jpeg_read_raw_data(dinfo, yuv, numRowsPerBlock);
639 if (linesRead < remainingRows) { 638 if (linesRead < remainingRows) {
640 // FIXME: Handle incomplete YUV decodes without signalling an error. 639 // FIXME: Handle incomplete YUV decodes without signalling an error.
641 return kInvalidInput; 640 return kInvalidInput;
642 } 641 }
643 } 642 }
644 643
645 return kSuccess; 644 return kSuccess;
646 } 645 }
OLDNEW
« dm/DM.cpp ('K') | « src/codec/SkGifCodec.cpp ('k') | src/codec/SkPngCodec.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698