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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 fSurfaces.top()->getCanvas()->setMatrix(canvas->getTotalMatrix()); | 83 fSurfaces.top()->getCanvas()->setMatrix(canvas->getTotalMatrix()); |
84 fSurfaces.top()->getCanvas()->scale(fScale, fScale); | 84 fSurfaces.top()->getCanvas()->scale(fScale, fScale); |
85 } | 85 } |
86 } | 86 } |
87 } | 87 } |
88 | 88 |
89 void SKPBench::onPerCanvasPostDraw(SkCanvas* canvas) { | 89 void SKPBench::onPerCanvasPostDraw(SkCanvas* canvas) { |
90 // Draw the last set of tiles into the master canvas in case we're | 90 // Draw the last set of tiles into the master canvas in case we're |
91 // saving the images | 91 // saving the images |
92 for (int i = 0; i < fTileRects.count(); ++i) { | 92 for (int i = 0; i < fTileRects.count(); ++i) { |
93 SkAutoTUnref<SkImage> image(fSurfaces[i]->newImageSnapshot()); | 93 sk_sp<SkImage> image(fSurfaces[i]->makeImageSnapshot()); |
94 canvas->drawImage(image, | 94 canvas->drawImage(image, |
95 SkIntToScalar(fTileRects[i].fLeft), SkIntToScalar(fTil
eRects[i].fTop)); | 95 SkIntToScalar(fTileRects[i].fLeft), SkIntToScalar(fTil
eRects[i].fTop)); |
96 SkSafeSetNull(fSurfaces[i]); | 96 SkSafeSetNull(fSurfaces[i]); |
97 } | 97 } |
98 | 98 |
99 fSurfaces.rewind(); | 99 fSurfaces.rewind(); |
100 fTileRects.rewind(); | 100 fTileRects.rewind(); |
101 } | 101 } |
102 | 102 |
103 bool SKPBench::isSuitableFor(Backend backend) { | 103 bool SKPBench::isSuitableFor(Backend backend) { |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 context->freeGpuResources(); | 190 context->freeGpuResources(); |
191 context->resetContext(); | 191 context->resetContext(); |
192 context->getGpu()->resetShaderCacheForTesting(); | 192 context->getGpu()->resetShaderCacheForTesting(); |
193 draw_pic_for_stats(canvas, context, fPic, keys, values, "first_frame"); | 193 draw_pic_for_stats(canvas, context, fPic, keys, values, "first_frame"); |
194 | 194 |
195 // draw second frame | 195 // draw second frame |
196 draw_pic_for_stats(canvas, context, fPic, keys, values, "second_frame"); | 196 draw_pic_for_stats(canvas, context, fPic, keys, values, "second_frame"); |
197 | 197 |
198 #endif | 198 #endif |
199 } | 199 } |
OLD | NEW |