Fix debugger build errors/warnings
https://codereview.appspot.com/7729045/
git-svn-id: http://skia.googlecode.com/svn/trunk@8105 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/debugger/QT/SkDebuggerGUI.cpp b/debugger/QT/SkDebuggerGUI.cpp
index d3c6fad..3d8efa4 100644
--- a/debugger/QT/SkDebuggerGUI.cpp
+++ b/debugger/QT/SkDebuggerGUI.cpp
@@ -404,7 +404,7 @@
item->setData(Qt::UserRole + 4, 100.0*temp);
}
- setupOverviewText(picture.typeTimes(), picture.totTime());
+ setupOverviewText(picture.typeTimes(), picture.totTime(), kNumRepeats);
}
void SkDebuggerGUI::actionCancel() {
@@ -1032,7 +1032,7 @@
setupListWidget(commands);
setupComboBox(commands);
- setupOverviewText(NULL, 0.0);
+ setupOverviewText(NULL, 0.0, 1);
fInspectorWidget.setDisabled(false);
fSettingsWidget.setDisabled(false);
fMenuEdit.setDisabled(false);
@@ -1070,9 +1070,11 @@
}
}
-void SkDebuggerGUI::setupOverviewText(const SkTDArray<double>* typeTimes, double totTime) {
+void SkDebuggerGUI::setupOverviewText(const SkTDArray<double>* typeTimes,
+ double totTime,
+ int numRuns) {
SkString overview;
- fDebugger.getOverviewText(typeTimes, totTime, &overview);
+ fDebugger.getOverviewText(typeTimes, totTime, &overview, numRuns);
fInspectorWidget.setText(overview.c_str(), SkInspectorWidget::kOverview_TabType);
}
diff --git a/debugger/SkDebugger.cpp b/debugger/SkDebugger.cpp
index 5ed1187..b40e6ec 100644
--- a/debugger/SkDebugger.cpp
+++ b/debugger/SkDebugger.cpp
@@ -48,7 +48,8 @@
void SkDebugger::getOverviewText(const SkTDArray<double>* typeTimes,
double totTime,
- SkString* overview) {
+ SkString* overview,
+ int numRuns) {
const SkTDArray<SkDrawCommand*>& commands = this->getDrawCommands();
SkTDArray<int> counts;
@@ -75,14 +76,14 @@
overview->append(SkDrawCommand::GetCommandString((DrawType) i));
overview->append(": ");
- overview->appendScalar(counts[i]);
+ overview->appendS32(counts[i]);
if (NULL != typeTimes) {
overview->append(" - ");
- overview->appendScalar((*typeTimes)[i]);
+ overview->appendf("%.2f", (*typeTimes)[i]/(float)numRuns);
overview->append("ms");
overview->append(" - ");
double percent = 100.0*(*typeTimes)[i]/totTime;
- overview->appendScalar(percent);
+ overview->appendf("%.2f", percent);
overview->append("%");
#ifdef SK_DEBUG
totPercent += percent;
@@ -94,18 +95,20 @@
}
#ifdef SK_DEBUG
if (NULL != typeTimes) {
- SkASSERT(SkScalarNearlyEqual(totPercent, 100.0));
- SkASSERT(SkScalarNearlyEqual(tempSum, totTime));
+ SkASSERT(SkScalarNearlyEqual(SkDoubleToScalar(totPercent),
+ SkDoubleToScalar(100.0)));
+ SkASSERT(SkScalarNearlyEqual(SkDoubleToScalar(tempSum),
+ SkDoubleToScalar(totTime)));
}
#endif
if (totTime > 0.0) {
overview->append("Total Time: ");
- overview->appendScalar(totTime);
+ overview->appendf("%.2f", totTime/(float)numRuns);
overview->append("ms");
#ifdef SK_DEBUG
overview->append(" ");
- overview->appendScalar(totPercent);
+ overview->appendScalar(SkDoubleToScalar(totPercent));
overview->append("% ");
#endif
overview->append("<br/>");
@@ -113,15 +116,15 @@
SkString totalStr;
totalStr.append("Total Draw Commands: ");
- totalStr.appendScalar(total);
+ totalStr.appendScalar(SkDoubleToScalar(total));
totalStr.append("<br/>");
overview->insert(0, totalStr);
overview->append("<br/>");
overview->append("SkPicture Width: ");
- overview->appendScalar(pictureWidth());
+ overview->appendS32(pictureWidth());
overview->append("px<br/>");
overview->append("SkPicture Height: ");
- overview->appendScalar(pictureHeight());
+ overview->appendS32(pictureHeight());
overview->append("px");
}
diff --git a/debugger/SkDebugger.h b/debugger/SkDebugger.h
index a6ef786..1ca7b68 100644
--- a/debugger/SkDebugger.h
+++ b/debugger/SkDebugger.h
@@ -107,7 +107,8 @@
}
}
- void getOverviewText(const SkTDArray<double>* typeTimes, double totTime, SkString* overview);
+ void getOverviewText(const SkTDArray<double>* typeTimes, double totTime,
+ SkString* overview, int numRuns);
private:
SkDebugCanvas* fDebugCanvas;