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

Unified Diff: tools/VisualBench/VisualBenchmarkStream.cpp

Issue 1443263002: Optimize visualbench offscreen blits (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix msvc warnings Created 5 years, 1 month 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 | tools/VisualBench/VisualSKPBench.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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)
« no previous file with comments | « no previous file | tools/VisualBench/VisualSKPBench.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698