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

Unified Diff: bench/StrokeBench.cpp

Issue 1158183003: add res to stroke bench (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: toy font test Created 5 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | resources/fonts/FreeSans.ttf » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: bench/StrokeBench.cpp
diff --git a/bench/StrokeBench.cpp b/bench/StrokeBench.cpp
index 7844035bccad211caacb29e20efe25ed510c9671..8417bbf186ed20714dc6a5565e191d1f6052fe05 100644
--- a/bench/StrokeBench.cpp
+++ b/bench/StrokeBench.cpp
@@ -13,14 +13,18 @@
class StrokeBench : public Benchmark {
public:
- StrokeBench(const SkPath& path, const SkPaint& paint, const char pathType[])
- : fPath(path), fPaint(paint)
+ StrokeBench(const SkPath& path, const SkPaint& paint, const char pathType[], SkScalar res)
+ : fPath(path), fPaint(paint), fRes(res)
{
fName.printf("build_stroke_%s_%g_%d_%d",
pathType, paint.getStrokeWidth(), paint.getStrokeJoin(), paint.getStrokeCap());
}
protected:
+ virtual bool isSuitableFor(Backend backend) {
+ return backend == kNonRendering_Backend;
+ }
+
const char* onGetName() override { return fName.c_str(); }
void onDraw(const int loops, SkCanvas* canvas) override {
@@ -30,7 +34,7 @@ protected:
for (int outer = 0; outer < 10; ++outer) {
for (int i = 0; i < loops; ++i) {
SkPath result;
- paint.getFillPath(fPath, &result);
+ paint.getFillPath(fPath, &result, NULL, fRes);
}
}
}
@@ -39,7 +43,7 @@ private:
SkPath fPath;
SkPaint fPaint;
SkString fName;
-
+ SkScalar fRes;
typedef Benchmark INHERITED;
};
@@ -99,7 +103,17 @@ static SkPaint paint_maker() {
return paint;
}
-DEF_BENCH( return SkNEW_ARGS(StrokeBench, (line_path_maker(), paint_maker(), "line")); )
-DEF_BENCH( return SkNEW_ARGS(StrokeBench, (quad_path_maker(), paint_maker(), "quad")); )
-DEF_BENCH( return SkNEW_ARGS(StrokeBench, (conic_path_maker(), paint_maker(), "conic")); )
-DEF_BENCH( return SkNEW_ARGS(StrokeBench, (cubic_path_maker(), paint_maker(), "cubic")); )
+DEF_BENCH( return SkNEW_ARGS(StrokeBench, (line_path_maker(), paint_maker(), "line_1", 1)); )
+DEF_BENCH( return SkNEW_ARGS(StrokeBench, (quad_path_maker(), paint_maker(), "quad_1", 1)); )
+DEF_BENCH( return SkNEW_ARGS(StrokeBench, (conic_path_maker(), paint_maker(), "conic_1", 1)); )
+DEF_BENCH( return SkNEW_ARGS(StrokeBench, (cubic_path_maker(), paint_maker(), "cubic_1", 1)); )
+
+DEF_BENCH( return SkNEW_ARGS(StrokeBench, (line_path_maker(), paint_maker(), "line_4", 4)); )
+DEF_BENCH( return SkNEW_ARGS(StrokeBench, (quad_path_maker(), paint_maker(), "quad_4", 4)); )
+DEF_BENCH( return SkNEW_ARGS(StrokeBench, (conic_path_maker(), paint_maker(), "conic_4", 4)); )
+DEF_BENCH( return SkNEW_ARGS(StrokeBench, (cubic_path_maker(), paint_maker(), "cubic_4", 4)); )
+
+DEF_BENCH( return SkNEW_ARGS(StrokeBench, (line_path_maker(), paint_maker(), "line_.25", .25f)); )
+DEF_BENCH( return SkNEW_ARGS(StrokeBench, (quad_path_maker(), paint_maker(), "quad_.25", .25f)); )
+DEF_BENCH( return SkNEW_ARGS(StrokeBench, (conic_path_maker(), paint_maker(), "conic_.25", .25f)); )
+DEF_BENCH( return SkNEW_ARGS(StrokeBench, (cubic_path_maker(), paint_maker(), "cubic_.25", .25f)); )
« no previous file with comments | « no previous file | resources/fonts/FreeSans.ttf » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698