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

Side by Side Diff: bench/SKPAnimationBench.cpp

Issue 1541983002: Add tileSKP option to nanobench (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix scales Created 4 years, 11 months 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 unified diff | Download patch
« no previous file with comments | « bench/SKPAnimationBench.h ('k') | bench/SKPBench.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2015 Google Inc. 2 * Copyright 2015 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "SKPAnimationBench.h" 8 #include "SKPAnimationBench.h"
9 #include "SkCommandLineFlags.h" 9 #include "SkCommandLineFlags.h"
10 #include "SkMultiPictureDraw.h" 10 #include "SkMultiPictureDraw.h"
11 #include "SkSurface.h" 11 #include "SkSurface.h"
12 12
13 SKPAnimationBench::SKPAnimationBench(const char* name, const SkPicture* pic, con st SkIRect& clip, 13 SKPAnimationBench::SKPAnimationBench(const char* name, const SkPicture* pic, con st SkIRect& clip,
14 Animation* animation, bool doLooping) 14 Animation* animation, bool doLooping)
15 : INHERITED(name, pic, clip, 1.0, false, doLooping) 15 : INHERITED(name, pic, clip, 1.0, false, doLooping)
16 , fAnimation(SkRef(animation)) { 16 , fAnimation(SkRef(animation)) {
17 fUniqueName.printf("%s_%s", name, fAnimation->getTag()); 17 fUniqueName.printf("%s_%s", name, fAnimation->getTag());
18 } 18 }
19 19
20 const char* SKPAnimationBench::onGetUniqueName() { 20 const char* SKPAnimationBench::onGetUniqueName() {
21 return fUniqueName.c_str(); 21 return fUniqueName.c_str();
22 } 22 }
23 23
24 void SKPAnimationBench::onPerCanvasPreDraw(SkCanvas* canvas) { 24 void SKPAnimationBench::onPerCanvasPreDraw(SkCanvas* canvas) {
25 INHERITED::onPerCanvasPreDraw(canvas); 25 INHERITED::onPerCanvasPreDraw(canvas);
26 SkAssertResult(canvas->getClipDeviceBounds(&fDevBounds)); 26 SkAssertResult(canvas->getClipDeviceBounds(&fDevBounds));
27 fAnimationTimer.start(); 27 fAnimationTimer.start();
28 } 28 }
29 29
30 void SKPAnimationBench::drawPicture() { 30 void SKPAnimationBench::drawPicture(SkCanvas* canvas) {
31 SkMatrix m;
32 m.setScale(this->scale(), this->scale());
33 fAnimation->preConcatFrameMatrix(fAnimationTimer.fWall, fDevBounds, &m);
34 canvas->save();
35 canvas->concat(m);
36 canvas->drawPicture(this->picture());
37 canvas->restore();
38 }
39
40 void SKPAnimationBench::drawPictureTiled() {
31 fAnimationTimer.end(); 41 fAnimationTimer.end();
32 42
33 for (int j = 0; j < this->tileRects().count(); ++j) { 43 for (int j = 0; j < this->tileRects().count(); ++j) {
34 SkMatrix trans = SkMatrix::MakeTrans(-1.f * this->tileRects()[j].fLeft, 44 SkMatrix trans = SkMatrix::MakeTrans(-1.f * this->tileRects()[j].fLeft,
35 -1.f * this->tileRects()[j].fTop); 45 -1.f * this->tileRects()[j].fTop);
36 fAnimation->preConcatFrameMatrix(fAnimationTimer.fWall, fDevBounds, &tra ns); 46 fAnimation->preConcatFrameMatrix(fAnimationTimer.fWall, fDevBounds, &tra ns);
37 this->surfaces()[j]->getCanvas()->drawPicture(this->picture(), &trans, n ullptr); 47 this->surfaces()[j]->getCanvas()->drawPicture(this->picture(), &trans, n ullptr);
38 } 48 }
39 49
40 for (int j = 0; j < this->tileRects().count(); ++j) { 50 for (int j = 0; j < this->tileRects().count(); ++j) {
(...skipping 25 matching lines...) Expand all
66 76
67 private: 77 private:
68 double fZoomMax; 78 double fZoomMax;
69 double fZoomPeriodMs; 79 double fZoomPeriodMs;
70 }; 80 };
71 81
72 SKPAnimationBench::Animation* SKPAnimationBench::CreateZoomAnimation(SkScalar zo omMax, 82 SKPAnimationBench::Animation* SKPAnimationBench::CreateZoomAnimation(SkScalar zo omMax,
73 double zoom PeriodMs) { 83 double zoom PeriodMs) {
74 return new ZoomAnimation(zoomMax, zoomPeriodMs); 84 return new ZoomAnimation(zoomMax, zoomPeriodMs);
75 } 85 }
OLDNEW
« no previous file with comments | « bench/SKPAnimationBench.h ('k') | bench/SKPBench.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698