Index: bench/SKPBench.cpp |
diff --git a/bench/SKPBench.cpp b/bench/SKPBench.cpp |
index 6f74ff942d8aefbb7fbc86477e726b65abe9056f..592d0428fd01f7c449dc91e7f9b0229366570ca4 100644 |
--- a/bench/SKPBench.cpp |
+++ b/bench/SKPBench.cpp |
@@ -98,32 +98,40 @@ SkIPoint SKPBench::onGetSize() { |
void SKPBench::onDraw(const int loops, SkCanvas* canvas) { |
if (fUseMultiPictureDraw) { |
for (int i = 0; i < loops; i++) { |
- SkMultiPictureDraw mpd; |
- |
- for (int j = 0; j < fTileRects.count(); ++j) { |
- SkMatrix trans; |
- trans.setTranslate(-fTileRects[j].fLeft/fScale, |
- -fTileRects[j].fTop/fScale); |
- mpd.add(fSurfaces[j]->getCanvas(), fPic, &trans); |
- } |
- |
- mpd.draw(); |
- |
- for (int j = 0; j < fTileRects.count(); ++j) { |
- fSurfaces[j]->getCanvas()->flush(); |
- } |
+ this->drawMPDPicture(); |
} |
} else { |
for (int i = 0; i < loops; i++) { |
- for (int j = 0; j < fTileRects.count(); ++j) { |
- const SkMatrix trans = SkMatrix::MakeTrans(-fTileRects[j].fLeft / fScale, |
- -fTileRects[j].fTop / fScale); |
- fSurfaces[j]->getCanvas()->drawPicture(fPic, &trans, NULL); |
- } |
- |
- for (int j = 0; j < fTileRects.count(); ++j) { |
- fSurfaces[j]->getCanvas()->flush(); |
- } |
+ this->drawPicture(); |
} |
} |
} |
+ |
+void SKPBench::drawMPDPicture() { |
+ SkMultiPictureDraw mpd; |
+ |
+ for (int j = 0; j < fTileRects.count(); ++j) { |
+ SkMatrix trans; |
+ trans.setTranslate(-fTileRects[j].fLeft/fScale, |
+ -fTileRects[j].fTop/fScale); |
+ mpd.add(fSurfaces[j]->getCanvas(), fPic, &trans); |
+ } |
+ |
+ mpd.draw(); |
+ |
+ for (int j = 0; j < fTileRects.count(); ++j) { |
+ fSurfaces[j]->getCanvas()->flush(); |
+ } |
+} |
+ |
+void SKPBench::drawPicture() { |
+ for (int j = 0; j < fTileRects.count(); ++j) { |
+ const SkMatrix trans = SkMatrix::MakeTrans(-fTileRects[j].fLeft / fScale, |
+ -fTileRects[j].fTop / fScale); |
+ fSurfaces[j]->getCanvas()->drawPicture(fPic, &trans, NULL); |
+ } |
+ |
+ for (int j = 0; j < fTileRects.count(); ++j) { |
+ fSurfaces[j]->getCanvas()->flush(); |
+ } |
+} |