add bench for patchutils

Bug: skia:
Change-Id: Iba36eb5a7d09f92b7828f2ec209cbfeb8d0eb8ed
Reviewed-on: https://skia-review.googlesource.com/17601
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
This commit is contained in:
Mike Reed 2017-05-22 22:45:05 -04:00 committed by Skia Commit-Bot
parent 79a1a97db7
commit eee762104c

View File

@ -322,3 +322,34 @@ DEF_BENCH( return new LoopPatchBench(SkVector::Make(3.0f, 3.0f),
PatchBench::kTexCoords_VertexMode); )
DEF_BENCH( return new LoopPatchBench(SkVector::Make(3.0f, 3.0f),
PatchBench::kBoth_VertexMode); )
//////////////////////////////////////////////
#include "SkPatchUtils.h"
class PatchUtilsBench : public Benchmark {
public:
const char* onGetName() override {
return "patchutils";
}
bool isSuitableFor(Backend backend) override {
return backend == kNonRendering_Backend;
}
void onDraw(int, SkCanvas*) override {
const SkColor colors[] = { 0xFF000000, 0xFF00FF00, 0xFF0000FF, 0xFFFF0000 };
const SkPoint pts[] = {
{ 0, 0 }, { 10, 0 }, { 20, 0 }, { 30, 0 },
{ 30,10}, { 30,20 }, { 30,30 }, { 20,30 },
{ 10,30}, { 0, 30 }, { 0, 20 }, { 0, 10 },
};
const SkPoint tex[] = {
{ 0, 0 }, { 10, 0 }, { 10, 10 }, { 0, 10 },
};
for (int i = 0; i < 100; ++i) {
SkPatchUtils::MakeVertices(pts, colors, tex, 20, 20);
}
}
};
DEF_BENCH( return new PatchUtilsBench; )