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

Side by Side Diff: bench/ColorCodecBench.cpp

Issue 2147763002: Add capability for SkColorXform to output half floats (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Call swizzle fn Created 4 years, 5 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/DM.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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 SkASSERT(xform); 54 SkASSERT(xform);
55 55
56 void* dst = fDst.get(); 56 void* dst = fDst.get();
57 for (int y = 0; y < fInfo.height(); y++) { 57 for (int y = 0; y < fInfo.height(); y++) {
58 #ifdef SK_DEBUG 58 #ifdef SK_DEBUG
59 const int rows = 59 const int rows =
60 #endif 60 #endif
61 codec->getScanlines(fSrc.get(), 1, 0); 61 codec->getScanlines(fSrc.get(), 1, 0);
62 SkASSERT(1 == rows); 62 SkASSERT(1 == rows);
63 63
64 xform->xform_RGB1_8888((uint32_t*) dst, (uint32_t*) fSrc.get(), fInfo.wi dth()); 64 xform->applyTo8888((SkPMColor*) dst, (uint32_t*) fSrc.get(), fInfo.width ());
65 dst = SkTAddOffset<void>(dst, fInfo.minRowBytes()); 65 dst = SkTAddOffset<void>(dst, fInfo.minRowBytes());
66 } 66 }
67 } 67 }
68 68
69 #if defined(SK_TEST_QCMS) 69 #if defined(SK_TEST_QCMS)
70 void ColorCodecBench::decodeAndXformQCMS() { 70 void ColorCodecBench::decodeAndXformQCMS() {
71 SkAutoTDelete<SkCodec> codec(SkCodec::NewFromData(fEncoded.get())); 71 SkAutoTDelete<SkCodec> codec(SkCodec::NewFromData(fEncoded.get()));
72 #ifdef SK_DEBUG 72 #ifdef SK_DEBUG
73 const SkCodec::Result result = 73 const SkCodec::Result result =
74 #endif 74 #endif
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 if (!srcSpace) { 109 if (!srcSpace) {
110 srcSpace = SkColorSpace::NewNamed(SkColorSpace::kSRGB_Named); 110 srcSpace = SkColorSpace::NewNamed(SkColorSpace::kSRGB_Named);
111 } 111 }
112 std::unique_ptr<SkColorSpaceXform> xform = SkColorSpaceXform::New(srcSpace, fDstSpace); 112 std::unique_ptr<SkColorSpaceXform> xform = SkColorSpaceXform::New(srcSpace, fDstSpace);
113 SkASSERT(xform); 113 SkASSERT(xform);
114 114
115 void* dst = fDst.get(); 115 void* dst = fDst.get();
116 void* src = fSrc.get(); 116 void* src = fSrc.get();
117 for (int y = 0; y < fInfo.height(); y++) { 117 for (int y = 0; y < fInfo.height(); y++) {
118 // Transform in place 118 // Transform in place
119 xform->xform_RGB1_8888((uint32_t*) dst, (uint32_t*) src, fInfo.width()); 119 xform->applyTo8888((SkPMColor*) dst, (uint32_t*) src, fInfo.width());
120 dst = SkTAddOffset<void>(dst, fInfo.minRowBytes()); 120 dst = SkTAddOffset<void>(dst, fInfo.minRowBytes());
121 src = SkTAddOffset<void>(src, fInfo.minRowBytes()); 121 src = SkTAddOffset<void>(src, fInfo.minRowBytes());
122 } 122 }
123 } 123 }
124 124
125 #if defined(SK_TEST_QCMS) 125 #if defined(SK_TEST_QCMS)
126 void ColorCodecBench::xformOnlyQCMS() { 126 void ColorCodecBench::xformOnlyQCMS() {
127 SkAutoTCallVProc<qcms_profile, qcms_profile_release> 127 SkAutoTCallVProc<qcms_profile, qcms_profile_release>
128 srcSpace(qcms_profile_from_memory(fSrcData->data(), fSrcData->size() )); 128 srcSpace(qcms_profile_from_memory(fSrcData->data(), fSrcData->size() ));
129 SkASSERT(srcSpace); 129 SkASSERT(srcSpace);
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 #endif 201 #endif
202 { 202 {
203 if (FLAGS_xform_only) { 203 if (FLAGS_xform_only) {
204 this->xformOnly(); 204 this->xformOnly();
205 } else { 205 } else {
206 this->decodeAndXform(); 206 this->decodeAndXform();
207 } 207 }
208 } 208 }
209 } 209 }
210 } 210 }
OLDNEW
« no previous file with comments | « no previous file | dm/DM.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698