#include "SkCanvasWidget.h"
-SkCanvasWidget::SkCanvasWidget() : QWidget()
+SkCanvasWidget::SkCanvasWidget(QWidget* parent) : QWidget(parent)
, fHorizontalLayout(this)
{
fHorizontalLayout.setSpacing(6);
setWidgetVisibility(kGPU_WidgetType, true);
this->setDisabled(true);
+ connect(&fRasterWidget, SIGNAL(drawComplete()),
+ this->parentWidget(), SLOT(drawComplete()));
}
SkCanvasWidget::~SkCanvasWidget() {
Q_OBJECT
public:
- SkCanvasWidget();
+ SkCanvasWidget(QWidget* parent);
~SkCanvasWidget();
}
const SkMatrix& getCurrentMatrix() {
- return fRasterWidget.getCurrentMatrix();
+ return fDebugCanvas->getCurrentMatrix();
}
const SkIRect& getCurrentClip() {
- return fRasterWidget.getCurrentClip();
+ return fDebugCanvas->getCurrentClip();
}
void loadPicture(QString filename);
, fMapper(this)
, fListWidget(&fCentralWidget)
, fDirectoryWidget(&fCentralWidget)
+ , fCanvasWidget(this)
, fMenuBar(this)
, fMenuFile(this)
, fMenuNavigate(this)
}
}
+void SkDebuggerGUI::drawComplete() {
+ fInspectorWidget.setMatrix(fCanvasWidget.getCurrentMatrix());
+ fInspectorWidget.setClip(fCanvasWidget.getCurrentClip());
+}
+
void SkDebuggerGUI::saveToFile(QString filename) {
SkFILEWStream file(filename.toAscii());
SkPicture picture;
}
fInspectorWidget.setDetailText(info);
fInspectorWidget.setDisabled(false);
- fInspectorWidget.setMatrix(fCanvasWidget.getCurrentMatrix());
- fInspectorWidget.setClip(fCanvasWidget.getCurrentClip());
}
}
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);
fDebugCanvas->drawTo(fCanvas, fIndex);
// TODO(chudy): Implement an optional flush button in Gui.
fCanvas->flush();
+ emit drawComplete();
}
GrPlatformRenderTargetDesc SkGLWidget::getDesc(int w, int h) {
#include "GrRenderTarget.h"
class SkGLWidget : public QGLWidget {
+Q_OBJECT
public:
SkGLWidget();
fScaleFactor = scale;
}
+signals:
+ void drawComplete();
+
protected:
void initializeGL();
void resizeGL(int w, int h);
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);
painter.drawImage(origin, image);
painter.end();
+ emit drawComplete();
}
}
#include <QWidget>
class SkRasterWidget : public QWidget {
+ Q_OBJECT
public:
SkRasterWidget();
return fBitmap.width();
}
- const SkMatrix& getCurrentMatrix() {
- return fMatrix;
- }
-
- const SkIRect& getCurrentClip() {
- return fClip;
- }
-
void setTranslate(SkIPoint transform) {
fTransform = transform;
}
fScaleFactor = scale;
}
+signals:
+ void drawComplete();
+
protected:
void paintEvent(QPaintEvent* event);
SkCanvas* fCanvas;
SkDevice* fDevice;
- SkMatrix fMatrix;
- SkIRect fClip;
-
int fIndex;
SkIPoint fTransform;
float fScaleFactor;
/****************************************************************************
** 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!
4, // revision
0, // classname
0, 0, // classinfo
- 29, 14, // methods
+ 30, 14, // methods
0, 0, // properties
0, 0, // enums/sets
0, 0, // constructors
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
};
"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"
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;
}
--- /dev/null
+/****************************************************************************
+** 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
--- /dev/null
+/****************************************************************************
+** 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
commandVector[i]->execute(canvas);
}
}
-
+ fMatrix = canvas->getTotalMatrix();
+ fClip = canvas->getTotalClip().getBounds();
fIndex = index;
}
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);
int fIndex;
SkIPoint fUserOffset;
float fUserScale;
+ SkMatrix fMatrix;
+ SkIRect fClip;
/**
Adds the command to the classes vector of commands.
$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
'../debugger/QT/moc_SkDebuggerGUI.cpp',
'../debugger/QT/moc_SkInspectorWidget.cpp',
'../debugger/QT/moc_SkSettingsWidget.cpp',
+ '../debugger/QT/moc_SkRasterWidget.cpp',
+ '../debugger/QT/moc_SkGLWidget.cpp',
'../debugger/QT/SkDebuggerGUI.cpp',
'../debugger/QT/SkDebuggerGUI.h',
'../debugger/QT/SkCanvasWidget.cpp',