Index: tools/VisualBench/VisualBenchmarkStream.cpp |
diff --git a/tools/VisualBench/VisualBenchmarkStream.cpp b/tools/VisualBench/VisualBenchmarkStream.cpp |
index cfeff751967e52835b604c8655cb16047a0cd610..7f072e8ecbe0845f2d287f2342dfcf36a22b6701 100644 |
--- a/tools/VisualBench/VisualBenchmarkStream.cpp |
+++ b/tools/VisualBench/VisualBenchmarkStream.cpp |
@@ -39,9 +39,15 @@ class WarmupBench : public Benchmark { |
public: |
WarmupBench() { |
sk_tool_utils::make_big_path(fPath); |
+ fPerlinRect = SkRect::MakeLTRB(0., 0., 400., 400.); |
} |
private: |
const char* onGetName() override { return "warmupbench"; } |
+ SkIPoint onGetSize() override { |
+ int w = SkScalarCeilToInt(SkTMax(fPath.getBounds().right(), fPerlinRect.right())); |
+ int h = SkScalarCeilToInt(SkTMax(fPath.getBounds().bottom(), fPerlinRect.bottom())); |
+ return SkIPoint::Make(w, h); |
+ } |
void onDraw(int loops, SkCanvas* canvas) override { |
// We draw a big path to warm up the cpu, and then use perlin noise shader to warm up the |
// gpu |
@@ -52,10 +58,9 @@ private: |
SkPaint perlinPaint; |
perlinPaint.setShader(SkPerlinNoiseShader::CreateTurbulence(0.1f, 0.1f, 1, 0, |
nullptr))->unref(); |
- SkRect rect = SkRect::MakeLTRB(0., 0., 400., 400.); |
for (int i = 0; i < loops; i++) { |
canvas->drawPath(fPath, paint); |
- canvas->drawRect(rect, perlinPaint); |
+ canvas->drawRect(fPerlinRect, perlinPaint); |
#if SK_SUPPORT_GPU |
// Ensure the GrContext doesn't batch across draw loops. |
if (GrContext* context = canvas->getGrContext()) { |
@@ -65,6 +70,7 @@ private: |
} |
} |
SkPath fPath; |
+ SkRect fPerlinRect; |
}; |
VisualBenchmarkStream::VisualBenchmarkStream(const SkSurfaceProps& surfaceProps) |