| 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 "SkString.h" | 10 #include "SkString.h" |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 fDebugCanvas->setPicture(picture); | 34 fDebugCanvas->setPicture(picture); |
| 35 picture->draw(fDebugCanvas); | 35 picture->draw(fDebugCanvas); |
| 36 fDebugCanvas->setPicture(NULL); | 36 fDebugCanvas->setPicture(NULL); |
| 37 fIndex = fDebugCanvas->getSize() - 1; | 37 fIndex = fDebugCanvas->getSize() - 1; |
| 38 SkRefCnt_SafeAssign(fPicture, picture); | 38 SkRefCnt_SafeAssign(fPicture, picture); |
| 39 } | 39 } |
| 40 | 40 |
| 41 SkPicture* SkDebugger::copyPicture() { | 41 SkPicture* SkDebugger::copyPicture() { |
| 42 // We can't just call clone here since we want to removed the "deleted" | 42 // We can't just call clone here since we want to removed the "deleted" |
| 43 // commands. Playing back will strip those out. | 43 // commands. Playing back will strip those out. |
| 44 SkPicture* newPicture = new SkPicture; | 44 SkPictureRecorder recorder; |
| 45 SkCanvas* canvas = newPicture->beginRecording(fPictureWidth, fPictureHeight)
; | 45 SkCanvas* canvas = recorder.beginRecording(fPictureWidth, fPictureHeight); |
| 46 | 46 |
| 47 bool vizMode = fDebugCanvas->getMegaVizMode(); | 47 bool vizMode = fDebugCanvas->getMegaVizMode(); |
| 48 fDebugCanvas->setMegaVizMode(false); | 48 fDebugCanvas->setMegaVizMode(false); |
| 49 bool overDraw = fDebugCanvas->getOverdrawViz(); | 49 bool overDraw = fDebugCanvas->getOverdrawViz(); |
| 50 fDebugCanvas->setOverdrawViz(false); | 50 fDebugCanvas->setOverdrawViz(false); |
| 51 int saveCount = fDebugCanvas->getOutstandingSaveCount(); | 51 int saveCount = fDebugCanvas->getOutstandingSaveCount(); |
| 52 fDebugCanvas->setOutstandingSaveCount(0); | 52 fDebugCanvas->setOutstandingSaveCount(0); |
| 53 | 53 |
| 54 fDebugCanvas->draw(canvas); | 54 fDebugCanvas->draw(canvas); |
| 55 | 55 |
| 56 int temp = fDebugCanvas->getOutstandingSaveCount(); | 56 int temp = fDebugCanvas->getOutstandingSaveCount(); |
| 57 for (int i = 0; i < temp; ++i) { | 57 for (int i = 0; i < temp; ++i) { |
| 58 canvas->restore(); | 58 canvas->restore(); |
| 59 } | 59 } |
| 60 | 60 |
| 61 fDebugCanvas->setMegaVizMode(vizMode); | 61 fDebugCanvas->setMegaVizMode(vizMode); |
| 62 fDebugCanvas->setOverdrawViz(overDraw); | 62 fDebugCanvas->setOverdrawViz(overDraw); |
| 63 fDebugCanvas->setOutstandingSaveCount(saveCount); | 63 fDebugCanvas->setOutstandingSaveCount(saveCount); |
| 64 | 64 |
| 65 newPicture->endRecording(); | 65 return recorder.endRecording(); |
| 66 return newPicture; | |
| 67 } | 66 } |
| 68 | 67 |
| 69 void SkDebugger::getOverviewText(const SkTDArray<double>* typeTimes, | 68 void SkDebugger::getOverviewText(const SkTDArray<double>* typeTimes, |
| 70 double totTime, | 69 double totTime, |
| 71 SkString* overview, | 70 SkString* overview, |
| 72 int numRuns) { | 71 int numRuns) { |
| 73 const SkTDArray<SkDrawCommand*>& commands = this->getDrawCommands(); | 72 const SkTDArray<SkDrawCommand*>& commands = this->getDrawCommands(); |
| 74 | 73 |
| 75 SkTDArray<int> counts; | 74 SkTDArray<int> counts; |
| 76 counts.setCount(LAST_DRAWTYPE_ENUM+1); | 75 counts.setCount(LAST_DRAWTYPE_ENUM+1); |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 overview->insert(0, totalStr); | 140 overview->insert(0, totalStr); |
| 142 | 141 |
| 143 overview->append("<br/>"); | 142 overview->append("<br/>"); |
| 144 overview->append("SkPicture Width: "); | 143 overview->append("SkPicture Width: "); |
| 145 overview->appendS32(pictureWidth()); | 144 overview->appendS32(pictureWidth()); |
| 146 overview->append("px<br/>"); | 145 overview->append("px<br/>"); |
| 147 overview->append("SkPicture Height: "); | 146 overview->append("SkPicture Height: "); |
| 148 overview->appendS32(pictureHeight()); | 147 overview->appendS32(pictureHeight()); |
| 149 overview->append("px"); | 148 overview->append("px"); |
| 150 } | 149 } |
| OLD | NEW |