Commit ec32e6dc authored by Adrian Page's avatar Adrian Page

Fix the jitter when scrolling the OpenGL canvas in krita.

svn path=/trunk/koffice/; revision=650112
parent b6d523b4
......@@ -44,6 +44,23 @@ macro_optional_find_package(OpenEXR)
macro_bool_to_01(OPENEXR_FOUND HAVE_OPENEXR)
configure_file(config-openexr.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-openexr.h )
macro_optional_find_package(OpenGL)
set(HAVE_OPENGL 0)
if(OPENGL_FOUND)
message(STATUS "Found OpenGL: ${OPENGL_LIBRARIES}")
if(QT_QTOPENGL_FOUND)
message(STATUS "Found Qt OpenGL support")
set(HAVE_OPENGL 1)
else(QT_QTOPENGL_FOUND)
message(STATUS "Did NOT find Qt OpenGL support. Check your Qt configuration")
endif(QT_QTOPENGL_FOUND)
else(OPENGL_FOUND)
message(STATUS "Did NOT find OpenGL libraries")
endif(OPENGL_FOUND)
configure_file(config-opengl.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-opengl.h )
include (TestBigEndian)
TEST_BIG_ENDIAN(CMAKE_WORDS_BIGENDIAN)
configure_file(config-endian.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-endian.h )
......
......@@ -5,22 +5,6 @@ include(CheckFunctionExists)
if (SHOULD_BUILD_KRITA)
macro_optional_find_package(OpenGL)
set(HAVE_OPENGL 0)
if(OPENGL_FOUND)
message(STATUS "Found OpenGL: ${OPENGL_LIBRARIES}")
if(QT_QTOPENGL_FOUND)
message(STATUS "Found Qt OpenGL support")
set(HAVE_OPENGL 1)
else(QT_QTOPENGL_FOUND)
message(STATUS "Did NOT find Qt OpenGL support. Check your Qt configuration")
endif(QT_QTOPENGL_FOUND)
else(OPENGL_FOUND)
message(STATUS "Did NOT find OpenGL libraries")
endif(OPENGL_FOUND)
if(NOT HAVE_OPENGL)
message(STATUS " * krita will not be able to use OpenGL for")
message(STATUS " hardware accelerated rendering.")
......
/* config-krita.h. Generated by cmake from config-krita.h.cmake */
/* Defines if you have GL (Mesa, OpenGL, ...) */
#cmakedefine HAVE_OPENGL 1
/* Define if you have the X11 Input Extension */
#cmakedefine HAVE_XINPUTEXT 1
......
......@@ -19,6 +19,7 @@
*/
#include <config-krita.h>
#include <config-opengl.h>
#include <QBitmap>
#include <QCheckBox>
......
......@@ -21,6 +21,7 @@
#include "kis_grid_drawer.h"
#include <config-krita.h>
#include <config-opengl.h>
#ifdef HAVE_OPENGL
#include <qgl.h>
......
......@@ -21,6 +21,7 @@
#include "kis_grid_manager.h"
#include <config-krita.h>
#include <config-opengl.h>
#ifdef HAVE_OPENGL
#include <qgl.h>
......
......@@ -18,7 +18,10 @@
#ifndef KIS_OPENGL_CANVAS_2_H
#define KIS_OPENGL_CANVAS_2_H
#include "config-krita.h"
#include "config-opengl.h"
#ifdef HAVE_OPENGL
#include <QGLWidget>
......
......@@ -17,6 +17,7 @@
*/
#include <config-krita.h>
#include <config-opengl.h>
#ifdef HAVE_OPENGL
......
......@@ -19,6 +19,7 @@
#define KIS_OPENGL_IMAGE_CONTEXT_H_
#include <config-krita.h>
#include <config-opengl.h>
#ifdef HAVE_OPENGL
......
......@@ -102,6 +102,10 @@ kde4_add_library(flake SHARED ${flake_SRCS})
target_link_libraries(flake ${KDE4_KDEUI_LIBS} kofficecore pigment)
if(HAVE_OPENGL)
target_link_libraries(flake ${OPENGL_LIBRARIES} ${QT_QTOPENGL_LIBRARY})
endif(HAVE_OPENGL)
set_target_properties(flake PROPERTIES VERSION ${GENERIC_KOFFICE_LIB_VERSION} SOVERSION ${GENERIC_KOFFICE_LIB_SOVERSION} )
########### install files ###############
......
......@@ -35,6 +35,12 @@
#include <QScrollBar>
#include <QEvent>
#include <config-opengl.h>
#ifdef HAVE_OPENGL
#include <QGLWidget>
#endif
class KoCanvasController::Private
{
public:
......@@ -342,14 +348,33 @@ void KoCanvasController::setDocumentOffset()
if ( pt.y() > m_d->documentSize.height() ) pt.setY( m_d->documentSize.height() );
emit( moveDocumentOffset( pt ) );
if(m_d->canvas->canvasWidget()) {
QPoint diff = m_d->documentOffset - pt;
m_d->canvas->canvasWidget()->scroll(diff.x(), diff.y());
QWidget *canvasWidget = m_d->canvas->canvasWidget();
if (canvasWidget) {
if (!canvasIsOpenGL()) {
QPoint diff = m_d->documentOffset - pt;
canvasWidget->scroll(diff.x(), diff.y());
}
}
m_d->documentOffset = pt;
}
bool KoCanvasController::canvasIsOpenGL() const
{
QWidget *canvasWidget = m_d->canvas->canvasWidget();
if (canvasWidget) {
#ifdef HAVE_OPENGL
if (qobject_cast<QGLWidget*>(canvasWidget) != 0) {
return true;
}
#endif
}
return false;
}
void KoCanvasController::resetScrollBars()
{
// The scrollbar value always points at the top-left corner of the
......
......@@ -281,6 +281,7 @@ private:
void setDocumentOffset();
void resetScrollBars();
bool canvasIsOpenGL() const;
private:
......
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