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

Side by Side Diff: dm/DMQuiltTask.cpp

Issue 540963002: Change SkPicture::draw to playback (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 3 months 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
OLDNEW
1 #include "DMQuiltTask.h" 1 #include "DMQuiltTask.h"
2 #include "DMUtil.h" 2 #include "DMUtil.h"
3 #include "DMWriteTask.h" 3 #include "DMWriteTask.h"
4 4
5 #include "SkBBHFactory.h" 5 #include "SkBBHFactory.h"
6 #include "SkCommandLineFlags.h" 6 #include "SkCommandLineFlags.h"
7 #include "SkPicture.h" 7 #include "SkPicture.h"
8 #include "SkTaskGroup.h" 8 #include "SkTaskGroup.h"
9 9
10 DEFINE_bool(quilt, true, "If true, draw GM via a picture into a quilt of small t iles and compare."); 10 DEFINE_bool(quilt, true, "If true, draw GM via a picture into a quilt of small t iles and compare.");
(...skipping 28 matching lines...) Expand all
39 , fY(y * FLAGS_quiltTile) 39 , fY(y * FLAGS_quiltTile)
40 , fPicture(picture) 40 , fPicture(picture)
41 , fQuilt(quilt) {} 41 , fQuilt(quilt) {}
42 42
43 virtual void run() SK_OVERRIDE { 43 virtual void run() SK_OVERRIDE {
44 SkBitmap tile; 44 SkBitmap tile;
45 fQuilt->extractSubset(&tile, SkIRect::MakeXYWH(fX, fY, FLAGS_quiltTile, FLAGS_quiltTile)); 45 fQuilt->extractSubset(&tile, SkIRect::MakeXYWH(fX, fY, FLAGS_quiltTile, FLAGS_quiltTile));
46 SkCanvas tileCanvas(tile); 46 SkCanvas tileCanvas(tile);
47 47
48 tileCanvas.translate(SkIntToScalar(-fX), SkIntToScalar(-fY)); 48 tileCanvas.translate(SkIntToScalar(-fX), SkIntToScalar(-fY));
49 fPicture.draw(&tileCanvas); 49 fPicture.playback(&tileCanvas);
50 tileCanvas.flush(); 50 tileCanvas.flush();
51 51
52 delete this; 52 delete this;
53 } 53 }
54 54
55 private: 55 private:
56 const int fX, fY; 56 const int fX, fY;
57 const SkPicture& fPicture; 57 const SkPicture& fPicture;
58 SkBitmap* fQuilt; 58 SkBitmap* fQuilt;
59 }; 59 };
(...skipping 25 matching lines...) Expand all
85 85
86 SkAutoTUnref<const SkPicture> recorded( 86 SkAutoTUnref<const SkPicture> recorded(
87 RecordPicture(fGM.get(), factory.get(), kSkRecord_Backend == fBacken d)); 87 RecordPicture(fGM.get(), factory.get(), kSkRecord_Backend == fBacken d));
88 88
89 SkBitmap full; 89 SkBitmap full;
90 AllocatePixels(fReference, &full); 90 AllocatePixels(fReference, &full);
91 91
92 if (fGM->getFlags() & skiagm::GM::kSkipTiled_Flag) { 92 if (fGM->getFlags() & skiagm::GM::kSkipTiled_Flag) {
93 // Some GMs don't draw exactly the same when tiled. Draw them in one go . 93 // Some GMs don't draw exactly the same when tiled. Draw them in one go .
94 SkCanvas canvas(full); 94 SkCanvas canvas(full);
95 recorded->draw(&canvas); 95 recorded->playback(&canvas);
96 canvas.flush(); 96 canvas.flush();
97 } else { 97 } else {
98 // Draw tiles in parallel into the same bitmap, simulating aggressive im pl-side painting. 98 // Draw tiles in parallel into the same bitmap, simulating aggressive im pl-side painting.
99 SkTaskGroup tg; 99 SkTaskGroup tg;
100 for (int y = 0; y < tiles_needed(full.height(), FLAGS_quiltTile); y++) { 100 for (int y = 0; y < tiles_needed(full.height(), FLAGS_quiltTile); y++) {
101 for (int x = 0; x < tiles_needed(full.width(), FLAGS_quiltTile); x++ ) { 101 for (int x = 0; x < tiles_needed(full.width(), FLAGS_quiltTile); x++ ) {
102 // Deletes itself when done. 102 // Deletes itself when done.
103 tg.add(new Tile(x, y, *recorded, &full)); 103 tg.add(new Tile(x, y, *recorded, &full));
104 } 104 }
105 } 105 }
106 } 106 }
107 107
108 if (!BitmapsEqual(full, fReference)) { 108 if (!BitmapsEqual(full, fReference)) {
109 this->fail(); 109 this->fail();
110 this->spawnChild(SkNEW_ARGS(WriteTask, (*this, full))); 110 this->spawnChild(SkNEW_ARGS(WriteTask, (*this, full)));
111 } 111 }
112 } 112 }
113 113
114 bool QuiltTask::shouldSkip() const { 114 bool QuiltTask::shouldSkip() const {
115 if (fGM->getFlags() & skiagm::GM::kSkipPicture_Flag) { 115 if (fGM->getFlags() & skiagm::GM::kSkipPicture_Flag) {
116 return true; 116 return true;
117 } 117 }
118 return !FLAGS_quilt; 118 return !FLAGS_quilt;
119 } 119 }
120 120
121 } // namespace DM 121 } // namespace DM
OLDNEW
« no previous file with comments | « dm/DMPDFTask.cpp ('k') | gm/distantclip.cpp » ('j') | include/core/SkPicture.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698