Commit 6a6bf489 authored by Halla Rempt's avatar Halla Rempt
Browse files

Make the cursor workaround hard-coded for Qt 4.6.3

And disable it for later versions of Qt, since it meant we would
fallback to the broken xor operator -- that doesn't work in opengl
parent 4deb12ea
......@@ -398,13 +398,10 @@ DisplaySettingsTab::DisplaySettingsTab(QWidget *parent, const char *name)
#ifdef HAVE_OPENGL
if (!QGLFormat::hasOpenGL()) {
cbUseOpenGL->setEnabled(false);
cbUseOpenGLToolOutlineWorkaround->setEnabled(false);
chkUseTextureBuffer->setEnabled(false);
cmbFilterMode->setEnabled(false);
} else {
cbUseOpenGL->setChecked(cfg.useOpenGL());
cbUseOpenGLToolOutlineWorkaround->setEnabled(cfg.useOpenGL());
cbUseOpenGLToolOutlineWorkaround->setChecked(cfg.useOpenGLToolOutlineWorkaround());
chkUseTextureBuffer->setEnabled(cfg.useOpenGL());
chkUseTextureBuffer->setChecked(cfg.useOpenGLTextureBuffer());
cmbFilterMode->setEnabled(cfg.useOpenGL());
......@@ -414,13 +411,6 @@ DisplaySettingsTab::DisplaySettingsTab(QWidget *parent, const char *name)
grpOpenGL->setEnabled(false);
#endif
QStringList qtVersion = QString(qVersion()).split('.');
int versionNumber = qtVersion.at(0).toInt()*10000
+ qtVersion.at(1).toInt()*100
+ qtVersion.at(2).toInt();
if(versionNumber>=40603)
cbUseOpenGLToolOutlineWorkaround->hide();
intCheckSize->setValue(cfg.checkSize());
chkMoving->setChecked(cfg.scrollCheckers());
colorChecks->setColor(cfg.checkersColor());
......@@ -433,8 +423,6 @@ DisplaySettingsTab::DisplaySettingsTab(QWidget *parent, const char *name)
void DisplaySettingsTab::setDefault()
{
cbUseOpenGL->setChecked(true);
cbUseOpenGLToolOutlineWorkaround->setChecked(false);
cbUseOpenGLToolOutlineWorkaround->setEnabled(true);
chkUseTextureBuffer->setChecked(false);
chkUseTextureBuffer->setEnabled(true);
cmbFilterMode->setEnabled(true);
......@@ -448,7 +436,6 @@ void DisplaySettingsTab::setDefault()
void DisplaySettingsTab::slotUseOpenGLToggled(bool isChecked)
{
#ifdef HAVE_OPENGL
cbUseOpenGLToolOutlineWorkaround->setEnabled(isChecked);
chkUseTextureBuffer->setEnabled(isChecked);
cmbFilterMode->setEnabled(isChecked);
#else
......@@ -769,11 +756,9 @@ bool KisDlgPreferences::editPreferences()
}
cfg.setUseOpenGL(dialog->m_displaySettings->cbUseOpenGL->isChecked());
cfg.setUseOpenGLToolOutlineWorkaround(dialog->m_displaySettings->cbUseOpenGLToolOutlineWorkaround->isChecked());
cfg.setUseOpenGLTextureBuffer(dialog->m_displaySettings->chkUseTextureBuffer->isChecked());
cfg.setOpenGLFilteringMode(dialog->m_displaySettings->cmbFilterMode->currentIndex());
#else
cfg.setUseOpenGLToolOutlineWorkaround(false);
cfg.chkUseTextureBuffer(false);
#endif
......
......@@ -177,14 +177,27 @@
<string>OpenGL</string>
</property>
<layout class="QGridLayout">
<item row="4" column="0">
<widget class="QLabel" name="label">
<item row="2" column="0">
<widget class="QCheckBox" name="chkUseTextureBuffer">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Use Texture Buffering. This can be faster on some GPU/Driver combinations (like Intel) or broken on some others (like AMD/Radeon).&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>Scaling Mode:</string>
<string>Use Texture Buffer</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QCheckBox" name="cbUseOpenGL">
<property name="text">
<string>Enable OpenGL</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item row="5" column="0">
<item row="4" column="0">
<widget class="QComboBox" name="cmbFilterMode">
<property name="currentIndex">
<number>0</number>
......@@ -206,36 +219,10 @@
</item>
</widget>
</item>
<item row="0" column="0">
<widget class="QCheckBox" name="cbUseOpenGL">
<property name="text">
<string>Enable OpenGL</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QCheckBox" name="cbUseOpenGLToolOutlineWorkaround">
<property name="toolTip">
<string>This enables a workaround for a bug in Qt.
If you experience problems while creating a selection,
a shape or with the brush outline,
then you can try to enable this.</string>
</property>
<property name="text">
<string>Use workaround for tool outlines</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QCheckBox" name="chkUseTextureBuffer">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Use Texture Buffering. This can be faster on some GPU/Driver combinations (like Intel) or broken on some others (like AMD/Radeon).&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<widget class="QLabel" name="label">
<property name="text">
<string>Use Texture Buffer</string>
<string>Scaling Mode:</string>
</property>
</widget>
</item>
......
......@@ -365,16 +365,6 @@ void KisConfig::setUseOpenGL(bool useOpenGL)
m_cfg.writeEntry("useOpenGL", useOpenGL);
}
bool KisConfig::useOpenGLToolOutlineWorkaround() const
{
return m_cfg.readEntry("useOpenGLToolOutlineWorkaround", true);
}
void KisConfig::setUseOpenGLToolOutlineWorkaround(bool useWorkaround)
{
m_cfg.writeEntry("useOpenGLToolOutlineWorkaround", useWorkaround);
}
int KisConfig::openGLFilteringMode() const
{
return m_cfg.readEntry("OpenGLFilterMode", 1);
......
......@@ -123,9 +123,6 @@ public:
bool useOpenGL() const;
void setUseOpenGL(bool useOpenGL);
bool useOpenGLToolOutlineWorkaround() const;
void setUseOpenGLToolOutlineWorkaround(bool useWorkaround);
int openGLFilteringMode() const;
void setOpenGLFilteringMode(int filteringMode);
......
......@@ -78,7 +78,8 @@ struct KisTool::Private {
currentGenerator(0),
optionWidget(0),
spacePressed(0),
cursorShader(0)
cursorShader(0),
useGLToolOutlineWorkaround(false)
{
}
......@@ -142,8 +143,16 @@ KisTool::KisTool(KoCanvasBase * canvas, const QCursor & cursor)
setMode(HOVER_MODE);
KisConfig cfg;
d->useGLToolOutlineWorkaround = cfg.useOpenGLToolOutlineWorkaround();
QStringList qtVersion = QString(qVersion()).split('.');
int versionNumber = qtVersion.at(0).toInt()*10000
+ qtVersion.at(1).toInt()*100
+ qtVersion.at(2).toInt();
if (versionNumber>=40603) {
d->useGLToolOutlineWorkaround = false;
}
else {
d->useGLToolOutlineWorkaround = true;
}
}
KisTool::~KisTool()
......@@ -626,7 +635,6 @@ void KisTool::paintToolOutline(QPainter* painter, const QPainterPath &path)
KisOpenGLCanvas2 *canvasWidget = dynamic_cast<KisOpenGLCanvas2 *>(canvas()->canvasWidget());
// the workaround option is enabled for Qt 4.6 < 4.6.3... Only relevant on CentOS.
if (canvasWidget && !d->useGLToolOutlineWorkaround) {
painter->beginNativePainting();
if (d->cursorShader == 0) {
......@@ -711,8 +719,6 @@ void KisTool::paintToolOutline(QPainter* painter, const QPainterPath &path)
void KisTool::resetCursorStyle()
{
KisConfig cfg;
d->useGLToolOutlineWorkaround = cfg.useOpenGLToolOutlineWorkaround();
switch (cfg.cursorStyle()) {
case CURSOR_STYLE_TOOLICON:
useCursor(d->cursor);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment