From 63a82855b1f0b83952b65fca330954c50ebe7a4b Mon Sep 17 00:00:00 2001 From: cdalton Date: Mon, 29 Jun 2015 14:06:10 -0700 Subject: Make nanobench zoom animation time based BUG=skia: Review URL: https://codereview.chromium.org/1211253003 --- bench/SKPAnimationBench.h | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) (limited to 'bench/SKPAnimationBench.h') diff --git a/bench/SKPAnimationBench.h b/bench/SKPAnimationBench.h index 65708f7639..c0bef308ec 100644 --- a/bench/SKPAnimationBench.h +++ b/bench/SKPAnimationBench.h @@ -9,6 +9,7 @@ #define SKPAnimationBench_DEFINED #include "SKPBench.h" +#include "Timer.h" /** * Runs an SkPicture as a benchmark by repeatedly drawing it, first centering the picture and @@ -16,11 +17,20 @@ */ class SKPAnimationBench : public SKPBench { public: - SKPAnimationBench(const char* name, const SkPicture*, const SkIRect& devClip, - SkMatrix viewMatrix, int steps, bool doLooping); + class Animation : public SkRefCnt { + public: + virtual const char* getTag() = 0; + virtual void preConcatFrameMatrix(double animationTimeMs, const SkIRect& devBounds, + SkMatrix* drawMatrix) = 0; + virtual ~Animation() {} + }; + + SKPAnimationBench(const char* name, const SkPicture*, const SkIRect& devClip, Animation*, + bool doLooping); + + static Animation* CreateZoomAnimation(SkScalar zoomMax, double zoomPeriodMs); protected: - const char* onGetName() override; const char* onGetUniqueName() override; void onPerCanvasPreDraw(SkCanvas* canvas) override; @@ -30,11 +40,10 @@ protected: void drawPicture() override; private: - int fSteps; - SkMatrix fAnimationMatrix; - SkString fName; - SkString fUniqueName; - SkPoint fCenter; + SkAutoTUnref fAnimation; + WallTimer fAnimationTimer; + SkString fUniqueName; + SkIRect fDevBounds; typedef SKPBench INHERITED; }; -- cgit v1.2.3