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

Side by Side Diff: dm/DMSerializeTask.cpp

Issue 286993005: refactor DM::SetupBitmap (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 7 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
« no previous file with comments | « dm/DMSKPTask.cpp ('k') | dm/DMUtil.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #include "DMSerializeTask.h" 1 #include "DMSerializeTask.h"
2 #include "DMUtil.h" 2 #include "DMUtil.h"
3 #include "DMWriteTask.h" 3 #include "DMWriteTask.h"
4 4
5 #include "SkCommandLineFlags.h" 5 #include "SkCommandLineFlags.h"
6 #include "SkPicture.h" 6 #include "SkPicture.h"
7 #include "SkPixelRef.h" 7 #include "SkPixelRef.h"
8 8
9 DEFINE_bool(serialize, true, "If true, run picture serialization tests."); 9 DEFINE_bool(serialize, true, "If true, run picture serialization tests.");
10 10
(...skipping 10 matching lines...) Expand all
21 21
22 void SerializeTask::draw() { 22 void SerializeTask::draw() {
23 SkAutoTUnref<SkPicture> recorded(RecordPicture(fGM.get())); 23 SkAutoTUnref<SkPicture> recorded(RecordPicture(fGM.get()));
24 24
25 SkDynamicMemoryWStream wStream; 25 SkDynamicMemoryWStream wStream;
26 recorded->serialize(&wStream, NULL); 26 recorded->serialize(&wStream, NULL);
27 SkAutoTUnref<SkStream> rStream(wStream.detachAsStream()); 27 SkAutoTUnref<SkStream> rStream(wStream.detachAsStream());
28 SkAutoTUnref<SkPicture> reconstructed(SkPicture::CreateFromStream(rStream)); 28 SkAutoTUnref<SkPicture> reconstructed(SkPicture::CreateFromStream(rStream));
29 29
30 SkBitmap bitmap; 30 SkBitmap bitmap;
31 SetupBitmap(fReference.colorType(), fGM.get(), &bitmap); 31 AllocatePixels(fReference, &bitmap);
32 DrawPicture(reconstructed, &bitmap); 32 DrawPicture(reconstructed, &bitmap);
33 if (!BitmapsEqual(bitmap, fReference)) { 33 if (!BitmapsEqual(bitmap, fReference)) {
34 this->fail(); 34 this->fail();
35 this->spawnChild(SkNEW_ARGS(WriteTask, (*this, bitmap))); 35 this->spawnChild(SkNEW_ARGS(WriteTask, (*this, bitmap)));
36 } 36 }
37 } 37 }
38 38
39 bool SerializeTask::shouldSkip() const { 39 bool SerializeTask::shouldSkip() const {
40 return !FLAGS_serialize || fGM->getFlags() & skiagm::GM::kSkipPicture_Flag; 40 return !FLAGS_serialize || fGM->getFlags() & skiagm::GM::kSkipPicture_Flag;
41 } 41 }
42 42
43 } // namespace DM 43 } // namespace DM
OLDNEW
« no previous file with comments | « dm/DMSKPTask.cpp ('k') | dm/DMUtil.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698