skia2/tools/VisualBench/VisualSKPBench.h
cdalton 0f6cca8a20 Optimize visualbench offscreen blits
Modifies NvprWrappedBenchmark to present its offscreen canvas via
GrContext::copySurface rather than going through the SkCanvas API.
Only copies a subrectangle the size of the benchmark, not the entire
canvas.

BUG=skia:

Review URL: https://codereview.chromium.org/1443263002
2015-11-24 08:54:30 -08:00

40 lines
853 B
C++

/*
* Copyright 2015 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
*/
#ifndef VisualSKPBench_DEFINED
#define VisualSKPBench_DEFINED
#include "Benchmark.h"
#include "SkCanvas.h"
#include "SkPicture.h"
/**
* Runs an SkPicture as a benchmark by repeatedly drawing it
*/
class VisualSKPBench : public Benchmark {
public:
VisualSKPBench(const char* name, const SkPicture*);
protected:
const char* onGetName() override;
const char* onGetUniqueName() override;
bool isSuitableFor(Backend backend) override;
SkIPoint onGetSize() override;
void onDraw(int loops, SkCanvas* canvas) override;
private:
SkAutoTUnref<const SkPicture> fPic;
SkIRect fCullRect;
SkString fName;
SkString fUniqueName;
typedef Benchmark INHERITED;
};
#endif