| 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
."); |
| 11 | 11 |
| 12 namespace DM { | 12 namespace DM { |
| 13 | 13 |
| 14 TileGridTask::TileGridTask(const Task& parent, skiagm::GM* gm, SkBitmap referenc
e, SkISize tileSize) | 14 TileGridTask::TileGridTask(const Task& parent, skiagm::GM* gm, SkBitmap referenc
e, SkISize tileSize) |
| 15 : CpuTask(parent) | 15 : CpuTask(parent) |
| 16 , fName(UnderJoin(parent.name().c_str(), "tilegrid")) | 16 , fName(UnderJoin(parent.name().c_str(), "tilegrid")) |
| 17 , fGM(gm) | 17 , fGM(gm) |
| 18 , fReference(reference) | 18 , fReference(reference) |
| 19 , fTileSize(tileSize) | 19 , fTileSize(tileSize) |
| 20 {} | 20 {} |
| 21 | 21 |
| 22 static int tiles_needed(int fullDimension, int tileDimension) { | 22 static int tiles_needed(int fullDimension, int tileDimension) { |
| 23 return (fullDimension + tileDimension - 1) / tileDimension; | 23 return (fullDimension + tileDimension - 1) / tileDimension; |
| 24 } | 24 } |
| 25 | 25 |
| 26 void TileGridTask::draw() { | 26 void TileGridTask::draw() { |
| 27 const SkTileGridPicture::TileGridInfo info = { | 27 const SkTileGridFactory::TileGridInfo info = { |
| 28 fTileSize, | 28 fTileSize, |
| 29 SkISize::Make(0,0), // Overlap between adjacent tiles. | 29 SkISize::Make(0,0), // Overlap between adjacent tiles. |
| 30 SkIPoint::Make(0,0), // Offset. | 30 SkIPoint::Make(0,0), // Offset. |
| 31 }; | 31 }; |
| 32 SkAutoTUnref<SkPictureFactory> factory(SkNEW_ARGS(SkTileGridPictureFactory,
(info))); | 32 SkTileGridFactory factory(info); |
| 33 SkAutoTUnref<SkPicture> recorded(RecordPicture(fGM.get(), | 33 SkAutoTUnref<SkPicture> recorded(RecordPicture(fGM.get(), |
| 34 SkPicture::kUsePathBoundsForC
lip_RecordingFlag, | 34 SkPicture::kUsePathBoundsForC
lip_RecordingFlag, |
| 35 factory)); | 35 &factory)); |
| 36 | 36 |
| 37 SkBitmap full; | 37 SkBitmap full; |
| 38 SetupBitmap(fReference.colorType(), fGM.get(), &full); | 38 SetupBitmap(fReference.colorType(), fGM.get(), &full); |
| 39 SkCanvas fullCanvas(full); | 39 SkCanvas fullCanvas(full); |
| 40 | 40 |
| 41 SkBitmap tile; | 41 SkBitmap tile; |
| 42 tile.allocPixels(SkImageInfo::Make(fTileSize.width(), fTileSize.height(), | 42 tile.allocPixels(SkImageInfo::Make(fTileSize.width(), fTileSize.height(), |
| 43 fReference.colorType(), kPremul_SkAlphaTy
pe)); | 43 fReference.colorType(), kPremul_SkAlphaTy
pe)); |
| 44 SkCanvas tileCanvas(tile); | 44 SkCanvas tileCanvas(tile); |
| 45 | 45 |
| (...skipping 26 matching lines...) Expand all Loading... |
| 72 if (fGM->getFlags() & skiagm::GM::kSkipPicture_Flag) { | 72 if (fGM->getFlags() & skiagm::GM::kSkipPicture_Flag) { |
| 73 return true; | 73 return true; |
| 74 } | 74 } |
| 75 if (fGM->getFlags() & skiagm::GM::kSkipTiled_Flag) { | 75 if (fGM->getFlags() & skiagm::GM::kSkipTiled_Flag) { |
| 76 return true; | 76 return true; |
| 77 } | 77 } |
| 78 return !FLAGS_tileGrid; | 78 return !FLAGS_tileGrid; |
| 79 } | 79 } |
| 80 | 80 |
| 81 } // namespace DM | 81 } // namespace DM |
| OLD | NEW |