| OLD | NEW |
| 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" |
| 11 #include "SkSurface.h" | 11 #include "SkSurface.h" |
| 12 | 12 |
| 13 DEFINE_int32(benchTile, 256, "Tile dimension used for SKP playback."); | 13 DEFINE_int32(benchTile, 256, "Tile dimension used for SKP playback."); |
| 14 | 14 |
| 15 SKPBench::SKPBench(const char* name, const SkPicture* pic, const SkIRect& clip,
SkScalar scale, | 15 SKPBench::SKPBench(const char* name, const SkPicture* pic, const SkIRect& clip,
SkScalar scale, |
| 16 bool useMultiPictureDraw) | 16 bool useMultiPictureDraw) |
| 17 : fPic(SkRef(pic)) | 17 : fPic(SkRef(pic)) |
| 18 , fClip(clip) | 18 , fClip(clip) |
| 19 , fScale(scale) | 19 , fScale(scale) |
| 20 , fName(name) | 20 , fName(name) |
| 21 , fUseMultiPictureDraw(useMultiPictureDraw) { | 21 , fUseMultiPictureDraw(useMultiPictureDraw) { |
| 22 fUniqueName.printf("%s_%.2g", name, scale); // Scale makes this unqiue for
skiaperf.com traces. | 22 fUniqueName.printf("%s_%.2g", name, scale); // Scale makes this unqiue for
perf.skia.org traces. |
| 23 if (useMultiPictureDraw) { | 23 if (useMultiPictureDraw) { |
| 24 fUniqueName.append("_mpd"); | 24 fUniqueName.append("_mpd"); |
| 25 } | 25 } |
| 26 } | 26 } |
| 27 | 27 |
| 28 SKPBench::~SKPBench() { | 28 SKPBench::~SKPBench() { |
| 29 for (int i = 0; i < fSurfaces.count(); ++i) { | 29 for (int i = 0; i < fSurfaces.count(); ++i) { |
| 30 fSurfaces[i]->unref(); | 30 fSurfaces[i]->unref(); |
| 31 } | 31 } |
| 32 } | 32 } |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 -fTileRects[j].fTop / fScale); | 117 -fTileRects[j].fTop / fScale); |
| 118 fSurfaces[j]->getCanvas()->drawPicture(fPic, &trans, NULL); | 118 fSurfaces[j]->getCanvas()->drawPicture(fPic, &trans, NULL); |
| 119 } | 119 } |
| 120 | 120 |
| 121 for (int j = 0; j < fTileRects.count(); ++j) { | 121 for (int j = 0; j < fTileRects.count(); ++j) { |
| 122 fSurfaces[j]->getCanvas()->flush(); | 122 fSurfaces[j]->getCanvas()->flush(); |
| 123 } | 123 } |
| 124 } | 124 } |
| 125 } | 125 } |
| 126 } | 126 } |
| OLD | NEW |