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

Side by Side Diff: bench/SKPBench.cpp

Issue 1061323003: Change to add zoom animations to nanobench (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: windows warning Created 5 years, 8 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/SKPBench.h ('k') | bench/nanobench.cpp » ('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 2014 Google Inc. 2 * Copyright 2014 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 "SKPBench.h" 8 #include "SKPBench.h"
9 #include "SkCommandLineFlags.h" 9 #include "SkCommandLineFlags.h"
10 #include "SkMultiPictureDraw.h" 10 #include "SkMultiPictureDraw.h"
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 return backend != kNonRendering_Backend; 91 return backend != kNonRendering_Backend;
92 } 92 }
93 93
94 SkIPoint SKPBench::onGetSize() { 94 SkIPoint SKPBench::onGetSize() {
95 return SkIPoint::Make(fClip.width(), fClip.height()); 95 return SkIPoint::Make(fClip.width(), fClip.height());
96 } 96 }
97 97
98 void SKPBench::onDraw(const int loops, SkCanvas* canvas) { 98 void SKPBench::onDraw(const int loops, SkCanvas* canvas) {
99 if (fUseMultiPictureDraw) { 99 if (fUseMultiPictureDraw) {
100 for (int i = 0; i < loops; i++) { 100 for (int i = 0; i < loops; i++) {
101 SkMultiPictureDraw mpd; 101 this->drawMPDPicture();
102
103 for (int j = 0; j < fTileRects.count(); ++j) {
104 SkMatrix trans;
105 trans.setTranslate(-fTileRects[j].fLeft/fScale,
106 -fTileRects[j].fTop/fScale);
107 mpd.add(fSurfaces[j]->getCanvas(), fPic, &trans);
108 }
109
110 mpd.draw();
111
112 for (int j = 0; j < fTileRects.count(); ++j) {
113 fSurfaces[j]->getCanvas()->flush();
114 }
115 } 102 }
116 } else { 103 } else {
117 for (int i = 0; i < loops; i++) { 104 for (int i = 0; i < loops; i++) {
118 for (int j = 0; j < fTileRects.count(); ++j) { 105 this->drawPicture();
119 const SkMatrix trans = SkMatrix::MakeTrans(-fTileRects[j].fLeft / fScale,
120 -fTileRects[j].fTop / fScale);
121 fSurfaces[j]->getCanvas()->drawPicture(fPic, &trans, NULL);
122 }
123
124 for (int j = 0; j < fTileRects.count(); ++j) {
125 fSurfaces[j]->getCanvas()->flush();
126 }
127 } 106 }
128 } 107 }
129 } 108 }
109
110 void SKPBench::drawMPDPicture() {
111 SkMultiPictureDraw mpd;
112
113 for (int j = 0; j < fTileRects.count(); ++j) {
114 SkMatrix trans;
115 trans.setTranslate(-fTileRects[j].fLeft/fScale,
116 -fTileRects[j].fTop/fScale);
117 mpd.add(fSurfaces[j]->getCanvas(), fPic, &trans);
118 }
119
120 mpd.draw();
121
122 for (int j = 0; j < fTileRects.count(); ++j) {
123 fSurfaces[j]->getCanvas()->flush();
124 }
125 }
126
127 void SKPBench::drawPicture() {
128 for (int j = 0; j < fTileRects.count(); ++j) {
129 const SkMatrix trans = SkMatrix::MakeTrans(-fTileRects[j].fLeft / fScale ,
130 -fTileRects[j].fTop / fScale) ;
131 fSurfaces[j]->getCanvas()->drawPicture(fPic, &trans, NULL);
132 }
133
134 for (int j = 0; j < fTileRects.count(); ++j) {
135 fSurfaces[j]->getCanvas()->flush();
136 }
137 }
OLDNEW
« no previous file with comments | « bench/SKPBench.h ('k') | bench/nanobench.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698