[Libreoffice-commits] core.git: slideshow/source

Stephan Bergmann sbergman at redhat.com
Mon Mar 2 06:19:30 PST 2015


 slideshow/source/engine/OGLTrans/generic/OGLTrans_TransitionerImpl.cxx |   38 +++++++---
 1 file changed, 27 insertions(+), 11 deletions(-)

New commits:
commit cf6d0fced8bc8770ca101b71187c8d0ed28ae1f1
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Mon Mar 2 15:15:17 2015 +0100

    Replace uses of deprecated gluBuild2DMipmaps
    
    ...with glGenerateMipmap (since OpenGL 3.0) or GL_GENERATE_MIPMAP (since OpenGL
    1.4).  Appears to make slide transitions not worse on Linux and Mac OS X, while
    actually improving them on Windows (where the transitions were rendered in just
    white w/o textures), at least on the specific machines I tested on.
    
    Change-Id: I1e4c115223521acd3f254bdbf0330a7830160a9c

diff --git a/slideshow/source/engine/OGLTrans/generic/OGLTrans_TransitionerImpl.cxx b/slideshow/source/engine/OGLTrans/generic/OGLTrans_TransitionerImpl.cxx
index a878b08..6d2e668 100644
--- a/slideshow/source/engine/OGLTrans/generic/OGLTrans_TransitionerImpl.cxx
+++ b/slideshow/source/engine/OGLTrans/generic/OGLTrans_TransitionerImpl.cxx
@@ -957,6 +957,31 @@ namespace
     }
 }
 
+namespace {
+
+void buildMipmaps(
+    GLint internalFormat, GLsizei width, GLsizei height, GLenum format,
+    GLenum type, const void * data)
+{
+    if (GLEW_ARB_framebuffer_object) {
+        glTexImage2D(
+            GL_TEXTURE_2D, 0, internalFormat, width, height, 0, format, type,
+            data);
+        glGenerateMipmap(GL_TEXTURE_2D);
+    } else {
+        glTexParameteri(GL_TEXTURE_2D, GL_GENERATE_MIPMAP, GL_TRUE);
+        glTexImage2D(
+            GL_TEXTURE_2D, 0, internalFormat, width, height, 0, format, type,
+            data);
+        glTexParameteri(GL_TEXTURE_2D, GL_GENERATE_MIPMAP, GL_FALSE);
+    }
+    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
+    glTexParameteri(
+        GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
+}
+
+}
+
 void OGLTransitionerImpl::impl_createTexture(
                      bool useMipmap,
                      uno::Sequence<sal_Int8>& data,
@@ -970,17 +995,12 @@ void OGLTransitionerImpl::impl_createTexture(
             maSlideBitmapLayout.ColorSpace->convertToIntegerColorSpace(
                 data,
                 getOGLColorSpace()));
-        SAL_WNODEPRECATED_DECLARATIONS_PUSH //TODO: 10.9 gluBuild2DMipmaps
-        gluBuild2DMipmaps(GL_TEXTURE_2D,
-                          4,
+        buildMipmaps(     4,
                           maSlideSize.Width,
                           maSlideSize.Height,
                           GL_RGBA,
                           GL_UNSIGNED_BYTE,
                           &tempBytes[0]);
-        SAL_WNODEPRECATED_DECLARATIONS_POP
-        glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR);
-        glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR_MIPMAP_LINEAR); //TRILINEAR FILTERING
 
         //anistropic filtering (to make texturing not suck when looking at polygons from oblique angles)
         GLfloat largest_supported_anisotropy;
@@ -992,11 +1012,7 @@ void OGLTransitionerImpl::impl_createTexture(
             glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_NEAREST);
             glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_NEAREST);
         } else {
-            SAL_WNODEPRECATED_DECLARATIONS_PUSH //TODO: 10.9 gluBuild2DMipmaps
-            gluBuild2DMipmaps( GL_TEXTURE_2D, pFormat->nInternalFormat, maSlideSize.Width, maSlideSize.Height, pFormat->eFormat, pFormat->eType, &data[0] );
-            SAL_WNODEPRECATED_DECLARATIONS_POP
-            glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
-            glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR ); //TRILINEAR FILTERING
+            buildMipmaps( pFormat->nInternalFormat, maSlideSize.Width, maSlideSize.Height, pFormat->eFormat, pFormat->eType, &data[0] );
 
             //anistropic filtering (to make texturing not suck when looking at polygons from oblique angles)
             GLfloat largest_supported_anisotropy;


More information about the Libreoffice-commits mailing list