Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(569)

Side by Side Diff: debugger/QT/SkDebuggerGUI.cpp

Issue 787143004: debugger: Make draw command image widget resize (Closed) Base URL: https://skia.googlesource.com/skia.git@debugger-resize-01-settings-layout
Patch Set: address review comments Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « debugger/QT/SkDebuggerGUI.h ('k') | debugger/QT/SkDrawCommandGeometryWidget.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2012 Google Inc. 2 * Copyright 2012 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "SkDebuggerGUI.h" 8 #include "SkDebuggerGUI.h"
9 #include "SkForceLinking.h" 9 #include "SkForceLinking.h"
10 #include "SkGraphics.h" 10 #include "SkGraphics.h"
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 , fActionSaveAs(this) 54 , fActionSaveAs(this)
55 , fActionShowDeletes(this) 55 , fActionShowDeletes(this)
56 , fActionStepBack(this) 56 , fActionStepBack(this)
57 , fActionStepForward(this) 57 , fActionStepForward(this)
58 , fActionZoomIn(this) 58 , fActionZoomIn(this)
59 , fActionZoomOut(this) 59 , fActionZoomOut(this)
60 , fMapper(this) 60 , fMapper(this)
61 , fListWidget(&fCentralSplitter) 61 , fListWidget(&fCentralSplitter)
62 , fDirectoryWidget(&fCentralSplitter) 62 , fDirectoryWidget(&fCentralSplitter)
63 , fCanvasWidget(this, &fDebugger) 63 , fCanvasWidget(this, &fDebugger)
64 , fImageWidget(&fDebugger) 64 , fDrawCommandGeometryWidget(&fDebugger)
65 , fMenuBar(this) 65 , fMenuBar(this)
66 , fMenuFile(this) 66 , fMenuFile(this)
67 , fMenuNavigate(this) 67 , fMenuNavigate(this)
68 , fMenuView(this) 68 , fMenuView(this)
69 , fBreakpointsActivated(false) 69 , fBreakpointsActivated(false)
70 , fIndexStyleToggle(false) 70 , fIndexStyleToggle(false)
71 , fDeletesActivated(false) 71 , fDeletesActivated(false)
72 , fPause(false) 72 , fPause(false)
73 , fLoading(false) 73 , fLoading(false)
74 { 74 {
(...skipping 25 matching lines...) Expand all
100 connect(&fSettingsWidget, SIGNAL(rasterSettingsChanged()), this, SLOT(action RasterSettingsChanged())); 100 connect(&fSettingsWidget, SIGNAL(rasterSettingsChanged()), this, SLOT(action RasterSettingsChanged()));
101 connect(&fSettingsWidget, SIGNAL(visualizationsChanged()), this, SLOT(action VisualizationsChanged())); 101 connect(&fSettingsWidget, SIGNAL(visualizationsChanged()), this, SLOT(action VisualizationsChanged()));
102 connect(&fSettingsWidget, SIGNAL(texFilterSettingsChanged()), this, SLOT(act ionTextureFilter())); 102 connect(&fSettingsWidget, SIGNAL(texFilterSettingsChanged()), this, SLOT(act ionTextureFilter()));
103 connect(&fActionPause, SIGNAL(toggled(bool)), this, SLOT(pauseDrawing(bool)) ); 103 connect(&fActionPause, SIGNAL(toggled(bool)), this, SLOT(pauseDrawing(bool)) );
104 connect(&fActionCreateBreakpoint, SIGNAL(activated()), this, SLOT(toggleBrea kpoint())); 104 connect(&fActionCreateBreakpoint, SIGNAL(activated()), this, SLOT(toggleBrea kpoint()));
105 connect(&fActionShowDeletes, SIGNAL(triggered()), this, SLOT(showDeletes())) ; 105 connect(&fActionShowDeletes, SIGNAL(triggered()), this, SLOT(showDeletes())) ;
106 connect(&fCanvasWidget, SIGNAL(hitChanged(int)), this, SLOT(selectCommand(in t))); 106 connect(&fCanvasWidget, SIGNAL(hitChanged(int)), this, SLOT(selectCommand(in t)));
107 connect(&fCanvasWidget, SIGNAL(hitChanged(int)), this, SLOT(updateHit(int))) ; 107 connect(&fCanvasWidget, SIGNAL(hitChanged(int)), this, SLOT(updateHit(int))) ;
108 connect(&fCanvasWidget, SIGNAL(scaleFactorChanged(float)), this, SLOT(action Scale(float))); 108 connect(&fCanvasWidget, SIGNAL(scaleFactorChanged(float)), this, SLOT(action Scale(float)));
109 connect(&fCanvasWidget, SIGNAL(commandChanged(int)), this, SLOT(updateComman d(int))); 109 connect(&fCanvasWidget, SIGNAL(commandChanged(int)), this, SLOT(updateComman d(int)));
110 connect(&fCanvasWidget, SIGNAL(commandChanged(int)), &fDrawCommandGeometryWi dget, SLOT(updateImage()));
111
110 connect(&fActionSaveAs, SIGNAL(triggered()), this, SLOT(actionSaveAs())); 112 connect(&fActionSaveAs, SIGNAL(triggered()), this, SLOT(actionSaveAs()));
111 connect(&fActionSave, SIGNAL(triggered()), this, SLOT(actionSave())); 113 connect(&fActionSave, SIGNAL(triggered()), this, SLOT(actionSave()));
112 114
113 fMapper.setMapping(&fActionZoomIn, SkCanvasWidget::kIn_ZoomCommand); 115 fMapper.setMapping(&fActionZoomIn, SkCanvasWidget::kIn_ZoomCommand);
114 fMapper.setMapping(&fActionZoomOut, SkCanvasWidget::kOut_ZoomCommand); 116 fMapper.setMapping(&fActionZoomOut, SkCanvasWidget::kOut_ZoomCommand);
115 117
116 connect(&fActionZoomIn, SIGNAL(triggered()), &fMapper, SLOT(map())); 118 connect(&fActionZoomIn, SIGNAL(triggered()), &fMapper, SLOT(map()));
117 connect(&fActionZoomOut, SIGNAL(triggered()), &fMapper, SLOT(map())); 119 connect(&fActionZoomOut, SIGNAL(triggered()), &fMapper, SLOT(map()));
118 connect(&fMapper, SIGNAL(mapped(int)), &fCanvasWidget, SLOT(zoom(int))); 120 connect(&fMapper, SIGNAL(mapped(int)), &fCanvasWidget, SLOT(zoom(int)));
119 121
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 227
226 void SkDebuggerGUI::actionClearDeletes() { 228 void SkDebuggerGUI::actionClearDeletes() {
227 for (int row = 0; row < fListWidget.count(); row++) { 229 for (int row = 0; row < fListWidget.count(); row++) {
228 QListWidgetItem* item = fListWidget.item(row); 230 QListWidgetItem* item = fListWidget.item(row);
229 item->setData(Qt::UserRole + 2, QPixmap(":/blank.png")); 231 item->setData(Qt::UserRole + 2, QPixmap(":/blank.png"));
230 fDebugger.setCommandVisible(row, true); 232 fDebugger.setCommandVisible(row, true);
231 fSkipCommands[row] = false; 233 fSkipCommands[row] = false;
232 } 234 }
233 if (fPause) { 235 if (fPause) {
234 fCanvasWidget.drawTo(fPausedRow); 236 fCanvasWidget.drawTo(fPausedRow);
235 fImageWidget.draw();
236 } else { 237 } else {
237 fCanvasWidget.drawTo(fListWidget.currentRow()); 238 fCanvasWidget.drawTo(fListWidget.currentRow());
238 fImageWidget.draw();
239 } 239 }
240 } 240 }
241 241
242 void SkDebuggerGUI::actionClose() { 242 void SkDebuggerGUI::actionClose() {
243 this->close(); 243 this->close();
244 } 244 }
245 245
246 void SkDebuggerGUI::actionDelete() { 246 void SkDebuggerGUI::actionDelete() {
247 247
248 for (int row = 0; row < fListWidget.count(); ++row) { 248 for (int row = 0; row < fListWidget.count(); ++row) {
(...skipping 11 matching lines...) Expand all
260 item->setData(Qt::UserRole + 2, QPixmap(":/blank.png")); 260 item->setData(Qt::UserRole + 2, QPixmap(":/blank.png"));
261 fDebugger.setCommandVisible(row, true); 261 fDebugger.setCommandVisible(row, true);
262 fSkipCommands[row] = false; 262 fSkipCommands[row] = false;
263 } 263 }
264 } 264 }
265 265
266 int currentRow = fListWidget.currentRow(); 266 int currentRow = fListWidget.currentRow();
267 267
268 if (fPause) { 268 if (fPause) {
269 fCanvasWidget.drawTo(fPausedRow); 269 fCanvasWidget.drawTo(fPausedRow);
270 fImageWidget.draw();
271 } else { 270 } else {
272 fCanvasWidget.drawTo(currentRow); 271 fCanvasWidget.drawTo(currentRow);
273 fImageWidget.draw();
274 } 272 }
275 } 273 }
276 274
277 #if SK_SUPPORT_GPU 275 #if SK_SUPPORT_GPU
278 void SkDebuggerGUI::actionGLSettingsChanged() { 276 void SkDebuggerGUI::actionGLSettingsChanged() {
279 bool isToggled = fSettingsWidget.isGLActive(); 277 bool isToggled = fSettingsWidget.isGLActive();
280 if (isToggled) { 278 if (isToggled) {
281 fCanvasWidget.setGLSampleCount(fSettingsWidget.getGLSampleCount()); 279 fCanvasWidget.setGLSampleCount(fSettingsWidget.getGLSampleCount());
282 } 280 }
283 fCanvasWidget.setWidgetVisibility(SkCanvasWidget::kGPU_WidgetType, !isToggle d); 281 fCanvasWidget.setWidgetVisibility(SkCanvasWidget::kGPU_WidgetType, !isToggle d);
284 } 282 }
285 #endif 283 #endif
286 284
287 void SkDebuggerGUI::actionInspector() { 285 void SkDebuggerGUI::actionInspector() {
288 bool newState = !fInspectorWidget.isHidden(); 286 bool newState = !fInspectorWidget.isHidden();
289 287
290 fInspectorWidget.setHidden(newState); 288 fInspectorWidget.setHidden(newState);
291 fViewStateFrame.setHidden(newState); 289 fViewStateFrame.setHidden(newState);
292 fImageWidget.setHidden(newState); 290 fDrawCommandGeometryWidget.setHidden(newState);
293 } 291 }
294 292
295 void SkDebuggerGUI::actionPlay() { 293 void SkDebuggerGUI::actionPlay() {
296 for (int row = fListWidget.currentRow() + 1; row < fListWidget.count(); 294 for (int row = fListWidget.currentRow() + 1; row < fListWidget.count();
297 row++) { 295 row++) {
298 QListWidgetItem *item = fListWidget.item(row); 296 QListWidgetItem *item = fListWidget.item(row);
299 if (item->checkState() == Qt::Checked) { 297 if (item->checkState() == Qt::Checked) {
300 fListWidget.setCurrentItem(item); 298 fListWidget.setCurrentItem(item);
301 return; 299 return;
302 } 300 }
303 } 301 }
304 fListWidget.setCurrentRow(fListWidget.count() - 1); 302 fListWidget.setCurrentRow(fListWidget.count() - 1);
305 } 303 }
306 304
307 void SkDebuggerGUI::actionRasterSettingsChanged() { 305 void SkDebuggerGUI::actionRasterSettingsChanged() {
308 fCanvasWidget.setWidgetVisibility(SkCanvasWidget::kRaster_8888_WidgetType, 306 fCanvasWidget.setWidgetVisibility(SkCanvasWidget::kRaster_8888_WidgetType,
309 !fSettingsWidget.isRasterEnabled()); 307 !fSettingsWidget.isRasterEnabled());
310 fDebugger.setOverdrawViz(fSettingsWidget.isOverdrawVizEnabled()); 308 fDebugger.setOverdrawViz(fSettingsWidget.isOverdrawVizEnabled());
311 fCanvasWidget.update(); 309 fCanvasWidget.update();
312 } 310 }
313 311
314 void SkDebuggerGUI::actionVisualizationsChanged() { 312 void SkDebuggerGUI::actionVisualizationsChanged() {
315 fDebugger.setMegaViz(fSettingsWidget.isMegaVizEnabled()); 313 fDebugger.setMegaViz(fSettingsWidget.isMegaVizEnabled());
316 fDebugger.setPathOps(fSettingsWidget.isPathOpsEnabled()); 314 fDebugger.setPathOps(fSettingsWidget.isPathOpsEnabled());
317 fDebugger.highlightCurrentCommand(fSettingsWidget.isVisibilityFilterEnabled( )); 315 fDebugger.highlightCurrentCommand(fSettingsWidget.isVisibilityFilterEnabled( ));
318 fCanvasWidget.drawTo(fListWidget.currentRow()); 316 fCanvasWidget.drawTo(fListWidget.currentRow());
319 fImageWidget.draw();
320 } 317 }
321 318
322 void SkDebuggerGUI::actionTextureFilter() { 319 void SkDebuggerGUI::actionTextureFilter() {
323 SkPaint::FilterLevel level; 320 SkPaint::FilterLevel level;
324 bool enabled = fSettingsWidget.getFilterOverride(&level); 321 bool enabled = fSettingsWidget.getFilterOverride(&level);
325 fDebugger.setTexFilterOverride(enabled, level); 322 fDebugger.setTexFilterOverride(enabled, level);
326 fCanvasWidget.update(); 323 fCanvasWidget.update();
327 } 324 }
328 325
329 void SkDebuggerGUI::actionRewind() { 326 void SkDebuggerGUI::actionRewind() {
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
411 loadPicture(SkString(filename.toAscii().data())); 408 loadPicture(SkString(filename.toAscii().data()));
412 setupDirectoryWidget(pathInfo.path()); 409 setupDirectoryWidget(pathInfo.path());
413 } 410 }
414 fDirectoryWidgetActive = true; 411 fDirectoryWidgetActive = true;
415 } 412 }
416 413
417 void SkDebuggerGUI::pauseDrawing(bool isPaused) { 414 void SkDebuggerGUI::pauseDrawing(bool isPaused) {
418 fPause = isPaused; 415 fPause = isPaused;
419 fPausedRow = fListWidget.currentRow(); 416 fPausedRow = fListWidget.currentRow();
420 fCanvasWidget.drawTo(fPausedRow); 417 fCanvasWidget.drawTo(fPausedRow);
421 fImageWidget.draw();
422 } 418 }
423 419
424 void SkDebuggerGUI::registerListClick(QListWidgetItem *item) { 420 void SkDebuggerGUI::registerListClick(QListWidgetItem *item) {
425 if(!fLoading) { 421 if(!fLoading) {
426 int currentRow = fListWidget.currentRow(); 422 int currentRow = fListWidget.currentRow();
427 423
428 if (currentRow != -1) { 424 if (currentRow != -1) {
429 if (!fPause) { 425 if (!fPause) {
430 fCanvasWidget.drawTo(currentRow); 426 fCanvasWidget.drawTo(currentRow);
431 fImageWidget.draw();
432 } 427 }
433 const SkTDArray<SkString*> *currInfo = fDebugger.getCommandInfo(curr entRow); 428 const SkTDArray<SkString*> *currInfo = fDebugger.getCommandInfo(curr entRow);
434 429
435 /* TODO(chudy): Add command type before parameters. Rename v 430 /* TODO(chudy): Add command type before parameters. Rename v
436 * to something more informative. */ 431 * to something more informative. */
437 if (currInfo) { 432 if (currInfo) {
438 QString info; 433 QString info;
439 info.append("<b>Parameters: </b><br/>"); 434 info.append("<b>Parameters: </b><br/>");
440 for (int i = 0; i < currInfo->count(); i++) { 435 for (int i = 0; i < currInfo->count(); i++) {
441 436
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
605 fListWidget.setMinimumWidth(250); 600 fListWidget.setMinimumWidth(250);
606 601
607 fFilter.addItem("--Filter By Available Commands--"); 602 fFilter.addItem("--Filter By Available Commands--");
608 603
609 fDirectoryWidget.setMinimumWidth(250); 604 fDirectoryWidget.setMinimumWidth(250);
610 fDirectoryWidget.setStyleSheet("QListWidget::Item {padding: 5px;}"); 605 fDirectoryWidget.setStyleSheet("QListWidget::Item {padding: 5px;}");
611 606
612 fCanvasWidget.setSizePolicy(QSizePolicy::Expanding, 607 fCanvasWidget.setSizePolicy(QSizePolicy::Expanding,
613 QSizePolicy::Expanding); 608 QSizePolicy::Expanding);
614 609
615 fImageWidget.setFixedSize(SkImageWidget::kImageWidgetWidth, 610 fDrawCommandGeometryWidget.setSizePolicy(QSizePolicy::Expanding, QSizePolicy ::Expanding);
616 SkImageWidget::kImageWidgetHeight);
617 611
618 fInspectorWidget.setSizePolicy(QSizePolicy::Expanding, 612 fInspectorWidget.setSizePolicy(QSizePolicy::Expanding,
619 QSizePolicy::Expanding); 613 QSizePolicy::Expanding);
620 fInspectorWidget.setMaximumHeight(300); 614 fInspectorWidget.setMaximumHeight(300);
621 615
622 fSettingsAndImageLayout.addWidget(&fSettingsWidget); 616 fSettingsAndImageLayout.addWidget(&fSettingsWidget);
623 617
624 // View state group, part of inspector. 618 // View state group, part of inspector.
625 fViewStateFrame.setFrameStyle(QFrame::Panel); 619 fViewStateFrame.setFrameStyle(QFrame::Panel);
626 fViewStateFrame.setLayout(&fViewStateFrameLayout); 620 fViewStateFrame.setLayout(&fViewStateFrameLayout);
627 fViewStateFrameLayout.addWidget(&fViewStateGroup); 621 fViewStateFrameLayout.addWidget(&fViewStateGroup);
622 fViewStateGroup.setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Expanding );
628 fViewStateGroup.setTitle("View"); 623 fViewStateGroup.setTitle("View");
629 fViewStateLayout.addRow("Zoom Level", &fZoomBox); 624 fViewStateLayout.addRow("Zoom Level", &fZoomBox);
630 fZoomBox.setText("100%"); 625 fZoomBox.setText("100%");
631 fZoomBox.setMinimumSize(QSize(50,25)); 626 fZoomBox.setMinimumSize(QSize(50,25));
632 fZoomBox.setMaximumSize(QSize(50,25)); 627 fZoomBox.setMaximumSize(QSize(50,25));
633 fZoomBox.setAlignment(Qt::AlignRight); 628 fZoomBox.setAlignment(Qt::AlignRight);
634 fZoomBox.setReadOnly(true); 629 fZoomBox.setReadOnly(true);
635 fViewStateLayout.addRow("Command HitBox", &fCommandHitBox); 630 fViewStateLayout.addRow("Command HitBox", &fCommandHitBox);
636 fCommandHitBox.setText("0"); 631 fCommandHitBox.setText("0");
637 fCommandHitBox.setMinimumSize(QSize(50,25)); 632 fCommandHitBox.setMinimumSize(QSize(50,25));
638 fCommandHitBox.setMaximumSize(QSize(50,25)); 633 fCommandHitBox.setMaximumSize(QSize(50,25));
639 fCommandHitBox.setAlignment(Qt::AlignRight); 634 fCommandHitBox.setAlignment(Qt::AlignRight);
640 fCommandHitBox.setReadOnly(true); 635 fCommandHitBox.setReadOnly(true);
641 fViewStateLayout.addRow("Current Command", &fCurrentCommandBox); 636 fViewStateLayout.addRow("Current Command", &fCurrentCommandBox);
642 fCurrentCommandBox.setText("0"); 637 fCurrentCommandBox.setText("0");
643 fCurrentCommandBox.setMinimumSize(QSize(50,25)); 638 fCurrentCommandBox.setMinimumSize(QSize(50,25));
644 fCurrentCommandBox.setMaximumSize(QSize(50,25)); 639 fCurrentCommandBox.setMaximumSize(QSize(50,25));
645 fCurrentCommandBox.setAlignment(Qt::AlignRight); 640 fCurrentCommandBox.setAlignment(Qt::AlignRight);
646 fCurrentCommandBox.setReadOnly(true); 641 fCurrentCommandBox.setReadOnly(true);
647 fViewStateGroup.setLayout(&fViewStateLayout); 642 fViewStateGroup.setLayout(&fViewStateLayout);
648 fSettingsAndImageLayout.addWidget(&fViewStateFrame); 643 fSettingsAndImageLayout.addWidget(&fViewStateFrame);
649 644
650 fSettingsAndImageLayout.addWidget(&fImageWidget); 645 fDrawCommandGeometryWidget.setToolTip("Current Command Geometry");
646 fSettingsAndImageLayout.addWidget(&fDrawCommandGeometryWidget);
651 647
652 fLeftColumnSplitter.addWidget(&fListWidget); 648 fLeftColumnSplitter.addWidget(&fListWidget);
653 fLeftColumnSplitter.addWidget(&fDirectoryWidget); 649 fLeftColumnSplitter.addWidget(&fDirectoryWidget);
654 fLeftColumnSplitter.setOrientation(Qt::Vertical); 650 fLeftColumnSplitter.setOrientation(Qt::Vertical);
655 651
656 fCanvasSettingsAndImageLayout.setSpacing(6); 652 fCanvasSettingsAndImageLayout.setSpacing(6);
657 fCanvasSettingsAndImageLayout.addWidget(&fCanvasWidget, 1); 653 fCanvasSettingsAndImageLayout.addWidget(&fCanvasWidget, 1);
658 fCanvasSettingsAndImageLayout.addLayout(&fSettingsAndImageLayout, 0); 654 fCanvasSettingsAndImageLayout.addLayout(&fSettingsAndImageLayout, 0);
659 655
660 fMainAndRightColumnLayout.setSpacing(6); 656 fMainAndRightColumnLayout.setSpacing(6);
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
879 } 875 }
880 876
881 void SkDebuggerGUI::updateCommand(int newCommand) { 877 void SkDebuggerGUI::updateCommand(int newCommand) {
882 fCurrentCommandBox.setText(QString::number(newCommand)); 878 fCurrentCommandBox.setText(QString::number(newCommand));
883 } 879 }
884 880
885 void SkDebuggerGUI::updateHit(int newHit) { 881 void SkDebuggerGUI::updateHit(int newHit) {
886 fCommandHitBox.setText(QString::number(newHit)); 882 fCommandHitBox.setText(QString::number(newHit));
887 } 883 }
888 884
OLDNEW
« no previous file with comments | « debugger/QT/SkDebuggerGUI.h ('k') | debugger/QT/SkDrawCommandGeometryWidget.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698