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

Unified Diff: bench/XferU64Bench.cpp

Issue 1685203002: lots of sRGB and F16 blits (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: use SkAutoTMalloc Created 4 years, 10 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 | gm/xfermodes.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: bench/XferU64Bench.cpp
diff --git a/bench/XferU64Bench.cpp b/bench/XferU64Bench.cpp
index 75aada60d7aed86480c2a7bb525945e5238d3307..b81bc1e3541489e37664b91400d4584b1d32e3d0 100644
--- a/bench/XferU64Bench.cpp
+++ b/bench/XferU64Bench.cpp
@@ -17,15 +17,16 @@
// Benchmark that draws non-AA rects or AA text with an SkXfermode::Mode.
class XferU64Bench : public Benchmark {
public:
- XferU64Bench(bool doN, uint32_t flags)
+ XferU64Bench(SkXfermode::Mode mode, const char name[], bool doN, uint32_t flags)
: fDoN(doN)
, fFlags(flags & ~USE_AA)
{
- SkXfermode::Mode mode = SkXfermode::kSrcOver_Mode;
+ fXfer.reset(SkXfermode::Create(mode));
fProc1 = SkXfermode::GetU64Proc1(mode, fFlags);
fProcN = SkXfermode::GetU64ProcN(mode, fFlags);
- fName.printf("xferu64_%s_%c_%s_%s",
+ fName.printf("xferu64_%s_%s_%c_%s_%s",
+ name,
(flags & USE_AA) ? "aa" : "bw",
fDoN ? 'N' : '1',
(flags & SkXfermode::kSrcIsOpaque_U64Flag) ? "opaque" : "alpha",
@@ -50,7 +51,7 @@ protected:
const char* onGetName() override { return fName.c_str(); }
void onDraw(int loops, SkCanvas*) override {
- const SkXfermode::U64State state{ nullptr, fFlags };
+ const SkXfermode::U64State state{ fXfer, fFlags };
for (int i = 0; i < loops * INNER_LOOPS; ++i) {
if (fDoN) {
@@ -62,6 +63,7 @@ protected:
}
private:
+ SkAutoTUnref<SkXfermode> fXfer;
SkString fName;
SkXfermode::U64Proc1 fProc1;
SkXfermode::U64ProcN fProcN;
@@ -84,24 +86,25 @@ private:
#define F10 (SkXfermode::kDstIsFloat16_U64Flag)
#define F11 (SkXfermode::kDstIsFloat16_U64Flag | SkXfermode::kSrcIsOpaque_U64Flag)
-#if 0
-DEF_BENCH( return new XferU64Bench(true, F10 | USE_AA); )
-DEF_BENCH( return new XferU64Bench(true, F11 | USE_AA); )
-DEF_BENCH( return new XferU64Bench(true, F10); )
-DEF_BENCH( return new XferU64Bench(true, F11); )
-
-DEF_BENCH( return new XferU64Bench(true, F00 | USE_AA); )
-DEF_BENCH( return new XferU64Bench(true, F01 | USE_AA); )
-DEF_BENCH( return new XferU64Bench(true, F00); )
-DEF_BENCH( return new XferU64Bench(true, F01); )
-#endif
-
-DEF_BENCH( return new XferU64Bench(false, F10 | USE_AA); )
-DEF_BENCH( return new XferU64Bench(false, F11 | USE_AA); )
-DEF_BENCH( return new XferU64Bench(false, F10); )
-DEF_BENCH( return new XferU64Bench(false, F11); )
-
-DEF_BENCH( return new XferU64Bench(false, F00 | USE_AA); )
-DEF_BENCH( return new XferU64Bench(false, F01 | USE_AA); )
-DEF_BENCH( return new XferU64Bench(false, F00); )
-DEF_BENCH( return new XferU64Bench(false, F01); )
+#define MODE SkXfermode::kSrcOver_Mode
+#define NAME "srcover"
+
+DEF_BENCH( return new XferU64Bench(MODE, NAME, true, F10 | USE_AA); )
+DEF_BENCH( return new XferU64Bench(MODE, NAME, true, F11 | USE_AA); )
+DEF_BENCH( return new XferU64Bench(MODE, NAME, true, F10); )
+DEF_BENCH( return new XferU64Bench(MODE, NAME, true, F11); )
+
+DEF_BENCH( return new XferU64Bench(MODE, NAME, true, F00 | USE_AA); )
+DEF_BENCH( return new XferU64Bench(MODE, NAME, true, F01 | USE_AA); )
+DEF_BENCH( return new XferU64Bench(MODE, NAME, true, F00); )
+DEF_BENCH( return new XferU64Bench(MODE, NAME, true, F01); )
+
+DEF_BENCH( return new XferU64Bench(MODE, NAME, false, F10 | USE_AA); )
+DEF_BENCH( return new XferU64Bench(MODE, NAME, false, F11 | USE_AA); )
+DEF_BENCH( return new XferU64Bench(MODE, NAME, false, F10); )
+DEF_BENCH( return new XferU64Bench(MODE, NAME, false, F11); )
+
+DEF_BENCH( return new XferU64Bench(MODE, NAME, false, F00 | USE_AA); )
+DEF_BENCH( return new XferU64Bench(MODE, NAME, false, F01 | USE_AA); )
+DEF_BENCH( return new XferU64Bench(MODE, NAME, false, F00); )
+DEF_BENCH( return new XferU64Bench(MODE, NAME, false, F01); )
« no previous file with comments | « no previous file | gm/xfermodes.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698