for (int y = bounds.fTop; y < bounds.fBottom; y += FLAGS_benchTile) {
for (int x = bounds.fLeft; x < bounds.fRight; x += FLAGS_benchTile) {
- *fTileRects.append() = SkIRect::MakeXYWH(x, y, FLAGS_benchTile, FLAGS_benchTile);
+ const SkIRect tileRect = SkIRect::MakeXYWH(x, y, FLAGS_benchTile, FLAGS_benchTile);
+ *fTileRects.append() = tileRect;
*fSurfaces.push() = canvas->newSurface(ii);
+
+ // Never want the contents of a tile to include stuff the parent
+ // canvas clips out
+ SkRect clip = SkRect::Make(bounds);
+ clip.offset(-SkIntToScalar(tileRect.fLeft), -SkIntToScalar(tileRect.fTop));
+ fSurfaces.top()->getCanvas()->clipRect(clip);
+
fSurfaces.top()->getCanvas()->setMatrix(canvas->getTotalMatrix());
fSurfaces.top()->getCanvas()->scale(fScale, fScale);
}
for (int y = bounds.fTop; y < bounds.fBottom; y += FLAGS_benchTile) {
for (int x = bounds.fLeft; x < bounds.fRight; x += FLAGS_benchTile) {
SkAutoCanvasRestore perTile(canvas, true/*save now*/);
- canvas->clipRect(SkRect::Make(
- SkIRect::MakeXYWH(x, y, FLAGS_benchTile, FLAGS_benchTile)));
+ canvas->clipRect(SkRect::MakeXYWH(x/fScale, y/fScale,
+ FLAGS_benchTile/fScale,
+ FLAGS_benchTile/fScale));
fPic->playback(canvas);
}
}
bool SkGpuDevice::EXPERIMENTAL_drawPicture(SkCanvas* mainCanvas, const SkPicture* mainPicture,
const SkMatrix* matrix, const SkPaint* paint) {
+#ifndef SK_IGNORE_GPU_LAYER_HOISTING
// todo: should handle this natively
if (paint) {
return false;
GrLayerHoister::UnlockLayers(fContext, atlasedRecycled);
return true;
+#else
+ return false;
+#endif
}
SkImageFilter::Cache* SkGpuDevice::getImageFilterCache() {