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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 SkASSERT(xform); | 53 SkASSERT(xform); |
54 | 54 |
55 void* dst = fDst.get(); | 55 void* dst = fDst.get(); |
56 for (int y = 0; y < fInfo.height(); y++) { | 56 for (int y = 0; y < fInfo.height(); y++) { |
57 #ifdef SK_DEBUG | 57 #ifdef SK_DEBUG |
58 const int rows = | 58 const int rows = |
59 #endif | 59 #endif |
60 codec->getScanlines(fSrc.get(), 1, 0); | 60 codec->getScanlines(fSrc.get(), 1, 0); |
61 SkASSERT(1 == rows); | 61 SkASSERT(1 == rows); |
62 | 62 |
63 xform->xform_RGBA_8888((uint32_t*) dst, (uint32_t*) fSrc.get(), fInfo.wi
dth()); | 63 xform->xform_RGB1_8888((uint32_t*) dst, (uint32_t*) fSrc.get(), fInfo.wi
dth()); |
64 dst = SkTAddOffset<void>(dst, fInfo.minRowBytes()); | 64 dst = SkTAddOffset<void>(dst, fInfo.minRowBytes()); |
65 } | 65 } |
66 } | 66 } |
67 | 67 |
68 #if defined(SK_TEST_QCMS) | 68 #if defined(SK_TEST_QCMS) |
69 void ColorCodecBench::decodeAndXformQCMS() { | 69 void ColorCodecBench::decodeAndXformQCMS() { |
70 SkAutoTDelete<SkCodec> codec(SkCodec::NewFromData(fEncoded.get())); | 70 SkAutoTDelete<SkCodec> codec(SkCodec::NewFromData(fEncoded.get())); |
71 #ifdef SK_DEBUG | 71 #ifdef SK_DEBUG |
72 const SkCodec::Result result = | 72 const SkCodec::Result result = |
73 #endif | 73 #endif |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 if (!srcSpace) { | 108 if (!srcSpace) { |
109 srcSpace = SkColorSpace::NewNamed(SkColorSpace::kSRGB_Named); | 109 srcSpace = SkColorSpace::NewNamed(SkColorSpace::kSRGB_Named); |
110 } | 110 } |
111 std::unique_ptr<SkColorSpaceXform> xform = SkColorSpaceXform::New(srcSpace,
fDstSpace); | 111 std::unique_ptr<SkColorSpaceXform> xform = SkColorSpaceXform::New(srcSpace,
fDstSpace); |
112 SkASSERT(xform); | 112 SkASSERT(xform); |
113 | 113 |
114 void* dst = fDst.get(); | 114 void* dst = fDst.get(); |
115 void* src = fSrc.get(); | 115 void* src = fSrc.get(); |
116 for (int y = 0; y < fInfo.height(); y++) { | 116 for (int y = 0; y < fInfo.height(); y++) { |
117 // Transform in place | 117 // Transform in place |
118 xform->xform_RGBA_8888((uint32_t*) dst, (uint32_t*) src, fInfo.width()); | 118 xform->xform_RGB1_8888((uint32_t*) dst, (uint32_t*) src, fInfo.width()); |
119 dst = SkTAddOffset<void>(dst, fInfo.minRowBytes()); | 119 dst = SkTAddOffset<void>(dst, fInfo.minRowBytes()); |
120 src = SkTAddOffset<void>(src, fInfo.minRowBytes()); | 120 src = SkTAddOffset<void>(src, fInfo.minRowBytes()); |
121 } | 121 } |
122 } | 122 } |
123 | 123 |
124 #if defined(SK_TEST_QCMS) | 124 #if defined(SK_TEST_QCMS) |
125 void ColorCodecBench::xformOnlyQCMS() { | 125 void ColorCodecBench::xformOnlyQCMS() { |
126 SkAutoTCallVProc<qcms_profile, qcms_profile_release> | 126 SkAutoTCallVProc<qcms_profile, qcms_profile_release> |
127 srcSpace(qcms_profile_from_memory(fSrcData->data(), fSrcData->size()
)); | 127 srcSpace(qcms_profile_from_memory(fSrcData->data(), fSrcData->size()
)); |
128 SkASSERT(srcSpace); | 128 SkASSERT(srcSpace); |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
197 #endif | 197 #endif |
198 { | 198 { |
199 if (FLAGS_xform_only) { | 199 if (FLAGS_xform_only) { |
200 this->xformOnly(); | 200 this->xformOnly(); |
201 } else { | 201 } else { |
202 this->decodeAndXform(); | 202 this->decodeAndXform(); |
203 } | 203 } |
204 } | 204 } |
205 } | 205 } |
206 } | 206 } |
OLD | NEW |