[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [calligra/krita-testing-kazakov] krita: Fix displaying the canvas when changing LOD to 0 while updat
From:       Dmitry Kazakov <dimula73 () gmail ! com>
Date:       2014-08-30 10:38:54
Message-ID: E1XNg3a-0007ND-Qw () scm ! kde ! org
[Download RAW message or body]

Git commit 889de2a7b1b8b5277e92406f27cbe3ba56580814 by Dmitry Kazakov.
Committed on 30/08/2014 at 10:09.
Pushed by dkazakov into branch 'krita-testing-kazakov'.

Fix displaying the canvas when changing LOD to 0 while update is still calculating

M  +10   -1    krita/data/shaders/highq_downscale.frag
M  +12   -5    krita/image/kis_assert.cpp
M  +17   -23   krita/ui/opengl/kis_opengl_canvas2.cpp

http://commits.kde.org/calligra/889de2a7b1b8b5277e92406f27cbe3ba56580814

diff --git a/krita/data/shaders/highq_downscale.frag \
b/krita/data/shaders/highq_downscale.frag index 7df6f00..c34dde3 100644
--- a/krita/data/shaders/highq_downscale.frag
+++ b/krita/data/shaders/highq_downscale.frag
@@ -106,7 +106,16 @@ void main() {
 #endif /* defined HIGHQ_SCALING || defined DIRECT_LOD_FETCH */
 
     {
-        col = texture2D(texture0, v_textureCoordinate.st);
+#ifdef DIRECT_LOD_FETCH
+
+        if (fixedLodLevel > eps) {
+            col = textureLod(texture0, v_textureCoordinate.st, fixedLodLevel);
+        } else
+
+#endif /* DIRECT_LOD_FETCH */
+        {
+            col = texture2D(texture0, v_textureCoordinate.st);
+        }
     }
 
 #ifdef USE_OCIO
diff --git a/krita/image/kis_assert.cpp b/krita/image/kis_assert.cpp
index d416c02..0335cbf 100644
--- a/krita/image/kis_assert.cpp
+++ b/krita/image/kis_assert.cpp
@@ -54,11 +54,18 @@ void kis_assert_common(const char *assertion, const char *file, \
                int line, bool t
             "Press Abort to see developers information (all unsaved data will be \
                lost)")
         .arg(shortMessage);
 
-    QMessageBox::StandardButton button =
-        QMessageBox::critical(0, i18n("Krita Internal Error"),
-                              longMessage,
-                              QMessageBox::Ignore | QMessageBox::Abort,
-                              QMessageBox::Ignore);
+    bool disableAssertMsg =
+        QProcessEnvironment::systemEnvironment().value("KRITA_NO_ASSERT_MSG", \
"0").toInt(); +
+    QMessageBox::StandardButton button = QMessageBox::Abort;
+
+    if (!disableAssertMsg) {
+        button =
+            QMessageBox::critical(0, i18n("Krita Internal Error"),
+                                  longMessage,
+                                  QMessageBox::Ignore | QMessageBox::Abort,
+                                  QMessageBox::Ignore);
+    }
 
     if (button == QMessageBox::Abort) {
         qFatal("%s", shortMessage.toLatin1().data());
diff --git a/krita/ui/opengl/kis_opengl_canvas2.cpp \
b/krita/ui/opengl/kis_opengl_canvas2.cpp index 3e96c81..f0e2f31 100644
--- a/krita/ui/opengl/kis_opengl_canvas2.cpp
+++ b/krita/ui/opengl/kis_opengl_canvas2.cpp
@@ -458,7 +458,7 @@ void KisOpenGLCanvas2::drawImage() const
             }
 
             int currentLodPlane = tile->currentLodPlane();
-            if (d->displayUniformLocationFixedLodLevel >= 0 && currentLodPlane) {
+            if (d->displayUniformLocationFixedLodLevel >= 0) {
                 d->displayShader->setUniformValue(d->displayUniformLocationFixedLodLevel,
                
                                                   (GLfloat) currentLodPlane);
             }
@@ -466,37 +466,31 @@ void KisOpenGLCanvas2::drawImage() const
             glActiveTexture(GL_TEXTURE0);
             tile->bindToActiveTexture();
 
-            if (SCALE_MORE_OR_EQUAL_TO(scaleX, scaleY, 2.0)) {
+            if (currentLodPlane) {
+                glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, \
GL_NEAREST_MIPMAP_LINEAR); +            } else if (SCALE_MORE_OR_EQUAL_TO(scaleX, \
                scaleY, 2.0)) {
                 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
                 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
             } else {
                 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
 
-                if (currentLodPlane) {
+                switch(d->filterMode) {
+                case KisTextureTile::NearestFilterMode:
+                    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, \
GL_NEAREST); +                    break;
+                case KisTextureTile::BilinearFilterMode:
+                    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, \
GL_LINEAR); +                    break;
+                case KisTextureTile::TrilinearFilterMode:
+                    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, \
GL_LINEAR_MIPMAP_LINEAR); +                    break;
+                case KisTextureTile::HighQualityFiltering:
                     if (SCALE_LESS_THAN(scaleX, scaleY, 0.5)) {
-                        glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, \
GL_NEAREST_MIPMAP_LINEAR); +                        glTexParameteri(GL_TEXTURE_2D, \
GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_NEAREST);  } else {
                         glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, \
GL_LINEAR);  }
-                } else {
-                    switch(d->filterMode) {
-                    case KisTextureTile::NearestFilterMode:
-                        glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, \
                GL_NEAREST);
-                        break;
-                    case KisTextureTile::BilinearFilterMode:
-                        glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, \
                GL_LINEAR);
-                        break;
-                    case KisTextureTile::TrilinearFilterMode:
-                        glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, \
                GL_LINEAR_MIPMAP_LINEAR);
-                        break;
-                    case KisTextureTile::HighQualityFiltering:
-                        if (SCALE_LESS_THAN(scaleX, scaleY, 0.5)) {
-                            glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, \
                GL_LINEAR_MIPMAP_NEAREST);
-                        } else {
-                            glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, \
                GL_LINEAR);
-                        }
-                        break;
-                    }
+                    break;
                 }
             }
 


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic