diff options
author | 2012-08-03 17:32:05 +0000 | |
---|---|---|
committer | 2012-08-03 17:32:05 +0000 | |
commit | a9e937c7b712b024de108fa963f92d0e70e4a296 (patch) | |
tree | b1b8e8959dc29738c475bc7a50356f87fd62bbc8 /debugger | |
parent | 200c211d34b11a4a988fc2549df3c17ae6875899 (diff) |
Moved the ownership of the current clip and current matrix into the debug canvas as part of the upcoming general refactor to everything living in debug canvas.
Review URL: https://codereview.appspot.com/6447077
git-svn-id: http://skia.googlecode.com/svn/trunk@4950 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'debugger')
-rw-r--r-- | debugger/QT/SkCanvasWidget.cpp | 4 | ||||
-rw-r--r-- | debugger/QT/SkCanvasWidget.h | 6 | ||||
-rw-r--r-- | debugger/QT/SkDebuggerGUI.cpp | 8 | ||||
-rw-r--r-- | debugger/QT/SkDebuggerGUI.h | 5 | ||||
-rw-r--r-- | debugger/QT/SkGLWidget.cpp | 1 | ||||
-rw-r--r-- | debugger/QT/SkGLWidget.h | 4 | ||||
-rw-r--r-- | debugger/QT/SkRasterWidget.cpp | 5 | ||||
-rw-r--r-- | debugger/QT/SkRasterWidget.h | 15 | ||||
-rw-r--r-- | debugger/QT/moc_SkDebuggerGUI.cpp | 50 | ||||
-rw-r--r-- | debugger/QT/moc_SkGLWidget.cpp | 85 | ||||
-rw-r--r-- | debugger/QT/moc_SkRasterWidget.cpp | 85 | ||||
-rw-r--r-- | debugger/SkDebugCanvas.cpp | 3 | ||||
-rw-r--r-- | debugger/SkDebugCanvas.h | 16 | ||||
-rwxr-xr-x | debugger/moc.sh | 2 |
14 files changed, 243 insertions, 46 deletions
diff --git a/debugger/QT/SkCanvasWidget.cpp b/debugger/QT/SkCanvasWidget.cpp index 2ff21b0763..ee9e5dacb8 100644 --- a/debugger/QT/SkCanvasWidget.cpp +++ b/debugger/QT/SkCanvasWidget.cpp @@ -9,7 +9,7 @@ #include "SkCanvasWidget.h" -SkCanvasWidget::SkCanvasWidget() : QWidget() +SkCanvasWidget::SkCanvasWidget(QWidget* parent) : QWidget(parent) , fHorizontalLayout(this) { fHorizontalLayout.setSpacing(6); @@ -30,6 +30,8 @@ SkCanvasWidget::SkCanvasWidget() : QWidget() setWidgetVisibility(kGPU_WidgetType, true); this->setDisabled(true); + connect(&fRasterWidget, SIGNAL(drawComplete()), + this->parentWidget(), SLOT(drawComplete())); } SkCanvasWidget::~SkCanvasWidget() { diff --git a/debugger/QT/SkCanvasWidget.h b/debugger/QT/SkCanvasWidget.h index 2c3424036e..13e4b2733b 100644 --- a/debugger/QT/SkCanvasWidget.h +++ b/debugger/QT/SkCanvasWidget.h @@ -20,7 +20,7 @@ class SkCanvasWidget : public QWidget { Q_OBJECT public: - SkCanvasWidget(); + SkCanvasWidget(QWidget* parent); ~SkCanvasWidget(); @@ -78,11 +78,11 @@ public: } const SkMatrix& getCurrentMatrix() { - return fRasterWidget.getCurrentMatrix(); + return fDebugCanvas->getCurrentMatrix(); } const SkIRect& getCurrentClip() { - return fRasterWidget.getCurrentClip(); + return fDebugCanvas->getCurrentClip(); } void loadPicture(QString filename); diff --git a/debugger/QT/SkDebuggerGUI.cpp b/debugger/QT/SkDebuggerGUI.cpp index 25f2ba9af2..24eeabd30e 100644 --- a/debugger/QT/SkDebuggerGUI.cpp +++ b/debugger/QT/SkDebuggerGUI.cpp @@ -38,6 +38,7 @@ SkDebuggerGUI::SkDebuggerGUI(QWidget *parent) : , fMapper(this) , fListWidget(&fCentralWidget) , fDirectoryWidget(&fCentralWidget) + , fCanvasWidget(this) , fMenuBar(this) , fMenuFile(this) , fMenuNavigate(this) @@ -245,6 +246,11 @@ void SkDebuggerGUI::actionStepForward() { } } +void SkDebuggerGUI::drawComplete() { + fInspectorWidget.setMatrix(fCanvasWidget.getCurrentMatrix()); + fInspectorWidget.setClip(fCanvasWidget.getCurrentClip()); +} + void SkDebuggerGUI::saveToFile(QString filename) { SkFILEWStream file(filename.toAscii()); SkPicture picture; @@ -312,8 +318,6 @@ void SkDebuggerGUI::registerListClick(QListWidgetItem *item) { } fInspectorWidget.setDetailText(info); fInspectorWidget.setDisabled(false); - fInspectorWidget.setMatrix(fCanvasWidget.getCurrentMatrix()); - fInspectorWidget.setClip(fCanvasWidget.getCurrentClip()); } } diff --git a/debugger/QT/SkDebuggerGUI.h b/debugger/QT/SkDebuggerGUI.h index d8b5c74368..b1bbfa78a3 100644 --- a/debugger/QT/SkDebuggerGUI.h +++ b/debugger/QT/SkDebuggerGUI.h @@ -147,6 +147,11 @@ private slots: void actionStepForward(); /** + Called when the canvas is done being drawn to by SkCanvasWidget. + */ + void drawComplete(); + + /** Loads an skpicture selected from the directory. */ void loadFile(QListWidgetItem *item); diff --git a/debugger/QT/SkGLWidget.cpp b/debugger/QT/SkGLWidget.cpp index ff903ad1e1..d3d5389163 100644 --- a/debugger/QT/SkGLWidget.cpp +++ b/debugger/QT/SkGLWidget.cpp @@ -55,6 +55,7 @@ void SkGLWidget::paintGL() { fDebugCanvas->drawTo(fCanvas, fIndex); // TODO(chudy): Implement an optional flush button in Gui. fCanvas->flush(); + emit drawComplete(); } GrPlatformRenderTargetDesc SkGLWidget::getDesc(int w, int h) { diff --git a/debugger/QT/SkGLWidget.h b/debugger/QT/SkGLWidget.h index 76257be3c9..5eeb1cbcad 100644 --- a/debugger/QT/SkGLWidget.h +++ b/debugger/QT/SkGLWidget.h @@ -21,6 +21,7 @@ #include "GrRenderTarget.h" class SkGLWidget : public QGLWidget { +Q_OBJECT public: SkGLWidget(); @@ -46,6 +47,9 @@ public: fScaleFactor = scale; } +signals: + void drawComplete(); + protected: void initializeGL(); void resizeGL(int w, int h); diff --git a/debugger/QT/SkRasterWidget.cpp b/debugger/QT/SkRasterWidget.cpp index 33728d084e..ecb949cc90 100644 --- a/debugger/QT/SkRasterWidget.cpp +++ b/debugger/QT/SkRasterWidget.cpp @@ -40,10 +40,6 @@ void SkRasterWidget::resizeEvent(QResizeEvent* event) { void SkRasterWidget::paintEvent(QPaintEvent* event) { if (fDebugCanvas) { fDebugCanvas->drawTo(fCanvas, fIndex); - // TODO(chudy): Refactor into SkDebugCanvas. - fMatrix = fCanvas->getTotalMatrix(); - fClip = fCanvas->getTotalClip().getBounds(); - QPainter painter(this); QStyleOption opt; opt.init(this); @@ -56,5 +52,6 @@ void SkRasterWidget::paintEvent(QPaintEvent* event) { painter.drawImage(origin, image); painter.end(); + emit drawComplete(); } } diff --git a/debugger/QT/SkRasterWidget.h b/debugger/QT/SkRasterWidget.h index 3fca4f3f90..b0ded020f8 100644 --- a/debugger/QT/SkRasterWidget.h +++ b/debugger/QT/SkRasterWidget.h @@ -18,6 +18,7 @@ #include <QWidget> class SkRasterWidget : public QWidget { + Q_OBJECT public: SkRasterWidget(); @@ -43,14 +44,6 @@ public: return fBitmap.width(); } - const SkMatrix& getCurrentMatrix() { - return fMatrix; - } - - const SkIRect& getCurrentClip() { - return fClip; - } - void setTranslate(SkIPoint transform) { fTransform = transform; } @@ -59,6 +52,9 @@ public: fScaleFactor = scale; } +signals: + void drawComplete(); + protected: void paintEvent(QPaintEvent* event); @@ -70,9 +66,6 @@ private: SkCanvas* fCanvas; SkDevice* fDevice; - SkMatrix fMatrix; - SkIRect fClip; - int fIndex; SkIPoint fTransform; float fScaleFactor; diff --git a/debugger/QT/moc_SkDebuggerGUI.cpp b/debugger/QT/moc_SkDebuggerGUI.cpp index 0d207aaca5..b78b39aeaf 100644 --- a/debugger/QT/moc_SkDebuggerGUI.cpp +++ b/debugger/QT/moc_SkDebuggerGUI.cpp @@ -1,7 +1,7 @@ /**************************************************************************** ** Meta object code from reading C++ file 'SkDebuggerGUI.h' ** -** Created: Thu Jul 26 16:33:10 2012 +** Created: Wed Aug 1 14:54:26 2012 ** by: The Qt Meta Object Compiler version 62 (Qt 4.6.2) ** ** WARNING! All changes made in this file will be lost! @@ -23,7 +23,7 @@ static const uint qt_meta_data_SkDebuggerGUI[] = { 4, // revision 0, // classname 0, 0, // classinfo - 29, 14, // methods + 30, 14, // methods 0, 0, // properties 0, 0, // enums/sets 0, 0, // constructors @@ -52,16 +52,17 @@ static const uint qt_meta_data_SkDebuggerGUI[] = { 336, 14, 14, 14, 0x08, 353, 14, 14, 14, 0x08, 370, 14, 14, 14, 0x08, - 395, 390, 14, 14, 0x08, - 422, 14, 14, 14, 0x08, - 442, 433, 14, 14, 0x08, - 461, 14, 14, 14, 0x28, - 476, 390, 14, 14, 0x08, - 512, 15, 14, 14, 0x08, - 531, 14, 14, 14, 0x08, - 545, 14, 14, 14, 0x08, - 564, 14, 14, 14, 0x08, - 589, 582, 14, 14, 0x08, + 390, 14, 14, 14, 0x08, + 410, 405, 14, 14, 0x08, + 437, 14, 14, 14, 0x08, + 457, 448, 14, 14, 0x08, + 476, 14, 14, 14, 0x28, + 491, 405, 14, 14, 0x08, + 527, 15, 14, 14, 0x08, + 546, 14, 14, 14, 0x08, + 560, 14, 14, 14, 0x08, + 579, 14, 14, 14, 0x08, + 604, 597, 14, 14, 0x08, 0 // eod }; @@ -77,7 +78,7 @@ static const char qt_meta_stringdata_SkDebuggerGUI[] = { "actionSave()\0actionSaveAs()\0scaleFactor\0" "actionScale(float)\0actionSettings()\0" "actionStepBack()\0actionStepForward()\0" - "item\0loadFile(QListWidgetItem*)\0" + "drawComplete()\0item\0loadFile(QListWidgetItem*)\0" "openFile()\0isPaused\0pauseDrawing(bool)\0" "pauseDrawing()\0registerListClick(QListWidgetItem*)\0" "selectCommand(int)\0showDeletes()\0" @@ -133,19 +134,20 @@ int SkDebuggerGUI::qt_metacall(QMetaObject::Call _c, int _id, void **_a) case 16: actionSettings(); break; case 17: actionStepBack(); break; case 18: actionStepForward(); break; - case 19: loadFile((*reinterpret_cast< QListWidgetItem*(*)>(_a[1]))); break; - case 20: openFile(); break; - case 21: pauseDrawing((*reinterpret_cast< bool(*)>(_a[1]))); break; - case 22: pauseDrawing(); break; - case 23: registerListClick((*reinterpret_cast< QListWidgetItem*(*)>(_a[1]))); break; - case 24: selectCommand((*reinterpret_cast< int(*)>(_a[1]))); break; - case 25: showDeletes(); break; - case 26: toggleBreakpoint(); break; - case 27: toggleDirectory(); break; - case 28: toggleFilter((*reinterpret_cast< QString(*)>(_a[1]))); break; + case 19: drawComplete(); break; + case 20: loadFile((*reinterpret_cast< QListWidgetItem*(*)>(_a[1]))); break; + case 21: openFile(); break; + case 22: pauseDrawing((*reinterpret_cast< bool(*)>(_a[1]))); break; + case 23: pauseDrawing(); break; + case 24: registerListClick((*reinterpret_cast< QListWidgetItem*(*)>(_a[1]))); break; + case 25: selectCommand((*reinterpret_cast< int(*)>(_a[1]))); break; + case 26: showDeletes(); break; + case 27: toggleBreakpoint(); break; + case 28: toggleDirectory(); break; + case 29: toggleFilter((*reinterpret_cast< QString(*)>(_a[1]))); break; default: ; } - _id -= 29; + _id -= 30; } return _id; } diff --git a/debugger/QT/moc_SkGLWidget.cpp b/debugger/QT/moc_SkGLWidget.cpp new file mode 100644 index 0000000000..9d09c268a8 --- /dev/null +++ b/debugger/QT/moc_SkGLWidget.cpp @@ -0,0 +1,85 @@ +/**************************************************************************** +** Meta object code from reading C++ file 'SkGLWidget.h' +** +** Created: Wed Aug 1 14:54:26 2012 +** by: The Qt Meta Object Compiler version 62 (Qt 4.6.2) +** +** WARNING! All changes made in this file will be lost! +*****************************************************************************/ + +#include "SkGLWidget.h" +#if !defined(Q_MOC_OUTPUT_REVISION) +#error "The header file 'SkGLWidget.h' doesn't include <QObject>." +#elif Q_MOC_OUTPUT_REVISION != 62 +#error "This file was generated using the moc from 4.6.2. It" +#error "cannot be used with the include files from this version of Qt." +#error "(The moc has changed too much.)" +#endif + +QT_BEGIN_MOC_NAMESPACE +static const uint qt_meta_data_SkGLWidget[] = { + + // content: + 4, // revision + 0, // classname + 0, 0, // classinfo + 1, 14, // methods + 0, 0, // properties + 0, 0, // enums/sets + 0, 0, // constructors + 0, // flags + 1, // signalCount + + // signals: signature, parameters, type, tag, flags + 12, 11, 11, 11, 0x05, + + 0 // eod +}; + +static const char qt_meta_stringdata_SkGLWidget[] = { + "SkGLWidget\0\0drawComplete()\0" +}; + +const QMetaObject SkGLWidget::staticMetaObject = { + { &QGLWidget::staticMetaObject, qt_meta_stringdata_SkGLWidget, + qt_meta_data_SkGLWidget, 0 } +}; + +#ifdef Q_NO_DATA_RELOCATION +const QMetaObject &SkGLWidget::getStaticMetaObject() { return staticMetaObject; } +#endif //Q_NO_DATA_RELOCATION + +const QMetaObject *SkGLWidget::metaObject() const +{ + return QObject::d_ptr->metaObject ? QObject::d_ptr->metaObject : &staticMetaObject; +} + +void *SkGLWidget::qt_metacast(const char *_clname) +{ + if (!_clname) return 0; + if (!strcmp(_clname, qt_meta_stringdata_SkGLWidget)) + return static_cast<void*>(const_cast< SkGLWidget*>(this)); + return QGLWidget::qt_metacast(_clname); +} + +int SkGLWidget::qt_metacall(QMetaObject::Call _c, int _id, void **_a) +{ + _id = QGLWidget::qt_metacall(_c, _id, _a); + if (_id < 0) + return _id; + if (_c == QMetaObject::InvokeMetaMethod) { + switch (_id) { + case 0: drawComplete(); break; + default: ; + } + _id -= 1; + } + return _id; +} + +// SIGNAL 0 +void SkGLWidget::drawComplete() +{ + QMetaObject::activate(this, &staticMetaObject, 0, 0); +} +QT_END_MOC_NAMESPACE diff --git a/debugger/QT/moc_SkRasterWidget.cpp b/debugger/QT/moc_SkRasterWidget.cpp new file mode 100644 index 0000000000..82a803a62e --- /dev/null +++ b/debugger/QT/moc_SkRasterWidget.cpp @@ -0,0 +1,85 @@ +/**************************************************************************** +** Meta object code from reading C++ file 'SkRasterWidget.h' +** +** Created: Wed Aug 1 14:54:26 2012 +** by: The Qt Meta Object Compiler version 62 (Qt 4.6.2) +** +** WARNING! All changes made in this file will be lost! +*****************************************************************************/ + +#include "SkRasterWidget.h" +#if !defined(Q_MOC_OUTPUT_REVISION) +#error "The header file 'SkRasterWidget.h' doesn't include <QObject>." +#elif Q_MOC_OUTPUT_REVISION != 62 +#error "This file was generated using the moc from 4.6.2. It" +#error "cannot be used with the include files from this version of Qt." +#error "(The moc has changed too much.)" +#endif + +QT_BEGIN_MOC_NAMESPACE +static const uint qt_meta_data_SkRasterWidget[] = { + + // content: + 4, // revision + 0, // classname + 0, 0, // classinfo + 1, 14, // methods + 0, 0, // properties + 0, 0, // enums/sets + 0, 0, // constructors + 0, // flags + 1, // signalCount + + // signals: signature, parameters, type, tag, flags + 16, 15, 15, 15, 0x05, + + 0 // eod +}; + +static const char qt_meta_stringdata_SkRasterWidget[] = { + "SkRasterWidget\0\0drawComplete()\0" +}; + +const QMetaObject SkRasterWidget::staticMetaObject = { + { &QWidget::staticMetaObject, qt_meta_stringdata_SkRasterWidget, + qt_meta_data_SkRasterWidget, 0 } +}; + +#ifdef Q_NO_DATA_RELOCATION +const QMetaObject &SkRasterWidget::getStaticMetaObject() { return staticMetaObject; } +#endif //Q_NO_DATA_RELOCATION + +const QMetaObject *SkRasterWidget::metaObject() const +{ + return QObject::d_ptr->metaObject ? QObject::d_ptr->metaObject : &staticMetaObject; +} + +void *SkRasterWidget::qt_metacast(const char *_clname) +{ + if (!_clname) return 0; + if (!strcmp(_clname, qt_meta_stringdata_SkRasterWidget)) + return static_cast<void*>(const_cast< SkRasterWidget*>(this)); + return QWidget::qt_metacast(_clname); +} + +int SkRasterWidget::qt_metacall(QMetaObject::Call _c, int _id, void **_a) +{ + _id = QWidget::qt_metacall(_c, _id, _a); + if (_id < 0) + return _id; + if (_c == QMetaObject::InvokeMetaMethod) { + switch (_id) { + case 0: drawComplete(); break; + default: ; + } + _id -= 1; + } + return _id; +} + +// SIGNAL 0 +void SkRasterWidget::drawComplete() +{ + QMetaObject::activate(this, &staticMetaObject, 0, 0); +} +QT_END_MOC_NAMESPACE diff --git a/debugger/SkDebugCanvas.cpp b/debugger/SkDebugCanvas.cpp index 6070867ebc..47734b1bd9 100644 --- a/debugger/SkDebugCanvas.cpp +++ b/debugger/SkDebugCanvas.cpp @@ -109,7 +109,8 @@ void SkDebugCanvas::drawTo(SkCanvas* canvas, int index) { commandVector[i]->execute(canvas); } } - + fMatrix = canvas->getTotalMatrix(); + fClip = canvas->getTotalClip().getBounds(); fIndex = index; } diff --git a/debugger/SkDebugCanvas.h b/debugger/SkDebugCanvas.h index c51e40fda3..e02c34c4f8 100644 --- a/debugger/SkDebugCanvas.h +++ b/debugger/SkDebugCanvas.h @@ -45,6 +45,20 @@ public: void drawTo(SkCanvas* canvas, int index); /** + Returns the most recently calculated transformation matrix + */ + const SkMatrix& getCurrentMatrix() { + return fMatrix; + } + + /** + Returns the most recently calculated clip + */ + const SkIRect& getCurrentClip() { + return fClip; + } + + /** Returns the index of the last draw command to write to the pixel at (x,y) */ int getCommandAtPoint(int x, int y, int index); @@ -191,6 +205,8 @@ private: int fIndex; SkIPoint fUserOffset; float fUserScale; + SkMatrix fMatrix; + SkIRect fClip; /** Adds the command to the classes vector of commands. diff --git a/debugger/moc.sh b/debugger/moc.sh index 86cb5e7989..f271b2194e 100755 --- a/debugger/moc.sh +++ b/debugger/moc.sh @@ -10,3 +10,5 @@ $MOC $SRC_DIR/SkCanvasWidget.h -o $SRC_DIR/moc_SkCanvasWidget.cpp $MOC $SRC_DIR/SkDebuggerGUI.h -o $SRC_DIR/moc_SkDebuggerGUI.cpp $MOC $SRC_DIR/SkInspectorWidget.h -o $SRC_DIR/moc_SkInspectorWidget.cpp $MOC $SRC_DIR/SkSettingsWidget.h -o $SRC_DIR/moc_SkSettingsWidget.cpp +$MOC $SRC_DIR/SkRasterWidget.h -o $SRC_DIR/moc_SkRasterWidget.cpp +$MOC $SRC_DIR/SkGLWidget.h -o $SRC_DIR/moc_SkGLWidget.cpp |