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

Side by Side Diff: bench/ColorCodecBench.cpp

Issue 2319293003: Checking for valid colorType, alphaType, colorSpace in SkCodec (Closed)
Patch Set: Fix nanobench Created 4 years, 3 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 | « no previous file | dm/DMSrcSink.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 2016 Google Inc. 2 * Copyright 2016 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 "ColorCodecBench.h" 8 #include "ColorCodecBench.h"
9 #include "Resources.h" 9 #include "Resources.h"
10 #include "SkCodec.h" 10 #include "SkCodec.h"
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 } else 155 } else
156 #endif 156 #endif
157 { 157 {
158 fDstSpace = FLAGS_srgb ? SkColorSpace::NewNamed(SkColorSpace::kSRGB_Name d) : 158 fDstSpace = FLAGS_srgb ? SkColorSpace::NewNamed(SkColorSpace::kSRGB_Name d) :
159 SkColorSpace::NewICC(dstData->data(), dstData-> size()); 159 SkColorSpace::NewICC(dstData->data(), dstData-> size());
160 SkASSERT(fDstSpace); 160 SkASSERT(fDstSpace);
161 } 161 }
162 162
163 fSrcInfo = codec->getInfo().makeColorType(kRGBA_8888_SkColorType); 163 fSrcInfo = codec->getInfo().makeColorType(kRGBA_8888_SkColorType);
164 164
165 fDstInfo = fSrcInfo.makeColorSpace(fDstSpace);
166 if (FLAGS_half) { 165 if (FLAGS_half) {
167 fDstInfo = fDstInfo.makeColorType(kRGBA_F16_SkColorType); 166 fDstInfo = fDstInfo.makeColorType(kRGBA_F16_SkColorType);
167 fDstSpace = fDstSpace->makeLinearGamma();
168 } 168 }
169
170 fDstInfo = fSrcInfo.makeColorSpace(fDstSpace);
171
169 fDst.reset(fDstInfo.getSafeSize(fDstInfo.minRowBytes())); 172 fDst.reset(fDstInfo.getSafeSize(fDstInfo.minRowBytes()));
170 173
171 if (FLAGS_xform_only) { 174 if (FLAGS_xform_only) {
172 fSrc.reset(fSrcInfo.getSafeSize(fSrcInfo.minRowBytes())); 175 fSrc.reset(fSrcInfo.getSafeSize(fSrcInfo.minRowBytes()));
173 codec->getPixels(fSrcInfo, fSrc.get(), fSrcInfo.minRowBytes()); 176 codec->getPixels(fSrcInfo, fSrc.get(), fSrcInfo.minRowBytes());
174 } 177 }
175 #if defined(SK_TEST_QCMS) 178 #if defined(SK_TEST_QCMS)
176 else if (FLAGS_qcms) { 179 else if (FLAGS_qcms) {
177 // Set-up a row buffer to decode into before transforming to dst. 180 // Set-up a row buffer to decode into before transforming to dst.
178 fSrc.reset(fSrcInfo.minRowBytes()); 181 fSrc.reset(fSrcInfo.minRowBytes());
(...skipping 21 matching lines...) Expand all
200 #endif 203 #endif
201 { 204 {
202 if (FLAGS_xform_only) { 205 if (FLAGS_xform_only) {
203 this->xformOnly(); 206 this->xformOnly();
204 } else { 207 } else {
205 this->decodeAndXform(); 208 this->decodeAndXform();
206 } 209 }
207 } 210 }
208 } 211 }
209 } 212 }
OLDNEW
« no previous file with comments | « no previous file | dm/DMSrcSink.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698