#endif
}
+#if SK_SUPPORT_GPU
+void SkCanvasWidget::setGLSampleCount(int sampleCount)
+{
+ fGLWidget.setSampleCount(sampleCount);
+}
+#endif
+
void SkCanvasWidget::zoom(float scale, int px, int py) {
fUserMatrix.postScale(scale, scale, px, py);
emit scaleFactorChanged(fUserMatrix.getScaleX());
void setWidgetVisibility(WidgetType type, bool isHidden);
+#if SK_SUPPORT_GPU
+ void setGLSampleCount(int sampleCount);
+#endif
+
/** Zooms the canvas by scale with the transformation centered at the widget point (px, py). */
void zoom(float scale, int px, int py);
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)));
+ connect(&fSettingsWidget, SIGNAL(glSettingsChanged()), this, SLOT(actionGLWidget()));
#endif
connect(fSettingsWidget.getRasterCheckBox(), SIGNAL(toggled(bool)), this, SLOT(actionRasterWidget(bool)));
connect(fSettingsWidget.getOverdrawVizCheckBox(), SIGNAL(toggled(bool)), this, SLOT(actionOverdrawVizWidget(bool)));
renderer = SkNEW(sk_tools::SimplePictureRenderer);
#if SK_SUPPORT_GPU
- if (Qt::Checked == fSettingsWidget.getGLCheckBox()->checkState()) {
+ if (fSettingsWidget.isGLActive()) {
renderer->setDeviceType(sk_tools::PictureRenderer::kGPU_DeviceType);
+ renderer->setSampleCount(fSettingsWidget.getGLSampleCount());
}
#endif
}
#if SK_SUPPORT_GPU
-void SkDebuggerGUI::actionGLWidget(bool isToggled) {
+void SkDebuggerGUI::actionGLWidget() {
+ bool isToggled = fSettingsWidget.isGLActive();
+ if (isToggled) {
+ fCanvasWidget.setGLSampleCount(fSettingsWidget.getGLSampleCount());
+ }
fCanvasWidget.setWidgetVisibility(SkCanvasWidget::kGPU_WidgetType, !isToggled);
}
#endif
#if SK_SUPPORT_GPU
/**
- Toggles the visibility of the GL canvas widget.
+ Updates the visibility of the GL canvas widget and sample count of the GL surface.
*/
- void actionGLWidget(bool isToggled);
+ void actionGLWidget();
#endif
/**
SkSafeUnref(fCanvas);
}
+void SkGLWidget::setSampleCount(int sampleCount)
+{
+ QGLFormat currentFormat = format();
+ currentFormat.setSampleBuffers(sampleCount > 0);
+ currentFormat.setSamples(sampleCount);
+ setFormat(currentFormat);
+}
+
void SkGLWidget::initializeGL() {
fCurIntf = GrGLCreateNativeInterface();
if (!fCurIntf) {
void draw() {
this->updateGL();
}
+ void setSampleCount(int sampleCount);
signals:
void drawComplete();
fGLLabel.setText("OpenGL: ");
fGLLabel.setMinimumWidth(178);
fGLLabel.setMaximumWidth(178);
+
+ fGLMSAAButtonGroup.setTitle("MSAA");
+ fGLMSAAButtonGroup.setMinimumWidth(178);
+ fGLMSAAButtonGroup.setMaximumWidth(178);
+ fGLMSAAButtonGroup.setEnabled(fGLCheckBox.isChecked());
+
+ fGLMSAAOff.setText("Off");
+ fGLMSAA4On.setText("4");
+ fGLMSAA4On.setChecked(true);
+ fGLMSAA16On.setText("16");
+
+ fGLMSAALayout.addWidget(&fGLMSAAOff);
+ fGLMSAALayout.addWidget(&fGLMSAA4On);
+ fGLMSAALayout.addWidget(&fGLMSAA16On);
+
+ fGLMSAAButtonGroup.setLayout(&fGLMSAALayout);
+
+ connect(&fGLCheckBox, SIGNAL(toggled(bool)), &fGLMSAAButtonGroup, SLOT(setEnabled(bool)));
+ connect(&fGLCheckBox, SIGNAL(toggled(bool)), this, SIGNAL(glSettingsChanged()));
+ connect(&fGLMSAAOff, SIGNAL(toggled(bool)), this, SIGNAL(glSettingsChanged()));
+ connect(&fGLMSAA4On, SIGNAL(toggled(bool)), this, SIGNAL(glSettingsChanged()));
+ connect(&fGLMSAA16On, SIGNAL(toggled(bool)), this, SIGNAL(glSettingsChanged()));
#endif
fRasterLayout.addWidget(&fRasterLabel);
fCanvasLayout.addLayout(&fOverdrawVizLayout);
#if SK_SUPPORT_GPU
fCanvasLayout.addLayout(&fGLLayout);
+ fCanvasLayout.addWidget(&fGLMSAAButtonGroup);
#endif
// Command Toggle
#include <QHBoxLayout>
#include <QTextEdit>
#include <QFrame>
+#include <QGroupBox>
#include <QLabel>
#include <QRadioButton>
#include <QCheckBox>
QRadioButton* getVisibilityButton();
#if SK_SUPPORT_GPU
- QCheckBox* getGLCheckBox() {
- return &fGLCheckBox;
+ bool isGLActive() {
+ return fGLCheckBox.isChecked();
}
+
+ int getGLSampleCount() {
+ if (fGLMSAA4On.isChecked()) {
+ return 4;
+ } else if (fGLMSAA16On.isChecked()) {
+ return 16;
+ }
+ return 0;
+ }
+
#endif
QCheckBox* getRasterCheckBox() {
void scrollingPreferences(bool isStickyActivate);
void showStyle(bool isSingleCommand);
void visibilityFilter(bool isEnabled);
+#if SK_SUPPORT_GPU
+ void glSettingsChanged();
+#endif
private:
QVBoxLayout mainFrameLayout;
QHBoxLayout fGLLayout;
QLabel fGLLabel;
QCheckBox fGLCheckBox;
+ QGroupBox fGLMSAAButtonGroup;
+ QVBoxLayout fGLMSAALayout;
+ QRadioButton fGLMSAAOff;
+ QRadioButton fGLMSAA4On;
+ QRadioButton fGLMSAA16On;
#endif
QFrame fZoomFrame;