diff options
author | cdalton <cdalton@nvidia.com> | 2015-06-29 14:06:10 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-06-29 14:06:10 -0700 |
commit | 63a82855b1f0b83952b65fca330954c50ebe7a4b (patch) | |
tree | 63f6d3856bf95ea020d7f5143ee5fe8ab56d41d6 /bench/SKPAnimationBench.h | |
parent | c782b2a046763dc427fa47d4e33afca59c994d60 (diff) |
Make nanobench zoom animation time based
BUG=skia:
Review URL: https://codereview.chromium.org/1211253003
Diffstat (limited to 'bench/SKPAnimationBench.h')
-rw-r--r-- | bench/SKPAnimationBench.h | 25 |
1 files changed, 17 insertions, 8 deletions
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<Animation> fAnimation; + WallTimer fAnimationTimer; + SkString fUniqueName; + SkIRect fDevBounds; typedef SKPBench INHERITED; }; |