Version: 0.4 (using Devel)
Compiler: GCC 4.3.2
Installed from: Compiled sources
Running a large grid size with computer players in KSquares is not feasible because of a large amount of repaints being done which should not happen.
If you enable the 'Show Paint' Desktop effect it becomes clear that all repaints do a full repaint from the bottom upwards (when putting a line one the bottom row only a small part, when placing a line on the top row almost the whole view gets repainted).
I tried to fix it by myself but I cannot find the cause, since in gameboardscene.cpp only update(line->boundingRect()); is called. Lowering the spacing to for example 10 already has an advantageous effect I think because the amount of scaling that needs to be done by the graphicsview is greatly decreased/upscaling is easier than downscaling.
To me it looks like the cause can be in the fact that a new QGraphicsLineItem is added and that this might trigger a global update in the QGraphicsView?.
Also the highlight effect decreases speed a lot. It takes up to 2 seconds before I can do a new move after a computer player on a 50x30 grid. When disabling this effect in the source code the application runs a lot smoother.
Can you try if setting QGraphicsScene::NoIndex to the scene fixes the problem too?
In both SVN and 4.3 setting this->setItemIndexMethod(QGraphicsScene::NoIndex) in the constructor of gameboardscene.cpp does not work, the reapints still all happen. the index is set nowhere else.
I think i know the problem, there are two combined problems:
* Qt sucks at rendering long dashed lines
* KSquares uses lots of long dashed lines
Can you check that disabling dashes, by chaning
in gameboardscene.cpp give you a noticeable gain? It did for me
If that's the case and you have time, you should try converting the long dashed lines to short ones, that is doing one per square side instead one per each "row"
I checked alot when I was trying to fix it and it is already using short dashed lines, that was something i thought that was the problem. When you click a line it overlays a non-dashed line at the position of a dashed line. it does a line->getindex -> draw new line at that position type scheme to add a move.
SVN commit 1011981 by aacid:
backport r1011979 | aacid | 2009-08-16 16:30:25 +0200 (Sun, 16 Aug 2009) | 3 lines
QGraphicsScene does not like items being deleted without being removed and that cuases lots of redraws
M +9 -1 highlightanimation.cpp
M +1 -0 highlightanimation.h
WebSVN link: http://websvn.kde.org/?view=rev&revision=1011981
Forgot to add comment:
When starting with quickstart with 4 computer players the filling of squares is still slow
Closing, there's no huge repainting anymore, just that the AI blocks (bug 204061)