Allow debugger to be compiled without Ganesh
https://codereview.appspot.com/7311084/ git-svn-id: http://skia.googlecode.com/svn/trunk@7710 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
parent
91207482c9
commit
e8fe4bc3ef
@ -13,7 +13,9 @@ SkCanvasWidget::SkCanvasWidget(QWidget* parent,
|
||||
SkDebugger* debugger) : QWidget(parent)
|
||||
, fHorizontalLayout(this)
|
||||
, fRasterWidget(debugger)
|
||||
#if SK_SUPPORT_GPU
|
||||
, fGLWidget(debugger)
|
||||
#endif
|
||||
{
|
||||
|
||||
fDebugger = debugger;
|
||||
@ -22,16 +24,22 @@ SkCanvasWidget::SkCanvasWidget(QWidget* parent,
|
||||
fHorizontalLayout.setContentsMargins(0,0,0,0);
|
||||
fRasterWidget.setSizePolicy(QSizePolicy::Expanding,
|
||||
QSizePolicy::Expanding);
|
||||
#if SK_SUPPORT_GPU
|
||||
fGLWidget.setSizePolicy(QSizePolicy::Expanding,
|
||||
QSizePolicy::Expanding);
|
||||
#endif
|
||||
|
||||
fHorizontalLayout.addWidget(&fRasterWidget);
|
||||
#if SK_SUPPORT_GPU
|
||||
fHorizontalLayout.addWidget(&fGLWidget);
|
||||
#endif
|
||||
|
||||
fPreviousPoint.set(0,0);
|
||||
fUserMatrix.reset();
|
||||
|
||||
#if SK_SUPPORT_GPU
|
||||
setWidgetVisibility(kGPU_WidgetType, true);
|
||||
#endif
|
||||
connect(&fRasterWidget, SIGNAL(drawComplete()),
|
||||
this->parentWidget(), SLOT(drawComplete()));
|
||||
}
|
||||
@ -41,7 +49,9 @@ SkCanvasWidget::~SkCanvasWidget() {}
|
||||
void SkCanvasWidget::drawTo(int index) {
|
||||
fDebugger->setIndex(index);
|
||||
fRasterWidget.draw();
|
||||
#if SK_SUPPORT_GPU
|
||||
fGLWidget.draw();
|
||||
#endif
|
||||
emit commandChanged(fDebugger->index());
|
||||
}
|
||||
|
||||
@ -111,9 +121,12 @@ void SkCanvasWidget::resetWidgetTransform() {
|
||||
void SkCanvasWidget::setWidgetVisibility(WidgetType type, bool isHidden) {
|
||||
if (type == kRaster_8888_WidgetType) {
|
||||
fRasterWidget.setHidden(isHidden);
|
||||
} else if (type == kGPU_WidgetType) {
|
||||
}
|
||||
#if SK_SUPPORT_GPU
|
||||
else if (type == kGPU_WidgetType) {
|
||||
fGLWidget.setHidden(isHidden);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void SkCanvasWidget::zoom(float scale, int px, int py) {
|
||||
|
@ -27,7 +27,9 @@ public:
|
||||
|
||||
enum WidgetType {
|
||||
kRaster_8888_WidgetType = 1 << 0,
|
||||
#if SK_SUPPORT_GPU
|
||||
kGPU_WidgetType = 1 << 1,
|
||||
#endif
|
||||
};
|
||||
|
||||
void drawTo(int index);
|
||||
@ -58,7 +60,9 @@ signals:
|
||||
private:
|
||||
QHBoxLayout fHorizontalLayout;
|
||||
SkRasterWidget fRasterWidget;
|
||||
#if SK_SUPPORT_GPU
|
||||
SkGLWidget fGLWidget;
|
||||
#endif
|
||||
SkDebugger* fDebugger;
|
||||
SkIPoint fPreviousPoint;
|
||||
SkMatrix fUserMatrix;
|
||||
|
@ -87,7 +87,9 @@ SkDebuggerGUI::SkDebuggerGUI(QWidget *parent) :
|
||||
connect(&fActionClearDeletes, SIGNAL(triggered()), this, SLOT(actionClearDeletes()));
|
||||
connect(&fActionClose, SIGNAL(triggered()), this, SLOT(actionClose()));
|
||||
connect(fSettingsWidget.getVisibilityButton(), SIGNAL(toggled(bool)), this, SLOT(actionCommandFilter()));
|
||||
#if SK_SUPPORT_GPU
|
||||
connect(fSettingsWidget.getGLCheckBox(), SIGNAL(toggled(bool)), this, SLOT(actionGLWidget(bool)));
|
||||
#endif
|
||||
connect(fSettingsWidget.getRasterCheckBox(), SIGNAL(toggled(bool)), this, SLOT(actionRasterWidget(bool)));
|
||||
connect(fSettingsWidget.getOverdrawVizCheckBox(), SIGNAL(toggled(bool)), this, SLOT(actionOverdrawVizWidget(bool)));
|
||||
connect(&fActionPause, SIGNAL(toggled(bool)), this, SLOT(pauseDrawing(bool)));
|
||||
@ -487,9 +489,11 @@ void SkDebuggerGUI::actionDelete() {
|
||||
}
|
||||
}
|
||||
|
||||
#if SK_SUPPORT_GPU
|
||||
void SkDebuggerGUI::actionGLWidget(bool isToggled) {
|
||||
fCanvasWidget.setWidgetVisibility(SkCanvasWidget::kGPU_WidgetType, !isToggled);
|
||||
}
|
||||
#endif
|
||||
|
||||
void SkDebuggerGUI::actionInspector() {
|
||||
if (fInspectorWidget.isHidden()) {
|
||||
|
@ -112,10 +112,12 @@ private slots:
|
||||
*/
|
||||
void actionDelete();
|
||||
|
||||
#if SK_SUPPORT_GPU
|
||||
/**
|
||||
Toggles the visibility of the GL canvas widget.
|
||||
*/
|
||||
void actionGLWidget(bool isToggled);
|
||||
#endif
|
||||
|
||||
/**
|
||||
Toggles the visibility of the inspector widget.
|
||||
|
@ -9,6 +9,8 @@
|
||||
|
||||
#include "SkGLWidget.h"
|
||||
|
||||
#if SK_SUPPORT_GPU
|
||||
|
||||
SkGLWidget::SkGLWidget(SkDebugger* debugger) : QGLWidget() {
|
||||
this->setStyleSheet("QWidget {background-color: white; border: 1px solid #cccccc;}");
|
||||
fDebugger = debugger;
|
||||
@ -74,3 +76,5 @@ GrBackendRenderTargetDesc SkGLWidget::getDesc(int w, int h) {
|
||||
|
||||
return desc;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -10,12 +10,13 @@
|
||||
#ifndef SKGLWIDGET_H_
|
||||
#define SKGLWIDGET_H_
|
||||
|
||||
#if SK_SUPPORT_GPU
|
||||
|
||||
#include <QtOpenGL/QGLWidget>
|
||||
#include "SkDebugCanvas.h"
|
||||
#include "SkDebugger.h"
|
||||
#include "SkDevice.h"
|
||||
#include "SkGpuDevice.h"
|
||||
|
||||
#include "GrContext.h"
|
||||
#include "gl/GrGLInterface.h"
|
||||
#include "gl/GrGLUtil.h"
|
||||
@ -51,4 +52,6 @@ private:
|
||||
GrBackendRenderTargetDesc getDesc(int w, int h);
|
||||
};
|
||||
|
||||
#endif /* SK_SUPPORT_GPU */
|
||||
|
||||
#endif /* SKGLWIDGET_H_ */
|
||||
|
@ -9,7 +9,10 @@
|
||||
#ifndef SKRASTERWIDGET_H_
|
||||
#define SKRASTERWIDGET_H_
|
||||
|
||||
#if SK_SUPPORT_GPU
|
||||
#include "SkGpuDevice.h"
|
||||
#endif
|
||||
|
||||
#include "SkDevice.h"
|
||||
#include "SkDebugger.h"
|
||||
|
||||
|
@ -63,9 +63,11 @@ SkSettingsWidget::SkSettingsWidget() : QWidget()
|
||||
fOverdrawVizLabel.setMinimumWidth(178);
|
||||
fOverdrawVizLabel.setMaximumWidth(178);
|
||||
|
||||
#if SK_SUPPORT_GPU
|
||||
fGLLabel.setText("OpenGL: ");
|
||||
fGLLabel.setMinimumWidth(178);
|
||||
fGLLabel.setMaximumWidth(178);
|
||||
#endif
|
||||
|
||||
fRasterLayout.addWidget(&fRasterLabel);
|
||||
fRasterLayout.addWidget(&fRasterCheckBox);
|
||||
@ -73,14 +75,18 @@ SkSettingsWidget::SkSettingsWidget() : QWidget()
|
||||
fOverdrawVizLayout.addWidget(&fOverdrawVizLabel);
|
||||
fOverdrawVizLayout.addWidget(&fOverdrawVizCheckBox);
|
||||
|
||||
#if SK_SUPPORT_GPU
|
||||
fGLLayout.addWidget(&fGLLabel);
|
||||
fGLLayout.addWidget(&fGLCheckBox);
|
||||
#endif
|
||||
|
||||
fCanvasLayout.setSpacing(6);
|
||||
fCanvasLayout.setContentsMargins(11,11,11,11);
|
||||
fCanvasLayout.addLayout(&fRasterLayout);
|
||||
fCanvasLayout.addLayout(&fOverdrawVizLayout);
|
||||
#if SK_SUPPORT_GPU
|
||||
fCanvasLayout.addLayout(&fGLLayout);
|
||||
#endif
|
||||
|
||||
// Command Toggle
|
||||
fCommandToggle.setText("Command Scrolling Preferences");
|
||||
|
@ -39,9 +39,11 @@ public:
|
||||
|
||||
QRadioButton* getVisibilityButton();
|
||||
|
||||
#if SK_SUPPORT_GPU
|
||||
QCheckBox* getGLCheckBox() {
|
||||
return &fGLCheckBox;
|
||||
}
|
||||
#endif
|
||||
|
||||
QCheckBox* getRasterCheckBox() {
|
||||
return &fRasterCheckBox;
|
||||
@ -95,9 +97,11 @@ private:
|
||||
QLabel fOverdrawVizLabel;
|
||||
QCheckBox fOverdrawVizCheckBox;
|
||||
|
||||
#if SK_SUPPORT_GPU
|
||||
QHBoxLayout fGLLayout;
|
||||
QLabel fGLLabel;
|
||||
QCheckBox fGLCheckBox;
|
||||
#endif
|
||||
|
||||
QFrame fZoomFrame;
|
||||
QHBoxLayout fZoomLayout;
|
||||
|
@ -195,8 +195,8 @@ public:
|
||||
} else if (kTileGrid_BBoxHierarchyType == fBBoxHierarchyType) {
|
||||
config.append("_grid");
|
||||
}
|
||||
switch (fDeviceType) {
|
||||
#if SK_SUPPORT_GPU
|
||||
switch (fDeviceType) {
|
||||
case kGPU_DeviceType:
|
||||
config.append("_gpu");
|
||||
break;
|
||||
@ -204,12 +204,12 @@ public:
|
||||
case kAngle_DeviceType:
|
||||
config.append("_angle");
|
||||
break;
|
||||
#endif
|
||||
#endif
|
||||
default:
|
||||
// Assume that no extra info means bitmap.
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
config.append(fDrawFiltersConfig.c_str());
|
||||
return config;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user