krita: update 3.2.1 -> 3.3.3

Signed-off-by: Andreas Müller <schnitzeltony@gmail.com>
This commit is contained in:
Andreas Müller
2018-03-15 21:52:14 +01:00
parent 2ebd2447cc
commit cc0e1f6aae
3 changed files with 322 additions and 181 deletions

View File

@@ -0,0 +1,319 @@
From 86cad3e0edba28de83725bf7f55ceb68ff57d765 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Andreas=20M=C3=BCller?= <schnitzeltony@gmail.com>
Date: Thu, 15 Mar 2018 14:47:57 +0100
Subject: [PATCH] fix build with GLES2 only
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Upstream-Status: Pending
Signed-off-by: Andreas Müller <schnitzeltony@gmail.com>
---
libs/ui/canvas/kis_mirror_axis.cpp | 5 ++-
libs/ui/opengl/kis_opengl_canvas2.cpp | 18 ++++++++++
libs/ui/opengl/kis_opengl_image_textures.cpp | 54 ++++++++++++++++++++++++----
libs/ui/opengl/kis_texture_tile.cpp | 10 ++++++
4 files changed, 79 insertions(+), 8 deletions(-)
diff --git a/libs/ui/canvas/kis_mirror_axis.cpp b/libs/ui/canvas/kis_mirror_axis.cpp
index 47d115c..a873040 100644
--- a/libs/ui/canvas/kis_mirror_axis.cpp
+++ b/libs/ui/canvas/kis_mirror_axis.cpp
@@ -157,6 +157,7 @@ void KisMirrorAxis::drawDecoration(QPainter& gc, const QRectF& updateArea, const
gc.setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform);
QOpenGLContext *ctx = QOpenGLContext::currentContext();
+#ifdef GL_MULTISAMPLE
bool hasMultisample = ((gc.paintEngine()->type() == QPaintEngine::OpenGL2) &&
(ctx->hasExtension("GL_ARB_multisample")));
@@ -167,7 +168,7 @@ void KisMirrorAxis::drawDecoration(QPainter& gc, const QRectF& updateArea, const
ctx->functions()->glEnable(GL_MULTISAMPLE);
gc.endNativePainting();
}
-
+#endif
float halfHandleSize = d->handleSize / 2;
d->recomputeVisibleAxes(gc.viewport());
@@ -225,11 +226,13 @@ void KisMirrorAxis::drawDecoration(QPainter& gc, const QRectF& updateArea, const
}
}
+#ifdef GL_MULTISAMPLE
if (hasMultisample) {
gc.beginNativePainting();
ctx->functions()->glDisable(GL_MULTISAMPLE);
gc.endNativePainting();
}
+#endif
}
diff --git a/libs/ui/opengl/kis_opengl_canvas2.cpp b/libs/ui/opengl/kis_opengl_canvas2.cpp
index ab471b0..c7f09b3 100644
--- a/libs/ui/opengl/kis_opengl_canvas2.cpp
+++ b/libs/ui/opengl/kis_opengl_canvas2.cpp
@@ -45,8 +45,10 @@
#include <QMessageBox>
#ifndef Q_OS_OSX
+#ifndef QT_OPENGL_ES_2
#include <QOpenGLFunctions_2_1>
#endif
+#endif
#define NEAR_VAL -1000.0
#define FAR_VAL 1000.0
@@ -103,7 +105,9 @@ public:
QVector2D texCoords[6];
#ifndef Q_OS_OSX
+#ifndef QT_OPENGL_ES_2
QOpenGLFunctions_2_1 *glFn201;
+#endif
#endif
int xToColWithWrapCompensation(int x, const QRect &imageRect) {
@@ -231,6 +235,7 @@ void KisOpenGLCanvas2::initializeGL()
KisOpenGL::initializeContext(context());
initializeOpenGLFunctions();
#ifndef Q_OS_OSX
+#ifndef QT_OPENGL_ES_2
if (!KisOpenGL::hasOpenGLES()) {
d->glFn201 = context()->versionFunctions<QOpenGLFunctions_2_1>();
if (!d->glFn201) {
@@ -239,6 +244,7 @@ void KisOpenGLCanvas2::initializeGL()
} else {
d->glFn201 = nullptr;
}
+#endif
#endif
KisConfig cfg;
@@ -396,18 +402,28 @@ void KisOpenGLCanvas2::paintToolOutline(const QPainterPath &path)
d->cursorShader->setUniformValue(d->cursorShader->location(Uniform::ModelViewProjection), modelMatrix);
if (!KisOpenGL::hasOpenGLES()) {
+#ifdef GL_LINE_SMOOTH_HINT
glHint(GL_LINE_SMOOTH_HINT, GL_NICEST);
+#endif
+#ifdef GL_COLOR_LOGIC_OP
glEnable(GL_COLOR_LOGIC_OP);
+#endif
#ifndef Q_OS_OSX
+#ifndef QT_OPENGL_ES_2
if (d->glFn201) {
d->glFn201->glLogicOp(GL_XOR);
}
+#endif
#else
+#ifdef GL_XOR
glLogicOp(GL_XOR);
+#endif
#endif
} else {
+#ifdef GL_BLEND
glEnable(GL_BLEND);
+#endif
glBlendFuncSeparate(GL_ONE_MINUS_DST_COLOR, GL_ZERO, GL_ONE, GL_ONE);
}
@@ -446,7 +462,9 @@ void KisOpenGLCanvas2::paintToolOutline(const QPainterPath &path)
}
if (!KisOpenGL::hasOpenGLES()) {
+#ifdef GL_COLOR_LOGIC_OP
glDisable(GL_COLOR_LOGIC_OP);
+#endif
} else {
glDisable(GL_BLEND);
}
diff --git a/libs/ui/opengl/kis_opengl_image_textures.cpp b/libs/ui/opengl/kis_opengl_image_textures.cpp
index 1210c7b..8aa84b7 100644
--- a/libs/ui/opengl/kis_opengl_image_textures.cpp
+++ b/libs/ui/opengl/kis_opengl_image_textures.cpp
@@ -408,7 +408,11 @@ void KisOpenGLImageTextures::generateCheckerTexture(const QImage &checkImage)
if (checkImage.width() != BACKGROUND_TEXTURE_SIZE || checkImage.height() != BACKGROUND_TEXTURE_SIZE) {
img = checkImage.scaled(BACKGROUND_TEXTURE_SIZE, BACKGROUND_TEXTURE_SIZE);
}
+#ifdef GL_RGBA8
GLint format = GL_BGRA, internalFormat = GL_RGBA8;
+#else
+ GLint format = GL_BGRA, internalFormat = GL_BGRA;
+#endif
if (KisOpenGL::hasOpenGLES()) {
if (ctx->hasExtension(QByteArrayLiteral("GL_EXT_texture_format_BGRA8888"))) {
format = GL_BGRA_EXT;
@@ -541,18 +545,25 @@ void KisOpenGLImageTextures::updateTextureFormat()
QOpenGLContext *ctx = QOpenGLContext::currentContext();
if (!(m_image && ctx)) return;
+#ifdef GL_RGBA8
if (!KisOpenGL::hasOpenGLES()) {
m_texturesInfo.internalFormat = GL_RGBA8;
m_texturesInfo.type = GL_UNSIGNED_BYTE;
m_texturesInfo.format = GL_BGRA;
- } else {
+ } else
+#endif
+ {
m_texturesInfo.internalFormat = GL_BGRA8_EXT;
m_texturesInfo.type = GL_UNSIGNED_BYTE;
m_texturesInfo.format = GL_BGRA_EXT;
if(!ctx->hasExtension(QByteArrayLiteral("GL_EXT_texture_format_BGRA8888"))) {
// The red and blue channels are swapped, but it will be re-swapped
// by texture swizzle mask set in KisTextureTile::setTextureParameters
+#ifdef GL_RGBA8
m_texturesInfo.internalFormat = GL_RGBA8;
+#else
+ m_texturesInfo.internalFormat = GL_RGBA;
+#endif
m_texturesInfo.type = GL_UNSIGNED_BYTE;
m_texturesInfo.format = GL_RGBA;
}
@@ -569,32 +580,48 @@ void KisOpenGLImageTextures::updateTextureFormat()
if (colorModelId == RGBAColorModelID) {
if (colorDepthId == Float16BitsColorDepthID) {
+#ifdef GL_RGBA16F
if (KisOpenGL::hasOpenGLES()) {
m_texturesInfo.internalFormat = GL_RGBA16F;
dbgUI << "Using half (GLES)";
- } else if (ctx->hasExtension("GL_ARB_texture_float")) {
+ } else
+#endif
+#ifdef GL_RGBA16F_ARB
+ if (ctx->hasExtension("GL_ARB_texture_float")) {
m_texturesInfo.internalFormat = GL_RGBA16F_ARB;
dbgUI << "Using ARB half";
}
- else if (ctx->hasExtension("GL_ATI_texture_float")) {
+ else
+#endif
+#ifdef GL_RGBA_FLOAT16_ATI
+ if (ctx->hasExtension("GL_ATI_texture_float")) {
m_texturesInfo.internalFormat = GL_RGBA_FLOAT16_ATI;
dbgUI << "Using ATI half";
}
+#endif
+ // make ifdefs 'else' happy
+ if(false) {}
bool haveBuiltInOpenExr = false;
#ifdef HAVE_OPENEXR
haveBuiltInOpenExr = true;
#endif
+#ifdef GL_HALF_FLOAT
if (haveBuiltInOpenExr && KisOpenGL::hasOpenGLES()) {
m_texturesInfo.type = GL_HALF_FLOAT;
destinationColorDepthId = Float16BitsColorDepthID;
dbgUI << "Pixel type half (GLES)";
- } else if (haveBuiltInOpenExr && ctx->hasExtension("GL_ARB_half_float_pixel")) {
+ } else
+#endif
+#ifdef GL_HALF_FLOAT_ARB
+ if (haveBuiltInOpenExr && ctx->hasExtension("GL_ARB_half_float_pixel")) {
m_texturesInfo.type = GL_HALF_FLOAT_ARB;
destinationColorDepthId = Float16BitsColorDepthID;
dbgUI << "Pixel type half";
- } else {
+ } else
+#endif
+ {
m_texturesInfo.type = GL_FLOAT;
destinationColorDepthId = Float32BitsColorDepthID;
dbgUI << "Pixel type float";
@@ -602,22 +629,32 @@ void KisOpenGLImageTextures::updateTextureFormat()
m_texturesInfo.format = GL_RGBA;
}
else if (colorDepthId == Float32BitsColorDepthID) {
+ m_texturesInfo.internalFormat = GL_RGBA;
+#ifdef GL_RGBA32F
if (KisOpenGL::hasOpenGLES()) {
m_texturesInfo.internalFormat = GL_RGBA32F;
dbgUI << "Using float (GLES)";
- } else if (ctx->hasExtension("GL_ARB_texture_float")) {
+ } else
+#endif
+#ifdef GL_RGBA32F_ARB
+ if (ctx->hasExtension("GL_ARB_texture_float")) {
m_texturesInfo.internalFormat = GL_RGBA32F_ARB;
dbgUI << "Using ARB float";
- } else if (ctx->hasExtension("GL_ATI_texture_float")) {
+ } else
+#endif
+#ifdef GL_RGBA_FLOAT32_ATI
+ if (ctx->hasExtension("GL_ATI_texture_float")) {
m_texturesInfo.internalFormat = GL_RGBA_FLOAT32_ATI;
dbgUI << "Using ATI float";
}
+#endif
m_texturesInfo.type = GL_FLOAT;
m_texturesInfo.format = GL_RGBA;
destinationColorDepthId = Float32BitsColorDepthID;
}
else if (colorDepthId == Integer16BitsColorDepthID) {
+#ifdef GL_RGBA16
if (!KisOpenGL::hasOpenGLES()) {
m_texturesInfo.internalFormat = GL_RGBA16;
m_texturesInfo.type = GL_UNSIGNED_SHORT;
@@ -625,9 +662,11 @@ void KisOpenGLImageTextures::updateTextureFormat()
destinationColorDepthId = Integer16BitsColorDepthID;
dbgUI << "Using 16 bits rgba";
}
+#endif
// TODO: for ANGLE, see if we can convert to 16f to support 10-bit display
}
}
+#ifdef GL_RGBA16
else {
// We will convert the colorspace to 16 bits rgba, instead of 8 bits
if (colorDepthId == Integer16BitsColorDepthID && !KisOpenGL::hasOpenGLES()) {
@@ -639,6 +678,7 @@ void KisOpenGLImageTextures::updateTextureFormat()
}
// TODO: for ANGLE, see if we can convert to 16f to support 10-bit display
}
+#endif
if (!m_internalColorManagementActive &&
colorModelId != destinationColorModelId) {
diff --git a/libs/ui/opengl/kis_texture_tile.cpp b/libs/ui/opengl/kis_texture_tile.cpp
index d8fb03d..90e9996 100644
--- a/libs/ui/opengl/kis_texture_tile.cpp
+++ b/libs/ui/opengl/kis_texture_tile.cpp
@@ -34,17 +34,27 @@ void KisTextureTile::setTextureParameters()
f->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
f->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
+#ifdef GL_TEXTURE_MIN_LOD
f->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_LOD, 0);
+#endif
+#ifdef GL_TEXTURE_MAX_LOD
f->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LOD, m_numMipmapLevels);
+#endif
+#ifdef GL_TEXTURE_BASE_LEVEL
f->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_BASE_LEVEL, 0);
+#endif
+#ifdef GL_TEXTURE_MAX_LEVEL
f->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, m_numMipmapLevels);
+#endif
+#ifdef GL_RGBA8
if (m_texturesInfo->internalFormat == GL_RGBA8 && m_texturesInfo->format == GL_RGBA) {
// If image format is RGBA8, swap the red and blue channels for the proper colour
// This is for OpenGL ES support and only used if lacking GL_EXT_texture_format_BGRA8888
f->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_R, GL_BLUE);
f->glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_B, GL_RED);
}
+#endif
f->glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
}
--
2.14.3

View File

@@ -1,178 +0,0 @@
From a13f4cb491973ece28266bef9aa54706f0393fc6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Andreas=20M=C3=BCller?= <schnitzeltony@googlemail.com>
Date: Tue, 7 Jun 2016 00:04:14 +0200
Subject: [PATCH] fix build with GLES2
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Andreas Müller <schnitzeltony@googlemail.com>
---
libs/ui/canvas/kis_mirror_axis.cpp | 15 -------
libs/ui/opengl/kis_opengl_canvas2.cpp | 16 ----------------
libs/ui/opengl/kis_opengl_image_textures.cpp | 60 +++-------------------------
3 files changed, 8 insertions(+), 73 deletions(-)
diff --git a/libs/ui/canvas/kis_mirror_axis.cpp b/libs/ui/canvas/kis_mirror_axis.cpp
index 468dbf4..4823f39 100644
--- a/libs/ui/canvas/kis_mirror_axis.cpp
+++ b/libs/ui/canvas/kis_mirror_axis.cpp
@@ -144,16 +144,6 @@ void KisMirrorAxis::drawDecoration(QPainter& gc, const QRectF& updateArea, const
gc.setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform);
QOpenGLContext *ctx = QOpenGLContext::currentContext();
- bool hasMultisample = ((gc.paintEngine()->type() == QPaintEngine::OpenGL2) &&
- (ctx->hasExtension("GL_ARB_multisample")));
-
- // QPainter cannot anti-alias the edges of circles etc. when using OpenGL
- // So instead, use native OpenGL anti-aliasing when available.
- if (hasMultisample) {
- gc.beginNativePainting();
- ctx->functions()->glEnable(GL_MULTISAMPLE);
- gc.endNativePainting();
- }
float halfHandleSize = d->handleSize / 2;
@@ -207,11 +197,6 @@ void KisMirrorAxis::drawDecoration(QPainter& gc, const QRectF& updateArea, const
}
}
- if (hasMultisample) {
- gc.beginNativePainting();
- ctx->functions()->glDisable(GL_MULTISAMPLE);
- gc.endNativePainting();
- }
}
diff --git a/libs/ui/opengl/kis_opengl_canvas2.cpp b/libs/ui/opengl/kis_opengl_canvas2.cpp
index 75ca046..8d3164b 100644
--- a/libs/ui/opengl/kis_opengl_canvas2.cpp
+++ b/libs/ui/opengl/kis_opengl_canvas2.cpp
@@ -102,9 +102,6 @@ public:
QVector3D vertices[6];
QVector2D texCoords[6];
-#ifndef Q_OS_OSX
- QOpenGLFunctions_2_1 *glFn201;
-#endif
int xToColWithWrapCompensation(int x, const QRect &imageRect) {
int firstImageColumn = openGLImageTextures->xToCol(imageRect.left());
@@ -230,12 +227,6 @@ void KisOpenGLCanvas2::initializeGL()
{
KisOpenGL::initializeContext(context());
initializeOpenGLFunctions();
-#ifndef Q_OS_OSX
- d->glFn201 = context()->versionFunctions<QOpenGLFunctions_2_1>();
- if (!d->glFn201) {
- warnUI << "Cannot obtain QOpenGLFunctions_2_1, glLogicOp cannot be used";
- }
-#endif
KisConfig cfg;
d->openGLImageTextures->setProofingConfig(canvas()->proofingConfiguration());
@@ -395,17 +386,6 @@ void KisOpenGLCanvas2::paintToolOutline(const QPainterPath &path)
modelMatrix = projectionMatrix * modelMatrix;
d->cursorShader->setUniformValue(d->cursorShader->location(Uniform::ModelViewProjection), modelMatrix);
- glHint(GL_LINE_SMOOTH_HINT, GL_NICEST);
-
- glEnable(GL_COLOR_LOGIC_OP);
-#ifndef Q_OS_OSX
- if (d->glFn201) {
- d->glFn201->glLogicOp(GL_XOR);
- }
-#else
- glLogicOp(GL_XOR);
-#endif
-
// Paint the tool outline
if (KisOpenGL::hasOpenGL3()) {
d->outlineVAO.bind();
@@ -440,8 +420,6 @@ void KisOpenGLCanvas2::paintToolOutline(const QPainterPath &path)
d->outlineVAO.release();
}
- glDisable(GL_COLOR_LOGIC_OP);
-
d->cursorShader->release();
}
diff --git a/libs/ui/opengl/kis_opengl_image_textures.cpp b/libs/ui/opengl/kis_opengl_image_textures.cpp
index 835d41e..c16d0e7 100644
--- a/libs/ui/opengl/kis_opengl_image_textures.cpp
+++ b/libs/ui/opengl/kis_opengl_image_textures.cpp
@@ -511,63 +511,13 @@ void KisOpenGLImageTextures::updateTextureFormat()
dbgUI << "Choosing texture format:";
if (colorModelId == RGBAColorModelID) {
- if (colorDepthId == Float16BitsColorDepthID) {
-
- if (ctx->hasExtension("GL_ARB_texture_float")) {
- m_texturesInfo.internalFormat = GL_RGBA16F_ARB;
- dbgUI << "Using ARB half";
- }
- else if (ctx->hasExtension("GL_ATI_texture_float")) {
- m_texturesInfo.internalFormat = GL_RGBA_FLOAT16_ATI;
- dbgUI << "Using ATI half";
- }
-
- bool haveBuiltInOpenExr = false;
-#ifdef HAVE_OPENEXR
- haveBuiltInOpenExr = true;
-#endif
-
- if (haveBuiltInOpenExr && ctx->hasExtension("GL_ARB_half_float_pixel")) {
- m_texturesInfo.type = GL_HALF_FLOAT_ARB;
- destinationColorDepthId = Float16BitsColorDepthID;
- dbgUI << "Pixel type half";
- } else {
- m_texturesInfo.type = GL_FLOAT;
- destinationColorDepthId = Float32BitsColorDepthID;
- dbgUI << "Pixel type float";
- }
+ if (colorDepthId == Float16BitsColorDepthID ||
+ colorDepthId == Float32BitsColorDepthID) {
+ m_texturesInfo.type = GL_FLOAT;
+ destinationColorDepthId = Float32BitsColorDepthID;
+ dbgUI << "Pixel type float";
m_texturesInfo.format = GL_RGBA;
}
- else if (colorDepthId == Float32BitsColorDepthID) {
- if (ctx->hasExtension("GL_ARB_texture_float")) {
- m_texturesInfo.internalFormat = GL_RGBA32F_ARB;
- dbgUI << "Using ARB float";
- } else if (ctx->hasExtension("GL_ATI_texture_float")) {
- m_texturesInfo.internalFormat = GL_RGBA_FLOAT32_ATI;
- dbgUI << "Using ATI float";
- }
-
- m_texturesInfo.type = GL_FLOAT;
- m_texturesInfo.format = GL_RGBA;
- destinationColorDepthId = Float32BitsColorDepthID;
- }
- else if (colorDepthId == Integer16BitsColorDepthID) {
- m_texturesInfo.internalFormat = GL_RGBA16;
- m_texturesInfo.type = GL_UNSIGNED_SHORT;
- m_texturesInfo.format = GL_BGRA;
- destinationColorDepthId = Integer16BitsColorDepthID;
- dbgUI << "Using 16 bits rgba";
- }
- }
- else {
- // We will convert the colorspace to 16 bits rgba, instead of 8 bits
- if (colorDepthId == Integer16BitsColorDepthID) {
- m_texturesInfo.internalFormat = GL_RGBA16;
- m_texturesInfo.type = GL_UNSIGNED_SHORT;
- m_texturesInfo.format = GL_BGRA;
- destinationColorDepthId = Integer16BitsColorDepthID;
- dbgUI << "Using conversion to 16 bits rgba";
- }
}
if (!m_internalColorManagementActive &&
--
2.5.5

View File

@@ -34,10 +34,10 @@ DEPENDS += " \
SRC_URI = " \
${KDE_MIRROR}/stable/${BPN}/${PV}/${BPN}-${PV}.tar.gz \
file://0001-fix-build-with-GLES2.patch \
file://0001-fix-build-with-GLES2-only.patch \
"
SRC_URI[md5sum] = "00896775772991182e927248eb3ef198"
SRC_URI[sha256sum] = "ef06cee677d75861edca0e1f825bca42ff59b7200aeb827e16f8d1fb5ef14e39"
SRC_URI[md5sum] = "eb3224bbf09b7b88364c6308cd5a5d18"
SRC_URI[sha256sum] = "bec04e3392e9b311477c5c6a50e2201b43a3afda91d9b24a0fc8e3399585865d"
OECMAKE_GENERATOR="Unix Makefiles"