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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 | 65 |
66 fSurfaces.setReserve(xTiles * yTiles); | 66 fSurfaces.setReserve(xTiles * yTiles); |
67 fTileRects.setReserve(xTiles * yTiles); | 67 fTileRects.setReserve(xTiles * yTiles); |
68 | 68 |
69 SkImageInfo ii = canvas->imageInfo().makeWH(tileW, tileH); | 69 SkImageInfo ii = canvas->imageInfo().makeWH(tileW, tileH); |
70 | 70 |
71 for (int y = bounds.fTop; y < bounds.fBottom; y += tileH) { | 71 for (int y = bounds.fTop; y < bounds.fBottom; y += tileH) { |
72 for (int x = bounds.fLeft; x < bounds.fRight; x += tileW) { | 72 for (int x = bounds.fLeft; x < bounds.fRight; x += tileW) { |
73 const SkIRect tileRect = SkIRect::MakeXYWH(x, y, tileW, tileH); | 73 const SkIRect tileRect = SkIRect::MakeXYWH(x, y, tileW, tileH); |
74 *fTileRects.append() = tileRect; | 74 *fTileRects.append() = tileRect; |
75 *fSurfaces.push() = canvas->newSurface(ii); | 75 *fSurfaces.push() = canvas->makeSurface(ii).release(); |
76 | 76 |
77 // Never want the contents of a tile to include stuff the parent | 77 // Never want the contents of a tile to include stuff the parent |
78 // canvas clips out | 78 // canvas clips out |
79 SkRect clip = SkRect::Make(bounds); | 79 SkRect clip = SkRect::Make(bounds); |
80 clip.offset(-SkIntToScalar(tileRect.fLeft), -SkIntToScalar(tileRect.
fTop)); | 80 clip.offset(-SkIntToScalar(tileRect.fLeft), -SkIntToScalar(tileRect.
fTop)); |
81 fSurfaces.top()->getCanvas()->clipRect(clip); | 81 fSurfaces.top()->getCanvas()->clipRect(clip); |
82 | 82 |
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 } |
(...skipping 104 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 |