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

Side by Side Diff: dm/DMTileGridTask.cpp

Issue 89663003: Add missing SkIntToScalars. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698