| 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 16 matching lines...) Expand all Loading... |
| 27 const SkTileGridPicture::TileGridInfo info = { | 27 const SkTileGridPicture::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 const SkISize size = fGM->getISize(); | 32 const SkISize size = fGM->getISize(); |
| 33 SkTileGridPicture recorded(size.width(), size.height(), info); | 33 SkTileGridPicture recorded(size.width(), size.height(), info); |
| 34 RecordPicture(fGM.get(), &recorded, SkPicture::kUsePathBoundsForClip_Recordi
ngFlag); | 34 RecordPicture(fGM.get(), &recorded, SkPicture::kUsePathBoundsForClip_Recordi
ngFlag); |
| 35 | 35 |
| 36 SkBitmap full; | 36 SkBitmap full; |
| 37 SetupBitmap(fReference.config(), fGM.get(), &full); | 37 SetupBitmap(fReference.colorType(), fGM.get(), &full); |
| 38 SkCanvas fullCanvas(full); | 38 SkCanvas fullCanvas(full); |
| 39 | 39 |
| 40 SkBitmap tile; | 40 SkBitmap tile; |
| 41 tile.setConfig(fReference.config(), fTileSize.width(), fTileSize.height()); | 41 tile.allocPixels(SkImageInfo::Make(fTileSize.width(), fTileSize.height(), |
| 42 tile.allocPixels(); | 42 fReference.colorType(), kPremul_SkAlphaTy
pe)); |
| 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 = SkIntToScalar(x * tile.width()), | 52 const SkScalar xOffset = SkIntToScalar(x * tile.width()), |
| (...skipping 18 matching lines...) Expand all Loading... |
| 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 if (fGM->getFlags() & skiagm::GM::kSkipTiled_Flag) { | 74 if (fGM->getFlags() & skiagm::GM::kSkipTiled_Flag) { |
| 75 return true; | 75 return true; |
| 76 } | 76 } |
| 77 return !FLAGS_tileGrid; | 77 return !FLAGS_tileGrid; |
| 78 } | 78 } |
| 79 | 79 |
| 80 } // namespace DM | 80 } // namespace DM |
| OLD | NEW |