| Index: bench/MathBench.cpp
|
| diff --git a/bench/MathBench.cpp b/bench/MathBench.cpp
|
| index 16a6a5a47f418bd1ab2235611ba258cdab8d55c5..e05bd5fada5c660027a4068ae3308cc7849fd6ac 100644
|
| --- a/bench/MathBench.cpp
|
| +++ b/bench/MathBench.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 "SkColorPriv.h"
|
| #include "SkMatrix.h"
|
| @@ -42,11 +49,11 @@ public:
|
| protected:
|
| virtual int mulLoopCount() const { return 1; }
|
|
|
| - virtual const char* onGetName() {
|
| + const char* onGetName() override {
|
| return fName.c_str();
|
| }
|
|
|
| - virtual void onDraw(const int loops, SkCanvas*) {
|
| + void onDraw(const int loops, SkCanvas*) override {
|
| int n = loops * this->mulLoopCount();
|
| for (int i = 0; i < n; i++) {
|
| this->performTest(fDst, fSrc, kBuffer);
|
| @@ -66,9 +73,7 @@ protected:
|
| const uint32_t* SK_RESTRICT src,
|
| int count) = 0;
|
|
|
| - virtual void performTest(float* SK_RESTRICT dst,
|
| - const float* SK_RESTRICT src,
|
| - int count) override {
|
| + void performTest(float* SK_RESTRICT dst, const float* SK_RESTRICT src, int count) override {
|
| uint32_t* d = SkTCast<uint32_t*>(dst);
|
| const uint32_t* s = SkTCast<const uint32_t*>(src);
|
| this->performITest(d, s, count);
|
| @@ -83,9 +88,7 @@ class NoOpMathBench : public MathBench {
|
| public:
|
| NoOpMathBench() : INHERITED("noOp") {}
|
| protected:
|
| - virtual void performTest(float* SK_RESTRICT dst,
|
| - const float* SK_RESTRICT src,
|
| - int count) {
|
| + void performTest(float* SK_RESTRICT dst, const float* SK_RESTRICT src, int count) override {
|
| for (int i = 0; i < count; ++i) {
|
| dst[i] = src[i] + 1;
|
| }
|
| @@ -98,9 +101,7 @@ class SkRSqrtMathBench : public MathBench {
|
| public:
|
| SkRSqrtMathBench() : INHERITED("sk_float_rsqrt") {}
|
| protected:
|
| - virtual void performTest(float* SK_RESTRICT dst,
|
| - const float* SK_RESTRICT src,
|
| - int count) {
|
| + void performTest(float* SK_RESTRICT dst, const float* SK_RESTRICT src, int count) override {
|
| for (int i = 0; i < count; ++i) {
|
| dst[i] = sk_float_rsqrt(src[i]);
|
| }
|
| @@ -114,9 +115,7 @@ class SlowISqrtMathBench : public MathBench {
|
| public:
|
| SlowISqrtMathBench() : INHERITED("slowIsqrt") {}
|
| protected:
|
| - virtual void performTest(float* SK_RESTRICT dst,
|
| - const float* SK_RESTRICT src,
|
| - int count) {
|
| + void performTest(float* SK_RESTRICT dst, const float* SK_RESTRICT src, int count) override {
|
| for (int i = 0; i < count; ++i) {
|
| dst[i] = 1.0f / sk_float_sqrt(src[i]);
|
| }
|
| @@ -139,9 +138,7 @@ class FastISqrtMathBench : public MathBench {
|
| public:
|
| FastISqrtMathBench() : INHERITED("fastIsqrt") {}
|
| protected:
|
| - virtual void performTest(float* SK_RESTRICT dst,
|
| - const float* SK_RESTRICT src,
|
| - int count) {
|
| + void performTest(float* SK_RESTRICT dst, const float* SK_RESTRICT src, int count) override {
|
| for (int i = 0; i < count; ++i) {
|
| dst[i] = SkFastInvSqrt(src[i]);
|
| }
|
| @@ -164,9 +161,9 @@ class QMul64Bench : public MathBenchU32 {
|
| public:
|
| QMul64Bench() : INHERITED("qmul64") {}
|
| protected:
|
| - virtual void performITest(uint32_t* SK_RESTRICT dst,
|
| - const uint32_t* SK_RESTRICT src,
|
| - int count) override {
|
| + void performITest(uint32_t* SK_RESTRICT dst,
|
| + const uint32_t* SK_RESTRICT src,
|
| + int count) override {
|
| for (int i = 0; i < count; ++i) {
|
| dst[i] = QMul64(src[i], (uint8_t)i);
|
| }
|
| @@ -179,9 +176,9 @@ class QMul32Bench : public MathBenchU32 {
|
| public:
|
| QMul32Bench() : INHERITED("qmul32") {}
|
| protected:
|
| - virtual void performITest(uint32_t* SK_RESTRICT dst,
|
| - const uint32_t* SK_RESTRICT src,
|
| - int count) override {
|
| + void performITest(uint32_t* SK_RESTRICT dst,
|
| + const uint32_t* SK_RESTRICT src,
|
| + int count) override {
|
| for (int i = 0; i < count; ++i) {
|
| dst[i] = SkAlphaMulQ(src[i], (uint8_t)i);
|
| }
|
| @@ -290,7 +287,7 @@ public:
|
| }
|
|
|
| protected:
|
| - virtual void onDraw(const int loops, SkCanvas*) {
|
| + void onDraw(const int loops, SkCanvas*) override {
|
| IsFiniteProc proc = fProc;
|
| const float* data = fData;
|
| // do this so the compiler won't throw away the function call
|
| @@ -320,7 +317,7 @@ protected:
|
| }
|
| }
|
|
|
| - virtual const char* onGetName() {
|
| + const char* onGetName() override {
|
| return fName;
|
| }
|
|
|
| @@ -360,7 +357,7 @@ public:
|
| virtual void process(float) {}
|
|
|
| protected:
|
| - virtual void onDraw(const int loops, SkCanvas*) {
|
| + void onDraw(const int loops, SkCanvas*) override {
|
| SkRandom rand;
|
| float accum = 0;
|
| const float* data = fData;
|
| @@ -382,7 +379,7 @@ protected:
|
| }
|
| }
|
|
|
| - virtual const char* onGetName() {
|
| + const char* onGetName() override {
|
| return fName;
|
| }
|
|
|
| @@ -422,7 +419,7 @@ public:
|
| virtual void process(int) {}
|
|
|
| protected:
|
| - virtual void onDraw(const int loops, SkCanvas*) {
|
| + void onDraw(const int loops, SkCanvas*) override {
|
| int accum = 0;
|
|
|
| if (fUsePortable) {
|
| @@ -442,7 +439,7 @@ protected:
|
| }
|
| }
|
|
|
| - virtual const char* onGetName() {
|
| + const char* onGetName() override {
|
| return fName;
|
| }
|
|
|
| @@ -478,7 +475,7 @@ public:
|
| virtual void process(int) {}
|
|
|
| protected:
|
| - virtual void onDraw(const int loops, SkCanvas*) {
|
| + void onDraw(const int loops, SkCanvas*) override {
|
| int accum = 0;
|
|
|
| for (int j = 0; j < loops; ++j) {
|
| @@ -489,7 +486,7 @@ protected:
|
| }
|
| }
|
|
|
| - virtual const char* onGetName() {
|
| + const char* onGetName() override {
|
| return fName;
|
| }
|
|
|
| @@ -522,7 +519,7 @@ public:
|
| }
|
|
|
| protected:
|
| - virtual void onDraw(const int loops, SkCanvas*) {
|
| + void onDraw(const int loops, SkCanvas*) override {
|
| for (int j = 0; j < loops; ++j) {
|
| for (int i = 0; i < N - 4; ++i) {
|
| fResult[i] = SkFloatToFixed(fData[i]);
|
| @@ -535,7 +532,7 @@ protected:
|
| }
|
| }
|
|
|
| - virtual const char* onGetName() {
|
| + const char* onGetName() override {
|
| return "float_to_fixed";
|
| }
|
|
|
| @@ -558,11 +555,11 @@ public:
|
| }
|
|
|
| protected:
|
| - virtual const char* onGetName() {
|
| + const char* onGetName() override {
|
| return fName.c_str();
|
| }
|
|
|
| - virtual void onDraw(const int loops, SkCanvas*) {
|
| + void onDraw(const int loops, SkCanvas*) override {
|
| volatile T a = 0, b = 0;
|
| T div = 0, mod = 0;
|
| for (int i = 0; i < loops; i++) {
|
|
|