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

Side by Side Diff: tests/SkNxTest.cpp

Issue 1230663005: 3-15% speedup to HardLight / Overlay xfermodes. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Add a test that widenLo() | widenHi() == widenLoHi() Created 5 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 | « src/opts/SkNx_sse.h ('k') | no next file » | 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 2015 Google Inc. 2 * Copyright 2015 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 "Sk4px.h" 8 #include "Sk4px.h"
9 #include "SkNx.h" 9 #include "SkNx.h"
10 #include "SkRandom.h" 10 #include "SkRandom.h"
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 185
186 // We're a bit more flexible on this method: correct for 0 or 255, other wise off by <=1. 186 // We're a bit more flexible on this method: correct for 0 or 255, other wise off by <=1.
187 int fast = av.approxMulDiv255(bv).kth<0>(); 187 int fast = av.approxMulDiv255(bv).kth<0>();
188 REPORTER_ASSERT(r, fast-exact >= -1 && fast-exact <= 1); 188 REPORTER_ASSERT(r, fast-exact >= -1 && fast-exact <= 1);
189 if (a == 0 || a == 255 || b == 0 || b == 255) { 189 if (a == 0 || a == 255 || b == 0 || b == 255) {
190 REPORTER_ASSERT(r, fast == exact); 190 REPORTER_ASSERT(r, fast == exact);
191 } 191 }
192 } 192 }
193 } 193 }
194 } 194 }
195
196 DEF_TEST(Sk4px_widening, r) {
197 SkPMColor colors[] = {
198 SkPreMultiplyColor(0xff00ff00),
199 SkPreMultiplyColor(0x40008000),
200 SkPreMultiplyColor(0x7f020406),
201 SkPreMultiplyColor(0x00000000),
202 };
203 auto packed = Sk4px::Load4(colors);
204
205 auto wideLo = packed.widenLo(),
206 wideHi = packed.widenHi(),
207 wideLoHi = packed.widenLoHi(),
208 wideLoHiAlt = wideLo + wideHi;
209 REPORTER_ASSERT(r, 0 == memcmp(&wideLoHi, &wideLoHiAlt, sizeof(wideLoHi)));
210 }
OLDNEW
« no previous file with comments | « src/opts/SkNx_sse.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698