| 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" |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 } | 66 } |
| 67 | 67 |
| 68 void SKPBench::onPerCanvasPostDraw(SkCanvas* canvas) { | 68 void SKPBench::onPerCanvasPostDraw(SkCanvas* canvas) { |
| 69 if (!fUseMultiPictureDraw) { | 69 if (!fUseMultiPictureDraw) { |
| 70 return; | 70 return; |
| 71 } | 71 } |
| 72 | 72 |
| 73 // Draw the last set of tiles into the master canvas in case we're | 73 // Draw the last set of tiles into the master canvas in case we're |
| 74 // saving the images | 74 // saving the images |
| 75 for (int i = 0; i < fTileRects.count(); ++i) { | 75 for (int i = 0; i < fTileRects.count(); ++i) { |
| 76 canvas->drawImage(fSurfaces[i]->newImageSnapshot(), | 76 SkAutoTUnref<SkImage> image(fSurfaces[i]->newImageSnapshot()); |
| 77 canvas->drawImage(image, |
| 77 SkIntToScalar(fTileRects[i].fLeft), SkIntToScalar(fTil
eRects[i].fTop)); | 78 SkIntToScalar(fTileRects[i].fLeft), SkIntToScalar(fTil
eRects[i].fTop)); |
| 78 SkSafeSetNull(fSurfaces[i]); | 79 SkSafeSetNull(fSurfaces[i]); |
| 79 } | 80 } |
| 80 | 81 |
| 81 fSurfaces.rewind(); | 82 fSurfaces.rewind(); |
| 82 fTileRects.rewind(); | 83 fTileRects.rewind(); |
| 83 } | 84 } |
| 84 | 85 |
| 85 bool SKPBench::isSuitableFor(Backend backend) { | 86 bool SKPBench::isSuitableFor(Backend backend) { |
| 86 return backend != kNonRendering_Backend; | 87 return backend != kNonRendering_Backend; |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 canvas->clipRect(SkRect::Make( | 123 canvas->clipRect(SkRect::Make( |
| 123 SkIRect::MakeXYWH(x, y, FLAGS_benchTile, FLAGS_b
enchTile))); | 124 SkIRect::MakeXYWH(x, y, FLAGS_benchTile, FLAGS_b
enchTile))); |
| 124 fPic->playback(canvas); | 125 fPic->playback(canvas); |
| 125 } | 126 } |
| 126 } | 127 } |
| 127 | 128 |
| 128 canvas->flush(); | 129 canvas->flush(); |
| 129 } | 130 } |
| 130 } | 131 } |
| 131 } | 132 } |
| OLD | NEW |