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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 for (int i = 0; i < LAST_DRAWTYPE_ENUM+1; ++i) { | 91 for (int i = 0; i < LAST_DRAWTYPE_ENUM+1; ++i) { |
92 if (0 == counts[i]) { | 92 if (0 == counts[i]) { |
93 // if there were no commands of this type then they should've consum
ed no time | 93 // if there were no commands of this type then they should've consum
ed no time |
94 SkASSERT(NULL == typeTimes || 0.0 == (*typeTimes)[i]); | 94 SkASSERT(NULL == typeTimes || 0.0 == (*typeTimes)[i]); |
95 continue; | 95 continue; |
96 } | 96 } |
97 | 97 |
98 overview->append(SkDrawCommand::GetCommandString((DrawType) i)); | 98 overview->append(SkDrawCommand::GetCommandString((DrawType) i)); |
99 overview->append(": "); | 99 overview->append(": "); |
100 overview->appendS32(counts[i]); | 100 overview->appendS32(counts[i]); |
101 if (NULL != typeTimes && totTime >= 0.0) { | 101 if (typeTimes && totTime >= 0.0) { |
102 overview->append(" - "); | 102 overview->append(" - "); |
103 overview->appendf("%.2f", (*typeTimes)[i]/(float)numRuns); | 103 overview->appendf("%.2f", (*typeTimes)[i]/(float)numRuns); |
104 overview->append("ms"); | 104 overview->append("ms"); |
105 overview->append(" - "); | 105 overview->append(" - "); |
106 double percent = 100.0*(*typeTimes)[i]/totTime; | 106 double percent = 100.0*(*typeTimes)[i]/totTime; |
107 overview->appendf("%.2f", percent); | 107 overview->appendf("%.2f", percent); |
108 overview->append("%"); | 108 overview->append("%"); |
109 #ifdef SK_DEBUG | 109 #ifdef SK_DEBUG |
110 totPercent += percent; | 110 totPercent += percent; |
111 tempSum += (*typeTimes)[i]; | 111 tempSum += (*typeTimes)[i]; |
112 #endif | 112 #endif |
113 } | 113 } |
114 overview->append("<br/>"); | 114 overview->append("<br/>"); |
115 total += counts[i]; | 115 total += counts[i]; |
116 } | 116 } |
117 #ifdef SK_DEBUG | 117 #ifdef SK_DEBUG |
118 if (NULL != typeTimes) { | 118 if (typeTimes) { |
119 SkASSERT(SkScalarNearlyEqual(SkDoubleToScalar(totPercent), | 119 SkASSERT(SkScalarNearlyEqual(SkDoubleToScalar(totPercent), |
120 SkDoubleToScalar(100.0))); | 120 SkDoubleToScalar(100.0))); |
121 SkASSERT(SkScalarNearlyEqual(SkDoubleToScalar(tempSum), | 121 SkASSERT(SkScalarNearlyEqual(SkDoubleToScalar(tempSum), |
122 SkDoubleToScalar(totTime))); | 122 SkDoubleToScalar(totTime))); |
123 } | 123 } |
124 #endif | 124 #endif |
125 | 125 |
126 if (totTime > 0.0) { | 126 if (totTime > 0.0) { |
127 overview->append("Total Time: "); | 127 overview->append("Total Time: "); |
128 overview->appendf("%.2f", totTime/(float)numRuns); | 128 overview->appendf("%.2f", totTime/(float)numRuns); |
(...skipping 19 matching lines...) Expand all Loading... |
148 overview->append(" R: "); | 148 overview->append(" R: "); |
149 overview->appendScalar(this->pictureCull().fRight); | 149 overview->appendScalar(this->pictureCull().fRight); |
150 overview->append(" B: "); | 150 overview->append(" B: "); |
151 overview->appendScalar(this->pictureCull().fBottom); | 151 overview->appendScalar(this->pictureCull().fBottom); |
152 overview->append("<br/>"); | 152 overview->append("<br/>"); |
153 } | 153 } |
154 | 154 |
155 void SkDebugger::getClipStackText(SkString* clipStack) { | 155 void SkDebugger::getClipStackText(SkString* clipStack) { |
156 clipStack->set(fDebugCanvas->clipStackData()); | 156 clipStack->set(fDebugCanvas->clipStackData()); |
157 } | 157 } |
OLD | NEW |