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

Side by Side Diff: bench/Xfer4fBench.cpp

Issue 1842753002: Style bikeshed - remove extraneous whitespace (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 8 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 | « bench/WriterBench.cpp ('k') | bench/XferU64Bench.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 "Benchmark.h" 8 #include "Benchmark.h"
9 #include "SkPM4f.h" 9 #include "SkPM4f.h"
10 #include "SkString.h" 10 #include "SkString.h"
11 #include "SkXfermode.h" 11 #include "SkXfermode.h"
12 12
13 #define USE_AA (1 << 31) // merge with Xfermode::PMFlags w/o conflict 13 #define USE_AA (1 << 31) // merge with Xfermode::PMFlags w/o conflict
14 14
15 #define INNER_LOOPS 1000 15 #define INNER_LOOPS 1000
16 16
17 // Benchmark that draws non-AA rects or AA text with an SkXfermode::Mode. 17 // Benchmark that draws non-AA rects or AA text with an SkXfermode::Mode.
18 class XferD32Bench : public Benchmark { 18 class XferD32Bench : public Benchmark {
19 public: 19 public:
20 XferD32Bench(SkXfermode::Mode mode, const char name[], bool doN, uint32_t fl ags) 20 XferD32Bench(SkXfermode::Mode mode, const char name[], bool doN, uint32_t fl ags)
21 : fDoN(doN) 21 : fDoN(doN)
22 , fFlags(flags & ~USE_AA) 22 , fFlags(flags & ~USE_AA)
23 { 23 {
24 fXfer.reset(SkXfermode::Create(mode)); 24 fXfer.reset(SkXfermode::Create(mode));
25 25
26 fProc1 = SkXfermode::GetD32Proc(fXfer, fFlags | SkXfermode::kSrcIsSingle _D32Flag); 26 fProc1 = SkXfermode::GetD32Proc(fXfer, fFlags | SkXfermode::kSrcIsSingle _D32Flag);
27 fProcN = SkXfermode::GetD32Proc(fXfer, fFlags); 27 fProcN = SkXfermode::GetD32Proc(fXfer, fFlags);
28 fName.printf("xfer4f_%s_%s_%c_%s_%s", 28 fName.printf("xfer4f_%s_%s_%c_%s_%s",
29 name, 29 name,
30 (flags & USE_AA) ? "aa" : "bw", 30 (flags & USE_AA) ? "aa" : "bw",
31 fDoN ? 'N' : '1', 31 fDoN ? 'N' : '1',
32 (flags & SkXfermode::kSrcIsOpaque_D32Flag) ? "opaque" : "al pha", 32 (flags & SkXfermode::kSrcIsOpaque_D32Flag) ? "opaque" : "al pha",
33 (flags & SkXfermode::kDstIsSRGB_D32Flag) ? "srgb" : "linear "); 33 (flags & SkXfermode::kDstIsSRGB_D32Flag) ? "srgb" : "linear ");
34 34
35 for (int i = 0; i < N; ++i) { 35 for (int i = 0; i < N; ++i) {
36 fSrc[i] = {{ 1, 1, 1, 1 }}; 36 fSrc[i] = {{ 1, 1, 1, 1 }};
37 fDst[i] = 0; 37 fDst[i] = 0;
38 fAAStorage[i] = i * 255 / (N - 1); 38 fAAStorage[i] = i * 255 / (N - 1);
39 } 39 }
40 40
41 if (flags & USE_AA) { 41 if (flags & USE_AA) {
42 fAA = fAAStorage; 42 fAA = fAAStorage;
43 } else { 43 } else {
44 fAA = nullptr; 44 fAA = nullptr;
45 } 45 }
46 } 46 }
47 47
48 protected: 48 protected:
49 bool isSuitableFor(Backend backend) override { return backend == kNonRenderi ng_Backend; } 49 bool isSuitableFor(Backend backend) override { return backend == kNonRenderi ng_Backend; }
50 50
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 96
97 DEF_BENCH( return new XferD32Bench(SkXfermode::kSrcOver_Mode, "srcover", false, F10 | USE_AA); ) 97 DEF_BENCH( return new XferD32Bench(SkXfermode::kSrcOver_Mode, "srcover", false, F10 | USE_AA); )
98 DEF_BENCH( return new XferD32Bench(SkXfermode::kSrcOver_Mode, "srcover", false, F00 | USE_AA); ) 98 DEF_BENCH( return new XferD32Bench(SkXfermode::kSrcOver_Mode, "srcover", false, F00 | USE_AA); )
99 DEF_BENCH( return new XferD32Bench(SkXfermode::kSrcOver_Mode, "srcover", false, F11 | USE_AA); ) 99 DEF_BENCH( return new XferD32Bench(SkXfermode::kSrcOver_Mode, "srcover", false, F11 | USE_AA); )
100 DEF_BENCH( return new XferD32Bench(SkXfermode::kSrcOver_Mode, "srcover", false, F01 | USE_AA); ) 100 DEF_BENCH( return new XferD32Bench(SkXfermode::kSrcOver_Mode, "srcover", false, F01 | USE_AA); )
101 101
102 DEF_BENCH( return new XferD32Bench(SkXfermode::kSrcOver_Mode, "srcover", true, F10 | USE_AA); ) 102 DEF_BENCH( return new XferD32Bench(SkXfermode::kSrcOver_Mode, "srcover", true, F10 | USE_AA); )
103 DEF_BENCH( return new XferD32Bench(SkXfermode::kSrcOver_Mode, "srcover", true, F00 | USE_AA); ) 103 DEF_BENCH( return new XferD32Bench(SkXfermode::kSrcOver_Mode, "srcover", true, F00 | USE_AA); )
104 DEF_BENCH( return new XferD32Bench(SkXfermode::kSrcOver_Mode, "srcover", true, F11 | USE_AA); ) 104 DEF_BENCH( return new XferD32Bench(SkXfermode::kSrcOver_Mode, "srcover", true, F11 | USE_AA); )
105 DEF_BENCH( return new XferD32Bench(SkXfermode::kSrcOver_Mode, "srcover", true, F01 | USE_AA); ) 105 DEF_BENCH( return new XferD32Bench(SkXfermode::kSrcOver_Mode, "srcover", true, F01 | USE_AA); )
OLDNEW
« no previous file with comments | « bench/WriterBench.cpp ('k') | bench/XferU64Bench.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698