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

Side by Side Diff: bench/SwizzleBench.cpp

Issue 1626463002: Refactor swizzle names and types. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 11 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 | src/codec/SkSwizzler.cpp » ('j') | src/opts/SkSwizzler_opts.h » ('J')
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 "SkOpts.h" 9 #include "SkOpts.h"
10 10
11 class SwizzleBench : public Benchmark { 11 class SwizzleBench : public Benchmark {
12 public: 12 public:
13 SwizzleBench(const char* name, SkOpts::Swizzle_8888_8888 fn) : fName(name), fFn(fn) {} 13 SwizzleBench(const char* name, SkOpts::Swizzle_8888 fn) : fName(name), fFn(f n) {}
14 14
15 bool isSuitableFor(Backend backend) override { return backend == kNonRenderi ng_Backend; } 15 bool isSuitableFor(Backend backend) override { return backend == kNonRenderi ng_Backend; }
16 const char* onGetName() override { return fName; } 16 const char* onGetName() override { return fName; }
17 void onDraw(int loops, SkCanvas*) override { 17 void onDraw(int loops, SkCanvas*) override {
18 static const int K = 1023; // Arbitrary, but nice to be a non-power-of-t wo to trip up SIMD. 18 static const int K = 1023; // Arbitrary, but nice to be a non-power-of-t wo to trip up SIMD.
19 uint32_t dst[K], src[K]; 19 uint32_t dst[K], src[K];
20 while (loops --> 0) { 20 while (loops --> 0) {
21 fFn(dst, src, K); 21 fFn(dst, src, K);
22 } 22 }
23 } 23 }
24 private: 24 private:
25 const char* fName; 25 const char* fName;
26 SkOpts::Swizzle_8888_8888 fFn; 26 SkOpts::Swizzle_8888 fFn;
27 }; 27 };
28 28
29 29
30 DEF_BENCH(return new SwizzleBench("SkOpts::premul_xxxa", SkOpts::premul_xxxa)); 30 DEF_BENCH(return new SwizzleBench("SkOpts::RGBA_to_rgbA", SkOpts::RGBA_to_rgbA)) ;
31 DEF_BENCH(return new SwizzleBench("SkOpts::swaprb_xxxa", SkOpts::swaprb_xxxa)); 31 DEF_BENCH(return new SwizzleBench("SkOpts::RGBA_to_bgrA", SkOpts::RGBA_to_bgrA)) ;
32 DEF_BENCH(return new SwizzleBench("SkOpts::premul_swaprb_xxxa", SkOpts::premul_s waprb_xxxa)); 32 DEF_BENCH(return new SwizzleBench("SkOpts::RGBA_to_BGRA", SkOpts::RGBA_to_BGRA)) ;
OLDNEW
« no previous file with comments | « no previous file | src/codec/SkSwizzler.cpp » ('j') | src/opts/SkSwizzler_opts.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698