Paste P226

Masterwork From Distant Lands
ActivePublic

Authored by dkazakov on May 31 2018, 3:27 PM.
diff --git a/libs/ui/canvas/kis_canvas2.cpp b/libs/ui/canvas/kis_canvas2.cpp
index 416d73e..f3131b8 100644
--- a/libs/ui/canvas/kis_canvas2.cpp
+++ b/libs/ui/canvas/kis_canvas2.cpp
@@ -140,6 +140,8 @@ public:
QPointer<KoShapeManager> currentlyActiveShapeManager;
KisInputActionGroupsMask inputActionGroupsMask = AllActionGroup;
+ KisSignalCompressor frameStartCompressor;
+
KisSignalCompressor regionOfInterestUpdateCompressor;
QRect regionOfInterest;
@@ -195,6 +197,9 @@ KisCanvas2::KisCanvas2(KisCoordinatesConverter *coordConverter, KoCanvasResource
m_d->updateSignalCompressor.setDelay(1000 / config.fpsLimit());
m_d->updateSignalCompressor.setMode(KisSignalCompressor::FIRST_ACTIVE);
+
+ m_d->frameStartCompressor.setDelay(1000 / config.fpsLimit());
+ m_d->frameStartCompressor.setMode(KisSignalCompressor::FIRST_ACTIVE);
}
void KisCanvas2::setup()
@@ -235,6 +240,11 @@ void KisCanvas2::setup()
globalShapeManager()->selection(), SIGNAL(currentLayerChanged(const KoShapeLayer*)));
connect(&m_d->updateSignalCompressor, SIGNAL(timeout()), SLOT(slotDoCanvasUpdate()));
+
+ connect(this, SIGNAL(sigCanvasCacheUpdated()), &m_d->frameStartCompressor, SLOT(start()));
+ connect(&m_d->frameStartCompressor, SIGNAL(timeout()), SLOT(updateCanvasProjection()));
+
+
connect(&m_d->regionOfInterestUpdateCompressor, SIGNAL(timeout()), SLOT(slotUpdateRegionOfInterest()));
initializeFpsDecoration();
@@ -542,7 +552,7 @@ void KisCanvas2::initializeImage()
m_d->toolProxy.initializeImage(image);
connect(image, SIGNAL(sigImageUpdated(QRect)), SLOT(startUpdateCanvasProjection(QRect)), Qt::DirectConnection);
- connect(this, SIGNAL(sigCanvasCacheUpdated()), SLOT(updateCanvasProjection()));
+ //connect(this, SIGNAL(sigCanvasCacheUpdated()), SLOT(updateCanvasProjection()));
connect(image, SIGNAL(sigProofingConfigChanged()), SLOT(slotChangeProofingConfig()));
connect(image, SIGNAL(sigSizeChanged(const QPointF&, const QPointF&)), SLOT(startResizingImage()), Qt::DirectConnection);
connect(this, SIGNAL(sigContinueResizeImage(qint32,qint32)), SLOT(finishResizingImage(qint32,qint32)));
@@ -736,17 +746,25 @@ void KisCanvas2::startUpdateCanvasProjection(const QRect & rc)
void KisCanvas2::updateCanvasProjection()
{
+ KisOpenGLCanvas2 *canvas = dynamic_cast<KisOpenGLCanvas2*>(m_d->canvasWidget);
+
+ canvas->makeCurrent();
+
while (KisUpdateInfoSP info = m_d->projectionUpdatesCompressor.takeUpdateInfo()) {
QRect vRect = m_d->canvasWidget->updateCanvasProjection(info);
if (!vRect.isEmpty()) {
- updateCanvasWidgetImpl(m_d->coordinatesConverter->viewportToWidget(vRect).toAlignedRect());
+ //updateCanvasWidgetImpl(m_d->coordinatesConverter->viewportToWidget(vRect).toAlignedRect());
}
}
// TODO: Implement info->dirtyViewportRect() for KisOpenGLCanvas2 to avoid updating whole canvas
if (m_d->currentCanvasIsOpenGL) {
- updateCanvasWidgetImpl();
+ //updateCanvasWidgetImpl();
+ m_d->savedUpdateRect = QRect();
+ slotDoCanvasUpdate();
}
+
+ canvas->doneCurrent();
}
void KisCanvas2::slotDoCanvasUpdate()
diff --git a/libs/ui/opengl/kis_opengl_canvas2.cpp b/libs/ui/opengl/kis_opengl_canvas2.cpp
index eba77f3..48ff815 100644
--- a/libs/ui/opengl/kis_opengl_canvas2.cpp
+++ b/libs/ui/opengl/kis_opengl_canvas2.cpp
@@ -918,7 +918,7 @@ QRect KisOpenGLCanvas2::updateCanvasProjection(KisUpdateInfoSP info)
* transparent.
*/
- glFinish();
+ //glFinish();
#endif
return QRect(); // FIXME: Implement dirty rect for OpenGL
dkazakov edited the content of this paste. (Show Details)May 31 2018, 3:27 PM
dkazakov changed the title of this paste from untitled to Masterwork From Distant Lands.
dkazakov updated the paste's language from autodetect to autodetect.

Test plan

  1. Start Krita
  2. Enable openGL canvas before opening any document (otherwise it crashes)
  3. Open a document of 8000x6000 pixels
  4. Start drawing with Basic-1 brush very quickly

You should not see any artifacts or lost tiles on the canvas

  1. Connect tablet
  2. Start painting with a stylus with very quick strokes

The lines should be much smoother than without the patch