diff options
author | Mike Reed <reed@google.com> | 2017-05-23 11:22:56 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-05-23 15:44:46 +0000 |
commit | 435071e8ab865e395bec34ef128a412ceb50f063 (patch) | |
tree | 8dd4a21eb23161fc6ceb694151b77aa21c81c45e /bench/PatchBench.cpp | |
parent | 557fbbe05ba48bcc20be684d11fe0edfc24c87ba (diff) |
color-correct patch
Key work is to correctly convert SkColor corners into linear floats,
then interpolate, then (correctly) convert back to SkColors.
Bug: skia:6659
Change-Id: Iaf0ab842d7a4f8f3481e609903cec83814e5a749
Reviewed-on: https://skia-review.googlesource.com/17533
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Diffstat (limited to 'bench/PatchBench.cpp')
-rw-r--r-- | bench/PatchBench.cpp | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/bench/PatchBench.cpp b/bench/PatchBench.cpp index 4ca4bc8f5e..d88dd14a2b 100644 --- a/bench/PatchBench.cpp +++ b/bench/PatchBench.cpp @@ -327,16 +327,20 @@ DEF_BENCH( return new LoopPatchBench(SkVector::Make(3.0f, 3.0f), #include "SkPatchUtils.h" class PatchUtilsBench : public Benchmark { + SkString fName; + const bool fLinearInterp; public: - const char* onGetName() override { - return "patchutils"; + PatchUtilsBench(bool linearInterp) : fLinearInterp(linearInterp) { + fName.printf("patchutils_%s", linearInterp ? "linear" : "legacy"); } + const char* onGetName() override { return fName.c_str(); } + bool isSuitableFor(Backend backend) override { return backend == kNonRendering_Backend; } - void onDraw(int, SkCanvas*) override { + void onDraw(int loops, SkCanvas*) override { const SkColor colors[] = { 0xFF000000, 0xFF00FF00, 0xFF0000FF, 0xFFFF0000 }; const SkPoint pts[] = { { 0, 0 }, { 10, 0 }, { 20, 0 }, { 30, 0 }, @@ -347,9 +351,10 @@ public: { 0, 0 }, { 10, 0 }, { 10, 10 }, { 0, 10 }, }; - for (int i = 0; i < 100; ++i) { - SkPatchUtils::MakeVertices(pts, colors, tex, 20, 20); + for (int i = 0; i < 100*loops; ++i) { + SkPatchUtils::MakeVertices(pts, colors, tex, 20, 20, fLinearInterp); } } }; -DEF_BENCH( return new PatchUtilsBench; ) +DEF_BENCH( return new PatchUtilsBench(false); ) +DEF_BENCH( return new PatchUtilsBench(true); ) |