36352bf5e3
NOPRESUBMIT=true BUG=skia: DOCS_PREVIEW= https://skia.org/?cl=1037793002 Review URL: https://codereview.chromium.org/1037793002
48 lines
1.2 KiB
C++
48 lines
1.2 KiB
C++
/*
|
|
* Copyright 2014 Google Inc.
|
|
*
|
|
* Use of this source code is governed by a BSD-style license that can be
|
|
* found in the LICENSE file.
|
|
*/
|
|
|
|
#ifndef SKPBench_DEFINED
|
|
#define SKPBench_DEFINED
|
|
|
|
#include "Benchmark.h"
|
|
#include "SkCanvas.h"
|
|
#include "SkPicture.h"
|
|
|
|
/**
|
|
* Runs an SkPicture as a benchmark by repeatedly drawing it scaled inside a device clip.
|
|
*/
|
|
class SKPBench : public Benchmark {
|
|
public:
|
|
SKPBench(const char* name, const SkPicture*, const SkIRect& devClip, SkScalar scale,
|
|
bool useMultiPictureDraw);
|
|
~SKPBench() override;
|
|
|
|
protected:
|
|
const char* onGetName() override;
|
|
const char* onGetUniqueName() override;
|
|
void onPerCanvasPreDraw(SkCanvas*) override;
|
|
void onPerCanvasPostDraw(SkCanvas*) override;
|
|
bool isSuitableFor(Backend backend) override;
|
|
void onDraw(const int loops, SkCanvas* canvas) override;
|
|
SkIPoint onGetSize() override;
|
|
|
|
private:
|
|
SkAutoTUnref<const SkPicture> fPic;
|
|
const SkIRect fClip;
|
|
const SkScalar fScale;
|
|
SkString fName;
|
|
SkString fUniqueName;
|
|
|
|
const bool fUseMultiPictureDraw;
|
|
SkTDArray<SkSurface*> fSurfaces; // for MultiPictureDraw
|
|
SkTDArray<SkIRect> fTileRects; // for MultiPictureDraw
|
|
|
|
typedef Benchmark INHERITED;
|
|
};
|
|
|
|
#endif
|