OLD | NEW |
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 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 fSrcData = codec->getICCData(); | 165 fSrcData = codec->getICCData(); |
166 sk_sp<SkData> dstData = SkData::MakeFromFileName( | 166 sk_sp<SkData> dstData = SkData::MakeFromFileName( |
167 GetResourcePath("monitor_profiles/HP_ZR30w.icc").c_str()); | 167 GetResourcePath("monitor_profiles/HP_ZR30w.icc").c_str()); |
168 SkASSERT(dstData); | 168 SkASSERT(dstData); |
169 | 169 |
170 | 170 |
171 #if defined(SK_TEST_QCMS) | 171 #if defined(SK_TEST_QCMS) |
172 if (FLAGS_qcms) { | 172 if (FLAGS_qcms) { |
173 fDstSpaceQCMS.reset(qcms_profile_from_memory(dstData->data(), dstData->s
ize())); | 173 fDstSpaceQCMS.reset(qcms_profile_from_memory(dstData->data(), dstData->s
ize())); |
174 SkASSERT(fDstSpaceQCMS); | 174 SkASSERT(fDstSpaceQCMS); |
| 175 |
| 176 // This call takes a non-trivial amount of time, but I think it's the mo
st fair to |
| 177 // treat it as overhead. It only needs to happen once. |
| 178 qcms_profile_precache_output_transform(fDstSpaceQCMS); |
175 } else | 179 } else |
176 #endif | 180 #endif |
177 { | 181 { |
178 fDstSpace = SkColorSpace::NewICC(dstData->data(), dstData->size()); | 182 fDstSpace = SkColorSpace::NewICC(dstData->data(), dstData->size()); |
179 SkASSERT(fDstSpace); | 183 SkASSERT(fDstSpace); |
180 } | 184 } |
181 } | 185 } |
182 | 186 |
183 void ColorCodecBench::onDraw(int n, SkCanvas*) { | 187 void ColorCodecBench::onDraw(int n, SkCanvas*) { |
184 for (int i = 0; i < n; i++) { | 188 for (int i = 0; i < n; i++) { |
185 #if defined(SK_TEST_QCMS) | 189 #if defined(SK_TEST_QCMS) |
186 if (FLAGS_qcms) { | 190 if (FLAGS_qcms) { |
187 if (FLAGS_xform_only) { | 191 if (FLAGS_xform_only) { |
188 this->xformOnlyQCMS(); | 192 this->xformOnlyQCMS(); |
189 } else { | 193 } else { |
190 this->decodeAndXformQCMS(); | 194 this->decodeAndXformQCMS(); |
191 } | 195 } |
192 } else | 196 } else |
193 #endif | 197 #endif |
194 { | 198 { |
195 if (FLAGS_xform_only) { | 199 if (FLAGS_xform_only) { |
196 this->xformOnly(); | 200 this->xformOnly(); |
197 } else { | 201 } else { |
198 this->decodeAndXform(); | 202 this->decodeAndXform(); |
199 } | 203 } |
200 } | 204 } |
201 } | 205 } |
202 } | 206 } |
OLD | NEW |