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

Unified Diff: bench/PMFloatBench.cpp

Issue 1035583002: Update 4-at-a-time APIs. (Closed) Base URL: https://skia.googlesource.com/skia@master
Patch Set: (C) Created 5 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/core/SkPMFloat.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: bench/PMFloatBench.cpp
diff --git a/bench/PMFloatBench.cpp b/bench/PMFloatBench.cpp
index 1da667f4430ff317ef4e261167def3e1db1570ce..f3caea5673840aca6d57ab8410e3d95d2f2fb0cf 100644
--- a/bench/PMFloatBench.cpp
+++ b/bench/PMFloatBench.cpp
@@ -1,3 +1,10 @@
+/*
+ * Copyright 2015 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
#include "Benchmark.h"
#include "SkPMFloat.h"
@@ -49,21 +56,32 @@ struct PMFloatBench : public Benchmark {
colors[3] = seed + 3;
#endif
- SkPMFloat floats[4];
+ SkPMFloat fa,fb,fc,fd;
if (kWide) {
- SkPMFloat::From4PMColors(floats, colors);
+ SkPMFloat::From4PMColors(colors, &fa, &fb, &fc, &fd);
} else {
- for (int i = 0; i < 4; i++) {
- floats[i] = SkPMFloat::FromPMColor(colors[i]);
- }
+ fa = SkPMFloat::FromPMColor(colors[0]);
+ fb = SkPMFloat::FromPMColor(colors[1]);
+ fc = SkPMFloat::FromPMColor(colors[2]);
+ fd = SkPMFloat::FromPMColor(colors[3]);
}
SkPMColor back[4];
switch (kClamp << 1 | kWide) {
- case 0: for (int i = 0; i < 4; i++) { back[i] = floats[i].get(); } break;
- case 1: SkPMFloat::To4PMColors(back, floats); break;
- case 2: for (int i = 0; i < 4; i++) { back[i] = floats[i].clamped(); } break;
- case 3: SkPMFloat::ClampTo4PMColors(back, floats); break;
+ case 0: {
+ back[0] = fa.get();
+ back[1] = fb.get();
+ back[2] = fc.get();
+ back[3] = fd.get();
+ } break;
+ case 1: SkPMFloat::To4PMColors(fa, fb, fc, fd, back); break;
+ case 2: {
+ back[0] = fa.clamped();
+ back[1] = fb.clamped();
+ back[2] = fc.clamped();
+ back[3] = fd.clamped();
+ } break;
+ case 3: SkPMFloat::ClampTo4PMColors(fa, fb, fc, fd, back); break;
}
for (int i = 0; i < 4; i++) {
junk ^= back[i];
« no previous file with comments | « no previous file | src/core/SkPMFloat.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698