OLD | NEW |
1 #include "DMTileGridTask.h" | 1 #include "DMTileGridTask.h" |
2 #include "DMWriteTask.h" | 2 #include "DMWriteTask.h" |
3 #include "DMUtil.h" | 3 #include "DMUtil.h" |
4 | 4 |
5 #include "SkCommandLineFlags.h" | 5 #include "SkCommandLineFlags.h" |
6 #include "SkPicture.h" | 6 #include "SkPicture.h" |
7 #include "SkTileGridPicture.h" | 7 #include "SkTileGridPicture.h" |
8 | 8 |
9 // TODO(mtklein): Tile grid tests are currently failing. (Skia issue 1198). Wh
en fixed, -> true. | 9 // TODO(mtklein): Tile grid tests are currently failing. (Skia issue 1198). Wh
en fixed, -> true. |
10 DEFINE_bool(tileGrid, false, "If true, run picture replay tests with a tile grid
."); | 10 DEFINE_bool(tileGrid, false, "If true, run picture replay tests with a tile grid
."); |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 tile.allocPixels(); | 42 tile.allocPixels(); |
43 SkCanvas tileCanvas(tile); | 43 SkCanvas tileCanvas(tile); |
44 | 44 |
45 SkPaint paint; | 45 SkPaint paint; |
46 paint.setXfermodeMode(SkXfermode::kSrc_Mode); | 46 paint.setXfermodeMode(SkXfermode::kSrc_Mode); |
47 | 47 |
48 for (int y = 0; y < tiles_needed(full.height(), tile.height()); y++) { | 48 for (int y = 0; y < tiles_needed(full.height(), tile.height()); y++) { |
49 for (int x = 0; x < tiles_needed(full.width(), tile.width()); x++) { | 49 for (int x = 0; x < tiles_needed(full.width(), tile.width()); x++) { |
50 SkAutoCanvasRestore ar(&tileCanvas, true/*also save now*/); | 50 SkAutoCanvasRestore ar(&tileCanvas, true/*also save now*/); |
51 | 51 |
52 const SkScalar xOffset = x * tile.width(), | 52 const SkScalar xOffset = SkIntToScalar(x * tile.width()), |
53 yOffset = y * tile.height(); | 53 yOffset = SkIntToScalar(y * tile.height()); |
54 SkMatrix matrix = tileCanvas.getTotalMatrix(); | 54 SkMatrix matrix = tileCanvas.getTotalMatrix(); |
55 matrix.postTranslate(-xOffset, -yOffset); | 55 matrix.postTranslate(-xOffset, -yOffset); |
56 tileCanvas.setMatrix(matrix); | 56 tileCanvas.setMatrix(matrix); |
57 | 57 |
58 recorded.draw(&tileCanvas); | 58 recorded.draw(&tileCanvas); |
59 tileCanvas.flush(); | 59 tileCanvas.flush(); |
60 fullCanvas.drawBitmap(tile, xOffset, yOffset, &paint); | 60 fullCanvas.drawBitmap(tile, xOffset, yOffset, &paint); |
61 } | 61 } |
62 } | 62 } |
63 | 63 |
64 if (!BitmapsEqual(full, fReference)) { | 64 if (!BitmapsEqual(full, fReference)) { |
65 this->fail(); | 65 this->fail(); |
66 this->spawnChild(SkNEW_ARGS(WriteTask, (*this, full))); | 66 this->spawnChild(SkNEW_ARGS(WriteTask, (*this, full))); |
67 } | 67 } |
68 } | 68 } |
69 | 69 |
70 bool TileGridTask::shouldSkip() const { | 70 bool TileGridTask::shouldSkip() const { |
71 if (fGM->getFlags() & skiagm::GM::kSkipPicture_Flag) { | 71 if (fGM->getFlags() & skiagm::GM::kSkipPicture_Flag) { |
72 return true; | 72 return true; |
73 } | 73 } |
74 return !FLAGS_tileGrid; | 74 return !FLAGS_tileGrid; |
75 } | 75 } |
76 | 76 |
77 } // namespace DM | 77 } // namespace DM |
OLD | NEW |