View Issue Details

IDProjectCategoryView StatusLast Update
0008548ScribusCanvaspublic2015-12-08 12:19
ReporterOssiLehtinen Assigned Tojghali  
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
PlatformLinuxOSUbuntuOS Version9.04
Product Version1.5.0svn 
Target Version1.5.1Fixed in Version1.4.6.svn 
Summary0008548: redrawing the canvas goes wrong when object moved with arrow keys forcing the canvas to scroll
DescriptionIf one moves an object with arrow keys and 'hits' the edge of the view, the canvas starts scrolling, but the redrawing of stuff doesn't work properly. In the attached image the rectangle was moved over the top edge and perhaps a little horizontally as well.
Steps To ReproduceMake an empty document. Create a box. Select it. Move it over the edge with e.g. up arrow key.
Additional InformationAlso it seems, that if I then grab the object with the mouse, everything updates correctly, but after wards the edge detection goes haywire. I mean when I again move the object over the edge, the view starts moving only after I've goon some distance over or perhaps starts moving before I even hit the edge.
TagsNo tags attached.
PatchYes

Relationships

related to 0013470 closedjghali Missing Layout Update/Display Refresh for Text boxes using certain 'align and distribute' buttons 
child of 0013075 acknowledged Metabug: missing display refresh 

Activities

2009-10-27 12:51

 

screenshot.png (15,205 bytes)   
screenshot.png (15,205 bytes)   

jghali

2010-11-17 21:35

administrator   ~0024846

I committed a mitigation patch which allows to avoid the page offset one can observe in such case. That patch allows to preserve a correct redraw speed, but does not fix completly the issue. For now the solution i see to fix completely the redraw problems would induce a big hit in redraw speed when moving objects with arrow keys. Gonna try to find better solution first.

joan

2011-09-08 09:38

reporter  

Issue0008548.patch (3,852 bytes)   
Index: Scribus/scribus/scribusdoc.cpp
===================================================================
--- Scribus/scribus/scribusdoc.cpp	(revision 16820)
+++ Scribus/scribus/scribusdoc.cpp	(working copy)
@@ -9796,8 +9796,6 @@
 	currItem->moveBy(newX, newY);
 	if ((currItem->xPos() != oldx) || (currItem->yPos() != oldy))
 		retw = true;
-	//FIXME: stop using m_View
-	QRect oldR(currItem->getRedrawBounding(m_View->scale()));
 	setRedrawBounding(currItem);
 	currItem->OwnPage = OnPage(currItem);
 	return retw;
Index: Scribus/scribus/canvas.cpp
===================================================================
--- Scribus/scribus/canvas.cpp	(revision 16820)
+++ Scribus/scribus/canvas.cpp	(working copy)
@@ -585,21 +585,25 @@
 bool Canvas::adjustBuffer()
 {
 	bool ret = false;
+
 	QRect viewport(-x(), -y(), m_view->viewport()->width(), m_view->viewport()->height());
-// 	qDebug()<<"Canvas::adjustBuffer"<<viewport<<m_viewMode.forceRedraw<<m_viewMode.operItemSelecting;
+	// qDebug()<<"Canvas::adjustBuffer"<<viewport<<m_viewMode.forceRedraw<<m_viewMode.operItemSelecting;
+
+	bool minCanvasCoordHasChanged = false;
 	QPoint minCanvasCoordinate = canvasToLocal(QPointF(0.0, 0.0));
 	if (minCanvasCoordinate != m_oldMinCanvasCoordinate)
 	{
 		m_bufferRect.translate(minCanvasCoordinate.x() - m_oldMinCanvasCoordinate.x(),
 							   minCanvasCoordinate.y() - m_oldMinCanvasCoordinate.y());
 		m_oldMinCanvasCoordinate = minCanvasCoordinate;
+		minCanvasCoordHasChanged = true;
 	}
 #if DRAW_DEBUG_LINES
 //	qDebug() << "adjust buffer" << m_bufferRect << "for viewport" << viewport;
 #endif
-	if (!m_bufferRect.isValid())
+	if (!m_bufferRect.isValid() || minCanvasCoordHasChanged)
 	{
-//		qDebug() << "adjust buffer: invalid buffer, viewport" << viewport;
+		// qDebug() << "adjust buffer: invalid buffer, viewport" << viewport << m_bufferRect;
 		m_bufferRect = viewport;
 		m_buffer = QPixmap(m_bufferRect.width(), m_bufferRect.height());
 		fillBuffer(&m_buffer, m_bufferRect.topLeft(), m_bufferRect);
@@ -623,7 +627,7 @@
 			newRect.translate(0, viewport.top() - m_bufferRect.top());
 		if (m_bufferRect.bottom() < viewport.bottom())
 			newRect.translate(0, viewport.bottom() - m_bufferRect.bottom());
-//		qDebug() << "adjust buffer: " << m_bufferRect << "outside viewport" << viewport << " new rect:" << newRect;
+		// qDebug() << "adjust buffer: " << m_bufferRect << "outside viewport" << viewport << " new rect:" << newRect;
 		
 /*
 		// enlarge buffer by half a screenwidth:
@@ -650,9 +654,9 @@
 */
 		if (!m_bufferRect.intersects(newRect))
 		{
-//			qDebug() << "adjust buffer: fresh buffer" << m_bufferRect << "-->" << newRect;
+			// qDebug() << "adjust buffer: fresh buffer" << m_bufferRect << "-->" << newRect;
 			m_bufferRect = newRect;
-// 			m_buffer = QImage(m_bufferRect.width(), m_bufferRect.height(), QImage::Format_ARGB32);
+			// m_buffer = QImage(m_bufferRect.width(), m_bufferRect.height(), QImage::Format_ARGB32);
 			m_buffer = QPixmap(m_bufferRect.width(), m_bufferRect.height());
 			fillBuffer(&m_buffer, m_bufferRect.topLeft(), m_bufferRect);
 			ret = true;
@@ -667,7 +671,7 @@
 		else
 		{
 			// copy buffer:
-// 			QImage newBuffer(newRect.width(), newRect.height(), QImage::Format_ARGB32);
+			// QImage newBuffer(newRect.width(), newRect.height(), QImage::Format_ARGB32);
 			QPixmap newBuffer(newRect.width(), newRect.height());
 			QPainter p(&newBuffer);
 			int xpos = m_bufferRect.x() - newRect.x();
@@ -696,7 +700,7 @@
 			{
 				height = newRect.height() - ypos;
 			}
-// 			p.drawImage(xpos, ypos, m_buffer, x, y,  width + 1, height + 1); // FIXME: == params drawPixmap?
+			// p.drawImage(xpos, ypos, m_buffer, x, y,  width + 1, height + 1); // FIXME: == params drawPixmap?
 			p.drawPixmap(xpos, ypos, m_buffer, x, y,  width + 1, height + 1);
 #if DRAW_DEBUG_LINES
 			p.setPen(Qt::blue);
Issue0008548.patch (3,852 bytes)   

joan

2011-09-08 09:46

reporter   ~0026836

The solution I did will redraw the entire canvas every time minCanvasCoord is changing. But redraw only the correct part if the keyboard move didn't change the minCanvasCoord.

So it induce a "big hit in redraw speed" when moving objects with arrow keys if the direction is top or left AND the move change minCanvasCoord. Else it redraws only the needed rect.

Kunda

2015-06-19 18:24

updater   ~0035450

Last edited: 2015-06-19 18:31

Can confirm the phenomena still occurs on OSX 10.10.3 1.5.1svn r20174 Qt5.4.2

Added animated gif.
Not reliably able to reproduce offset of the borders like in the OPs screenshot. Still an issue but tricky to reproduce. I was able once by using left and right arrow keys while frame was over the borderline.

Kunda

2015-06-19 18:30

updater  

scribus-canvas-redraw.gif (104,269 bytes)   
scribus-canvas-redraw.gif (104,269 bytes)   

jghali

2015-11-06 07:36

administrator   ~0037277

Found a better way to fix the issue which do not trigger such a big hit in redraw speed.

Kunda

2015-11-06 12:45

updater   ~0037279

Fixed in r20538 by jghali
Thanks

Kunda

2015-11-10 20:33

updater   ~0037396

Closing.

jghali

2015-12-08 12:11

administrator   ~0037878

Backported fix to 1.4.6.svn

Kunda

2015-12-08 12:19

updater   ~0037881

r20616

Issue History

Date Modified Username Field Change
2009-10-27 12:51 OssiLehtinen New Issue
2009-10-27 12:51 OssiLehtinen File Added: screenshot.png
2009-10-28 00:06 christoph_s Status new => confirmed
2009-10-28 06:26 christoph_s Target Version => 1.3.6
2010-01-06 23:24 cbradney Target Version 1.3.6 => 1.3.7
2010-05-26 22:31 cbradney Target Version 1.3.7 => 1.3.8
2010-07-17 20:52 cbradney Target Version 1.3.8 => 1.3.9
2010-11-17 21:35 jghali Note Added: 0024846
2010-11-23 21:53 cbradney Target Version 1.3.9 => 1.4.0
2011-07-02 22:17 jghali Target Version 1.4.0 => 1.4.1.svn
2011-07-02 22:19 jghali Target Version 1.4.1.svn => 1.4.1
2011-09-08 09:38 joan File Added: Issue0008548.patch
2011-09-08 09:46 joan Note Added: 0026836
2012-04-29 21:14 cbradney Target Version 1.4.1 => 1.4.2
2013-01-13 21:32 cbradney Target Version 1.4.2 => 1.4.3
2013-07-04 20:25 cbradney Target Version 1.4.3 => 1.5.0
2014-07-03 04:32 Kunda Tag Attached: patch
2014-07-03 19:38 Kunda Target Version 1.5.0 => 1.5.1
2014-08-10 14:04 Kunda Summary The redrawing of the canvas goes wrong when object moved with arrow keys forcing the canvas to scroll => [PATCH]redrawing the canvas goes wrong when object moved with arrow keys forcing the canvas to scroll
2014-10-24 23:00 Kunda Patch => Yes
2015-06-19 18:24 Kunda Note Added: 0035450
2015-06-19 18:30 Kunda File Added: scribus-canvas-redraw.gif
2015-06-19 18:31 Kunda Note Edited: 0035450
2015-11-06 07:35 jghali Summary [PATCH]redrawing the canvas goes wrong when object moved with arrow keys forcing the canvas to scroll => redrawing the canvas goes wrong when object moved with arrow keys forcing the canvas to scroll
2015-11-06 07:36 jghali Note Added: 0037277
2015-11-06 07:36 jghali Status confirmed => resolved
2015-11-06 07:36 jghali Fixed in Version => 1.5.1svn
2015-11-06 07:36 jghali Resolution open => fixed
2015-11-06 07:36 jghali Assigned To => jghali
2015-11-06 11:34 Kunda Relationship added related to 0013470
2015-11-06 11:35 Kunda Relationship added child of 0013075
2015-11-06 12:45 Kunda Note Added: 0037279
2015-11-06 12:45 Kunda Tag Detached: patch
2015-11-10 20:33 Kunda Note Added: 0037396
2015-11-10 20:33 Kunda Status resolved => closed
2015-12-08 12:11 jghali Note Added: 0037878
2015-12-08 12:11 jghali Fixed in Version 1.5.1svn => 1.4.6.svn
2015-12-08 12:19 Kunda Note Added: 0037881