| 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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 return recorder.endRecording(); | 59 return recorder.endRecording(); |
| 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(LAST_DRAWTYPE_ENUM+1); | 69 counts.setCount(SkDrawCommand::kOpTypeCount); |
| 70 for (int i = 0; i < LAST_DRAWTYPE_ENUM+1; ++i) { | 70 for (int i = 0; i < SkDrawCommand::kOpTypeCount; ++i) { |
| 71 counts[i] = 0; | 71 counts[i] = 0; |
| 72 } | 72 } |
| 73 | 73 |
| 74 for (int i = 0; i < commands.count(); i++) { | 74 for (int i = 0; i < commands.count(); i++) { |
| 75 counts[commands[i]->getType()]++; | 75 counts[commands[i]->getType()]++; |
| 76 } | 76 } |
| 77 | 77 |
| 78 overview->reset(); | 78 overview->reset(); |
| 79 int total = 0; | 79 int total = 0; |
| 80 #ifdef SK_DEBUG | 80 #ifdef SK_DEBUG |
| 81 double totPercent = 0, tempSum = 0; | 81 double totPercent = 0, tempSum = 0; |
| 82 #endif | 82 #endif |
| 83 for (int i = 0; i < LAST_DRAWTYPE_ENUM+1; ++i) { | 83 for (int i = 0; i < SkDrawCommand::kOpTypeCount; ++i) { |
| 84 if (0 == counts[i]) { | 84 if (0 == counts[i]) { |
| 85 // if there were no commands of this type then they should've consum
ed no time | 85 // if there were no commands of this type then they should've consum
ed no time |
| 86 SkASSERT(NULL == typeTimes || 0.0 == (*typeTimes)[i]); | 86 SkASSERT(NULL == typeTimes || 0.0 == (*typeTimes)[i]); |
| 87 continue; | 87 continue; |
| 88 } | 88 } |
| 89 | 89 |
| 90 overview->append(SkDrawCommand::GetCommandString((DrawType) i)); | 90 overview->append(SkDrawCommand::GetCommandString((SkDrawCommand::OpType)
i)); |
| 91 overview->append(": "); | 91 overview->append(": "); |
| 92 overview->appendS32(counts[i]); | 92 overview->appendS32(counts[i]); |
| 93 if (typeTimes && totTime >= 0.0) { | 93 if (typeTimes && totTime >= 0.0) { |
| 94 overview->append(" - "); | 94 overview->append(" - "); |
| 95 overview->appendf("%.2f", (*typeTimes)[i]/(float)numRuns); | 95 overview->appendf("%.2f", (*typeTimes)[i]/(float)numRuns); |
| 96 overview->append("ms"); | 96 overview->append("ms"); |
| 97 overview->append(" - "); | 97 overview->append(" - "); |
| 98 double percent = 100.0*(*typeTimes)[i]/totTime; | 98 double percent = 100.0*(*typeTimes)[i]/totTime; |
| 99 overview->appendf("%.2f", percent); | 99 overview->appendf("%.2f", percent); |
| 100 overview->append("%"); | 100 overview->append("%"); |
| (...skipping 39 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 |