Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(271)

Unified Diff: bench/SKPBench.cpp

Issue 776273002: Fix SKPBench tiling so MPD and non-MPD match (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/gpu/SkGpuDevice.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: bench/SKPBench.cpp
diff --git a/bench/SKPBench.cpp b/bench/SKPBench.cpp
index 3e692171dbbb1bb46888bcb2838cde46fcb8063b..222a8789504a7cfbde88e2b0e97eeb4714bd4c36 100644
--- a/bench/SKPBench.cpp
+++ b/bench/SKPBench.cpp
@@ -57,8 +57,16 @@ void SKPBench::onPerCanvasPreDraw(SkCanvas* canvas) {
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);
}
@@ -120,8 +128,9 @@ void SKPBench::onDraw(const int loops, SkCanvas* canvas) {
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);
}
}
« no previous file with comments | « no previous file | src/gpu/SkGpuDevice.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698