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

Side by Side Diff: dm/DMSKPTask.cpp

Issue 416333007: Fix crash in DM/SKPTask (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 4 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 | « 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 "DMSKPTask.h" 1 #include "DMSKPTask.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 "SkPictureRecorder.h" 6 #include "SkPictureRecorder.h"
7 7
8 DEFINE_bool(skr, true, "Test that SKPs draw the same when re-recorded with SkRec ord backend."); 8 DEFINE_bool(skr, true, "Test that SKPs draw the same when re-recorded with SkRec ord backend.");
9 9
10 namespace DM { 10 namespace DM {
11 11
12 // Test that an SkPicture plays back the same when re-recorded into an 12 // Test that an SkPicture plays back the same when re-recorded into an
13 // SkPicture backed by SkRecord. 13 // SkPicture backed by SkRecord.
14 class SkrComparisonTask : public CpuTask { 14 class SkrComparisonTask : public CpuTask {
15 public: 15 public:
16 SkrComparisonTask(const Task& parent, const SkPicture* picture, SkBitmap ref erence) 16 SkrComparisonTask(const Task& parent, const SkPicture* picture, SkBitmap ref erence)
17 : CpuTask(parent) 17 : CpuTask(parent)
18 , fPicture(picture) 18 , fPicture(SkRef(picture))
19 , fReference(reference) 19 , fReference(reference)
20 , fName(UnderJoin(parent.name().c_str(), "skr")) {} 20 , fName(UnderJoin(parent.name().c_str(), "skr")) {}
21 21
22 virtual bool shouldSkip() const SK_OVERRIDE { return !FLAGS_skr; } 22 virtual bool shouldSkip() const SK_OVERRIDE { return !FLAGS_skr; }
23 virtual SkString name() const SK_OVERRIDE { return fName; } 23 virtual SkString name() const SK_OVERRIDE { return fName; }
24 24
25 virtual void draw() SK_OVERRIDE { 25 virtual void draw() SK_OVERRIDE {
26 SkPictureRecorder recorder; 26 SkPictureRecorder recorder;
27 fPicture->draw(recorder.EXPERIMENTAL_beginRecording(fPicture->width(), f Picture->height())); 27 fPicture->draw(recorder.EXPERIMENTAL_beginRecording(fPicture->width(), f Picture->height()));
28 SkAutoTDelete<const SkPicture> skrPicture(recorder.endRecording()); 28 SkAutoTDelete<const SkPicture> skrPicture(recorder.endRecording());
(...skipping 21 matching lines...) Expand all
50 void SKPTask::draw() { 50 void SKPTask::draw() {
51 SkBitmap bitmap; 51 SkBitmap bitmap;
52 AllocatePixels(kN32_SkColorType, fPicture->width(), fPicture->height(), &bit map); 52 AllocatePixels(kN32_SkColorType, fPicture->width(), fPicture->height(), &bit map);
53 DrawPicture(*fPicture, &bitmap); 53 DrawPicture(*fPicture, &bitmap);
54 54
55 this->spawnChild(SkNEW_ARGS(WriteTask, (*this, bitmap))); 55 this->spawnChild(SkNEW_ARGS(WriteTask, (*this, bitmap)));
56 this->spawnChild(SkNEW_ARGS(SkrComparisonTask, (*this, fPicture.get(), bitma p))); 56 this->spawnChild(SkNEW_ARGS(SkrComparisonTask, (*this, fPicture.get(), bitma p)));
57 } 57 }
58 58
59 } // namespace DM 59 } // 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