OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2012 Google Inc. | 3 * Copyright 2012 Google Inc. |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 #include "SkDebugger.h" | 9 #include "SkDebugger.h" |
10 #include "SkPictureRecorder.h" | 10 #include "SkPictureRecorder.h" |
(...skipping 18 matching lines...) Expand all Loading... |
29 | 29 |
30 delete fDebugCanvas; | 30 delete fDebugCanvas; |
31 fDebugCanvas = new SkDebugCanvas(SkScalarCeilToInt(this->pictureCull().width
()), | 31 fDebugCanvas = new SkDebugCanvas(SkScalarCeilToInt(this->pictureCull().width
()), |
32 SkScalarCeilToInt(this->pictureCull().heigh
t())); | 32 SkScalarCeilToInt(this->pictureCull().heigh
t())); |
33 fDebugCanvas->setPicture(picture); | 33 fDebugCanvas->setPicture(picture); |
34 picture->playback(fDebugCanvas); | 34 picture->playback(fDebugCanvas); |
35 fDebugCanvas->setPicture(nullptr); | 35 fDebugCanvas->setPicture(nullptr); |
36 fIndex = fDebugCanvas->getSize() - 1; | 36 fIndex = fDebugCanvas->getSize() - 1; |
37 } | 37 } |
38 | 38 |
39 SkPicture* SkDebugger::copyPicture() { | 39 sk_sp<SkPicture> SkDebugger::copyPicture() { |
40 // We can't just call clone here since we want to removed the "deleted" | 40 // We can't just call clone here since we want to removed the "deleted" |
41 // commands. Playing back will strip those out. | 41 // commands. Playing back will strip those out. |
42 SkPictureRecorder recorder; | 42 SkPictureRecorder recorder; |
43 SkCanvas* canvas = recorder.beginRecording(this->pictureCull().width(), | 43 SkCanvas* canvas = recorder.beginRecording(this->pictureCull().width(), |
44 this->pictureCull().height()); | 44 this->pictureCull().height()); |
45 | 45 |
46 bool vizMode = fDebugCanvas->getMegaVizMode(); | 46 bool vizMode = fDebugCanvas->getMegaVizMode(); |
47 fDebugCanvas->setMegaVizMode(false); | 47 fDebugCanvas->setMegaVizMode(false); |
48 bool overDraw = fDebugCanvas->getOverdrawViz(); | 48 bool overDraw = fDebugCanvas->getOverdrawViz(); |
49 fDebugCanvas->setOverdrawViz(false); | 49 fDebugCanvas->setOverdrawViz(false); |
50 bool pathOps = fDebugCanvas->getAllowSimplifyClip(); | 50 bool pathOps = fDebugCanvas->getAllowSimplifyClip(); |
51 fDebugCanvas->setAllowSimplifyClip(false); | 51 fDebugCanvas->setAllowSimplifyClip(false); |
52 | 52 |
53 fDebugCanvas->draw(canvas); | 53 fDebugCanvas->draw(canvas); |
54 | 54 |
55 fDebugCanvas->setMegaVizMode(vizMode); | 55 fDebugCanvas->setMegaVizMode(vizMode); |
56 fDebugCanvas->setOverdrawViz(overDraw); | 56 fDebugCanvas->setOverdrawViz(overDraw); |
57 fDebugCanvas->setAllowSimplifyClip(pathOps); | 57 fDebugCanvas->setAllowSimplifyClip(pathOps); |
58 | 58 |
59 return recorder.endRecording(); | 59 return recorder.finishRecordingAsPicture(); |
60 } | 60 } |
61 | 61 |
62 void SkDebugger::getOverviewText(const SkTDArray<double>* typeTimes, | 62 void SkDebugger::getOverviewText(const SkTDArray<double>* typeTimes, |
63 double totTime, | 63 double totTime, |
64 SkString* overview, | 64 SkString* overview, |
65 int numRuns) { | 65 int numRuns) { |
66 const SkTDArray<SkDrawCommand*>& commands = this->getDrawCommands(); | 66 const SkTDArray<SkDrawCommand*>& commands = this->getDrawCommands(); |
67 | 67 |
68 SkTDArray<int> counts; | 68 SkTDArray<int> counts; |
69 counts.setCount(SkDrawCommand::kOpTypeCount); | 69 counts.setCount(SkDrawCommand::kOpTypeCount); |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 overview->append(" R: "); | 140 overview->append(" R: "); |
141 overview->appendScalar(this->pictureCull().fRight); | 141 overview->appendScalar(this->pictureCull().fRight); |
142 overview->append(" B: "); | 142 overview->append(" B: "); |
143 overview->appendScalar(this->pictureCull().fBottom); | 143 overview->appendScalar(this->pictureCull().fBottom); |
144 overview->append("<br/>"); | 144 overview->append("<br/>"); |
145 } | 145 } |
146 | 146 |
147 void SkDebugger::getClipStackText(SkString* clipStack) { | 147 void SkDebugger::getClipStackText(SkString* clipStack) { |
148 clipStack->set(fDebugCanvas->clipStackData()); | 148 clipStack->set(fDebugCanvas->clipStackData()); |
149 } | 149 } |
OLD | NEW |