From 2a67e123a3e559774a16a58cbe5106bc0fb86740 Mon Sep 17 00:00:00 2001 From: "commit-bot@chromium.org" Date: Mon, 19 May 2014 13:53:10 +0000 Subject: This adds a checkbox to the debugger to allow seeing the effect pathops has on the clip. A new tab shows the C code that the pathops generate. Once in place, this CL found a bug in the pathops code where it was not handling empty clip stack elements correctly. The Cl also has the change to SkCanvas to fix this bug. R=robertphillips@google.com, reed@google.com Author: caryclark@google.com Review URL: https://codereview.chromium.org/282283002 git-svn-id: http://skia.googlecode.com/svn/trunk@14774 2bbb7eff-a529-9590-31e7-b0007b416f81 --- debugger/QT/SkDebuggerGUI.cpp | 14 ++++++++++++++ debugger/QT/SkDebuggerGUI.h | 10 ++++++++++ debugger/QT/SkInspectorWidget.cpp | 1 + debugger/QT/SkInspectorWidget.h | 1 + debugger/QT/SkSettingsWidget.cpp | 6 ++++++ debugger/QT/SkSettingsWidget.h | 6 ++++++ debugger/SkDebugger.cpp | 8 ++++++++ debugger/SkDebugger.h | 8 ++++++++ 8 files changed, 54 insertions(+) (limited to 'debugger') diff --git a/debugger/QT/SkDebuggerGUI.cpp b/debugger/QT/SkDebuggerGUI.cpp index 01d165a3d3..0f816eec7c 100644 --- a/debugger/QT/SkDebuggerGUI.cpp +++ b/debugger/QT/SkDebuggerGUI.cpp @@ -101,6 +101,7 @@ SkDebuggerGUI::SkDebuggerGUI(QWidget *parent) : connect(fSettingsWidget.getRasterCheckBox(), SIGNAL(toggled(bool)), this, SLOT(actionRasterWidget(bool))); connect(fSettingsWidget.getOverdrawVizCheckBox(), SIGNAL(toggled(bool)), this, SLOT(actionOverdrawVizWidget(bool))); connect(fSettingsWidget.getMegaVizCheckBox(), SIGNAL(toggled(bool)), this, SLOT(actionMegaVizWidget(bool))); + connect(fSettingsWidget.getPathOpsCheckBox(), SIGNAL(toggled(bool)), this, SLOT(actionPathOpsWidget(bool))); connect(&fActionPause, SIGNAL(toggled(bool)), this, SLOT(pauseDrawing(bool))); connect(&fActionCreateBreakpoint, SIGNAL(activated()), this, SLOT(toggleBreakpoint())); connect(&fActionShowDeletes, SIGNAL(triggered()), this, SLOT(showDeletes())); @@ -415,6 +416,7 @@ void SkDebuggerGUI::actionProfile() { } setupOverviewText(picture->typeTimes(), picture->totTime(), kNumRepeats); + setupClipStackText(); } void SkDebuggerGUI::actionCancel() { @@ -535,6 +537,11 @@ void SkDebuggerGUI::actionMegaVizWidget(bool isToggled) { fCanvasWidget.update(); } +void SkDebuggerGUI::actionPathOpsWidget(bool isToggled) { + fDebugger.setPathOps(isToggled); + fCanvasWidget.update(); +} + void SkDebuggerGUI::actionTextureFilter() { SkPaint::FilterLevel level; bool enabled = fSettingsWidget.getFilterOverride(&level); @@ -662,6 +669,7 @@ void SkDebuggerGUI::registerListClick(QListWidgetItem *item) { fInspectorWidget.setText(info, SkInspectorWidget::kDetail_TabType); fInspectorWidget.setDisabled(false); } + setupClipStackText(); } } @@ -1043,6 +1051,12 @@ void SkDebuggerGUI::setupOverviewText(const SkTDArray* typeTimes, fInspectorWidget.setText(overview.c_str(), SkInspectorWidget::kOverview_TabType); } +void SkDebuggerGUI::setupClipStackText() { + SkString clipStack; + fDebugger.getClipStackText(&clipStack); + fInspectorWidget.setText(clipStack.c_str(), SkInspectorWidget::kClipStack_TabType); +} + void SkDebuggerGUI::setupComboBox(SkTArray* command) { fFilter.clear(); fFilter.addItem("--Filter By Available Commands--"); diff --git a/debugger/QT/SkDebuggerGUI.h b/debugger/QT/SkDebuggerGUI.h index 41c5e242e2..a137ee7cfb 100644 --- a/debugger/QT/SkDebuggerGUI.h +++ b/debugger/QT/SkDebuggerGUI.h @@ -151,6 +151,11 @@ private slots: */ void actionMegaVizWidget(bool isToggled); + /** + Toggles using path ops to simplify the clip stack + */ + void actionPathOpsWidget(bool ); + /** Applies the new texture filter override */ @@ -343,6 +348,11 @@ private: */ void setupOverviewText(const SkTDArray* typeTimes, double totTime, int numRuns); + /** + Fills in the clip stack pane with text + */ + void setupClipStackText(); + /** Render the supplied picture several times tracking the time consumed by each command. diff --git a/debugger/QT/SkInspectorWidget.cpp b/debugger/QT/SkInspectorWidget.cpp index 6cf121241a..6bcac1db35 100644 --- a/debugger/QT/SkInspectorWidget.cpp +++ b/debugger/QT/SkInspectorWidget.cpp @@ -23,6 +23,7 @@ SkInspectorWidget::SkInspectorWidget() : QWidget() QString tabNames[kTotalTabCount]; tabNames[kOverview_TabType] = "Overview"; tabNames[kDetail_TabType] = "Details"; + tabNames[kClipStack_TabType] = "Clip Stack"; for (int i = 0; i < kTotalTabCount; i++) { fTabTexts[i].setReadOnly(true); diff --git a/debugger/QT/SkInspectorWidget.h b/debugger/QT/SkInspectorWidget.h index 1b962356f7..96a6da38e1 100644 --- a/debugger/QT/SkInspectorWidget.h +++ b/debugger/QT/SkInspectorWidget.h @@ -31,6 +31,7 @@ public: enum TabType { kOverview_TabType, kDetail_TabType, + kClipStack_TabType, kTotalTabCount, }; diff --git a/debugger/QT/SkSettingsWidget.cpp b/debugger/QT/SkSettingsWidget.cpp index 29026cf07c..dc9dc6e45c 100644 --- a/debugger/QT/SkSettingsWidget.cpp +++ b/debugger/QT/SkSettingsWidget.cpp @@ -56,6 +56,10 @@ SkSettingsWidget::SkSettingsWidget() : QWidget() fRasterLabel.setMinimumWidth(178); fRasterLabel.setMaximumWidth(178); + fPathOpsLabel.setText("PathOps: "); + fPathOpsLabel.setMinimumWidth(178); + fPathOpsLabel.setMaximumWidth(178); + fRasterCheckBox.setChecked(true); fOverdrawVizLabel.setText(" Overdraw Viz: "); @@ -112,6 +116,8 @@ SkSettingsWidget::SkSettingsWidget() : QWidget() fRasterLayout.addWidget(&fRasterLabel); fRasterLayout.addWidget(&fRasterCheckBox); + fRasterLayout.addWidget(&fPathOpsLabel); + fRasterLayout.addWidget(&fPathOpsCheckBox); fVizLayout.addWidget(&fOverdrawVizLabel); fVizLayout.addWidget(&fOverdrawVizCheckBox); diff --git a/debugger/QT/SkSettingsWidget.h b/debugger/QT/SkSettingsWidget.h index 660da77cfd..f35df94010 100644 --- a/debugger/QT/SkSettingsWidget.h +++ b/debugger/QT/SkSettingsWidget.h @@ -74,6 +74,10 @@ public: return &fMegaVizCheckBox; } + QCheckBox* getPathOpsCheckBox() { + return &fPathOpsCheckBox; + } + private slots: void updateCommand(int newCommand); void updateHit(int newHit); @@ -122,6 +126,8 @@ private: QCheckBox fOverdrawVizCheckBox; QLabel fMegaVizLabel; QCheckBox fMegaVizCheckBox; + QLabel fPathOpsLabel; + QCheckBox fPathOpsCheckBox; #if SK_SUPPORT_GPU QHBoxLayout fGLLayout; diff --git a/debugger/SkDebugger.cpp b/debugger/SkDebugger.cpp index f4730d61b5..394c0ad7c8 100644 --- a/debugger/SkDebugger.cpp +++ b/debugger/SkDebugger.cpp @@ -49,6 +49,8 @@ SkPicture* SkDebugger::copyPicture() { fDebugCanvas->setMegaVizMode(false); bool overDraw = fDebugCanvas->getOverdrawViz(); fDebugCanvas->setOverdrawViz(false); + bool pathOps = fDebugCanvas->getAllowSimplifyClip(); + fDebugCanvas->setAllowSimplifyClip(false); int saveCount = fDebugCanvas->getOutstandingSaveCount(); fDebugCanvas->setOutstandingSaveCount(0); @@ -62,6 +64,7 @@ SkPicture* SkDebugger::copyPicture() { fDebugCanvas->setMegaVizMode(vizMode); fDebugCanvas->setOverdrawViz(overDraw); fDebugCanvas->setOutstandingSaveCount(saveCount); + fDebugCanvas->setAllowSimplifyClip(pathOps); return recorder.endRecording(); } @@ -148,3 +151,8 @@ void SkDebugger::getOverviewText(const SkTDArray* typeTimes, overview->appendS32(pictureHeight()); overview->append("px"); } + +void SkDebugger::getClipStackText(SkString* clipStack) { + clipStack->set(fDebugCanvas->clipStackData()); +} + diff --git a/debugger/SkDebugger.h b/debugger/SkDebugger.h index 94300d8365..ffb2953272 100644 --- a/debugger/SkDebugger.h +++ b/debugger/SkDebugger.h @@ -111,6 +111,12 @@ public: } } + void setPathOps(bool pathOps) { + if (NULL != fDebugCanvas) { + fDebugCanvas->setAllowSimplifyClip(pathOps); + } + } + void setMegaViz(bool megaViz) { if (NULL != fDebugCanvas) { fDebugCanvas->setMegaVizMode(megaViz); @@ -126,6 +132,8 @@ public: void getOverviewText(const SkTDArray* typeTimes, double totTime, SkString* overview, int numRuns); + void getClipStackText(SkString* clipStack); + private: SkDebugCanvas* fDebugCanvas; SkPicture* fPicture; -- cgit v1.2.3