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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 dst = SkTAddOffset<void>(dst, fDstInfo.minRowBytes()); | 87 dst = SkTAddOffset<void>(dst, fDstInfo.minRowBytes()); |
88 } | 88 } |
89 } | 89 } |
90 #endif | 90 #endif |
91 | 91 |
92 void ColorCodecBench::xformOnly() { | 92 void ColorCodecBench::xformOnly() { |
93 sk_sp<SkColorSpace> srcSpace = SkColorSpace::NewICC(fSrcData->data(), fSrcDa
ta->size()); | 93 sk_sp<SkColorSpace> srcSpace = SkColorSpace::NewICC(fSrcData->data(), fSrcDa
ta->size()); |
94 if (!srcSpace) { | 94 if (!srcSpace) { |
95 srcSpace = SkColorSpace::NewNamed(SkColorSpace::kSRGB_Named); | 95 srcSpace = SkColorSpace::NewNamed(SkColorSpace::kSRGB_Named); |
96 } | 96 } |
97 std::unique_ptr<SkColorSpaceXform> xform = SkColorSpaceXform::New(srcSpace,
fDstSpace); | 97 std::unique_ptr<SkColorSpaceXform> xform = SkColorSpaceXform::New(srcSpace.g
et(), |
| 98 fDstSpace.
get()); |
98 SkASSERT(xform); | 99 SkASSERT(xform); |
99 | 100 |
100 void* dst = fDst.get(); | 101 void* dst = fDst.get(); |
101 void* src = fSrc.get(); | 102 void* src = fSrc.get(); |
102 for (int y = 0; y < fSrcInfo.height(); y++) { | 103 for (int y = 0; y < fSrcInfo.height(); y++) { |
103 xform->apply(dst, (uint32_t*) src, fSrcInfo.width(), | 104 xform->apply(dst, (uint32_t*) src, fSrcInfo.width(), |
104 select_xform_format(fDstInfo.colorType()), fDstInfo.alphaTy
pe()); | 105 select_xform_format(fDstInfo.colorType()), fDstInfo.alphaTy
pe()); |
105 dst = SkTAddOffset<void>(dst, fDstInfo.minRowBytes()); | 106 dst = SkTAddOffset<void>(dst, fDstInfo.minRowBytes()); |
106 src = SkTAddOffset<void>(src, fSrcInfo.minRowBytes()); | 107 src = SkTAddOffset<void>(src, fSrcInfo.minRowBytes()); |
107 } | 108 } |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
205 #endif | 206 #endif |
206 { | 207 { |
207 if (FLAGS_xform_only) { | 208 if (FLAGS_xform_only) { |
208 this->xformOnly(); | 209 this->xformOnly(); |
209 } else { | 210 } else { |
210 this->decodeAndXform(); | 211 this->decodeAndXform(); |
211 } | 212 } |
212 } | 213 } |
213 } | 214 } |
214 } | 215 } |
OLD | NEW |