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

List:       kde-commits
Subject:    koffice/krita/ui
From:       Adrian Page <adrian () pagenet ! plus ! com>
Date:       2007-04-01 0:13:39
Message-ID: 1175386419.351078.3835.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 648673 by page:

Start to make the OpenGL canvas work. It now displays the image but doesn't update or \
 scroll properly.



 M  +1 -0      kis_canvas2.cpp  
 M  +16 -17    kis_opengl_canvas2.cpp  
 M  +5 -5      kis_opengl_image_context.cc  


--- trunk/koffice/krita/ui/kis_canvas2.cpp #648672:648673
@@ -117,6 +117,7 @@
     m_d->openGLImageContext = 0;
 #endif
     setCanvasWidget( new KisQPainterCanvas( this, m_d->view ) );
+    m_d->currentCanvasIsOpenGL = false;
 }
 
 void KisCanvas2::createCanvas()
--- trunk/koffice/krita/ui/kis_opengl_canvas2.cpp #648672:648673
@@ -67,7 +67,7 @@
  };
 
 KisOpenGLCanvas2::KisOpenGLCanvas2( KisCanvas2 * canvas, QWidget * parent, \
                KisOpenGLImageContextSP context )
-    : QGLWidget( QGLFormat(QGL::SampleBuffers), parent )
+    : QGLWidget( QGLFormat(QGL::SampleBuffers), parent, \
context->sharedContextWidget() )  {
     m_d = new Private();
     m_d->canvas = canvas;
@@ -92,8 +92,8 @@
 {
     qglClearColor(QColor::fromCmykF(0.40, 0.0, 1.0, 0.0));
     glShadeModel(GL_FLAT);
-    glEnable(GL_DEPTH_TEST);
-    glEnable(GL_CULL_FACE);
+    //glEnable(GL_DEPTH_TEST);
+    //glEnable(GL_CULL_FACE);
 }
 
 void KisOpenGLCanvas2::resizeGL(int w, int h)
@@ -119,6 +119,19 @@
     if ( !img ) return;
     QRect vr = QRect(0, 0, width(), height());
 
+    // Zoom factor
+    double sx, sy;
+    m_d->viewConverter->zoom(&sx, &sy);
+
+    // Resolution
+    double pppx,pppy;
+    pppx = img->xRes();
+    pppy = img->yRes();
+
+    // Compute the scale factors
+    double scaleX = sx / pppx;
+    double scaleY = sy / pppy;
+
     glMatrixMode(GL_PROJECTION);
     glLoadIdentity();
     glViewport(0, 0, width(), height());
@@ -137,20 +150,6 @@
     glTexCoord2f(0.0, 0.0);
     glVertex2f(0.0, 0.0);
 
-    // Zoom factor
-    double sx, sy;
-    m_d->viewConverter->zoom(&sx, &sy);
-
-    // Resolution
-    double pppx,pppy;
-    pppx = img->xRes();
-    pppy = img->yRes();
-
-    // Compute the scale factors
-    double scaleX = sx / pppx;
-    double scaleY = sy / pppy;
-
-
     glTexCoord2f((img->width() * scaleX) / \
KisOpenGLImageContext::BACKGROUND_TEXTURE_WIDTH, 0.0);  glVertex2f(img->width() * \
scaleX, 0.0);  
--- trunk/koffice/krita/ui/kis_opengl_image_context.cc #648672:648673
@@ -161,7 +161,7 @@
 
 void KisOpenGLImageContext::updateImageTextureTiles(const QRect& rect)
 {
-    //kDebug(41007) << "updateImageTextureTiles " << rect << endl;
+    kDebug(41001) << "updateImageTextureTiles " << rect << endl;
 
     QRect updateRect = rect & m_image->bounds();
 
@@ -190,8 +190,8 @@
 
                 glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
 
-                QImage tileUpdateImage = \
                m_image->convertToQImage(tileUpdateRect.left(), tileUpdateRect.top(),
-                                                                  \
tileUpdateRect.right(), tileUpdateRect.bottom(), +                QImage \
tileUpdateImage = m_image->convertToQImage(tileUpdateRect.x(), tileUpdateRect.y(), +  \
                tileUpdateRect.width(), tileUpdateRect.height(),
                                                                   m_monitorProfile, \
m_exposure);  
                 if (m_displaySelection) {
@@ -205,13 +205,13 @@
                 if (tileUpdateRect.width() == m_imageTextureTileWidth && \
tileUpdateRect.height() == m_imageTextureTileHeight) {  
                     glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, \
                m_imageTextureTileWidth, m_imageTextureTileHeight, 0,
-                                 GL_BGRA, GL_UNSIGNED_BYTE, \
QGLWidget::convertToGLFormat( tileUpdateImage ).bits()); +                            \
GL_BGRA, GL_UNSIGNED_BYTE, tileUpdateImage.bits());  } else {
                     int xOffset = tileUpdateRect.x() - tileRect.x();
                     int yOffset = tileUpdateRect.y() - tileRect.y();
 
                     glTexSubImage2D(GL_TEXTURE_2D, 0, xOffset, yOffset, \
                tileUpdateRect.width(), tileUpdateRect.height(),
-                                    GL_BGRA, GL_UNSIGNED_BYTE, \
QGLWidget::convertToGLFormat( tileUpdateImage ).bits()); +                            \
GL_BGRA, GL_UNSIGNED_BYTE, tileUpdateImage.bits());  }
 
                 GLenum error = glGetError ();


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

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