[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-games-devel
Subject: Re: [Kde-games-devel] Fwd: Re: SVG Rendering speed
From: Luciano Montanaro <mikelima () gmail ! com>
Date: 2007-09-29 9:45:15
Message-ID: 200709291145.15267.mikelima () gmail ! com
[Download RAW message or body]
Il Saturday 29 September 2007 03:57:46 Ian Wadham ha scritto:
> Re KGoldrunner ...
>
> On Sun, 23 Sep 2007 07:01 pm, Andreas Pakulat wrote:
> > There's only a slight delay for the initial
> > rendering and I can see the playground being first rendered in
> > "half-screen" mode (i.e. its about as large as the select-game-dialog)
> > and then after a second it gets fullscreen as the rest of the
> > application.
>
> This seems to be as good as I can get it. It is still doing just one SVG
> load and render at startup ... and the Main Window is still giving two
> resize events, one of which KGoldrunner ignores.
>
> I do notice a big hole appearing when the initial dialog box closes, even
> though you can grab the dialog box and move it around rapidly without
> any loss of graphics quality. And it seems to take far too long for
> KGameCanvas/QPainter/QWidget/X (even) to repaint over it, even
> though the whole main window has been loaded, rendered and painted.
>
> I believe this is an unavoidable consequence of the way Qt does painting
> - or so I was once told by a Qt developer - but is there some way to soften
> or reduce the effect? It's really ugly. I'm working with *no* graphics
> acceleration on a Pentium 4, 2.4GHz CPU with 256Mb RAM.
>
> Re KShisen ...
> With QT_FLUSH_PAINT=1 I get *three* full-window flashes every time
> I make a move - in different colors.
>
Can you try the patch in the attachment? It brings down the flashes to two for
me. I can't see any problems, but I have not tested extensively.
I think we can tweak it some more to update smaller portions of the screen, if
it is needed.
I updated my old desktop to a recent distro, and now render seem to be
accelerated better on the Radeon. It's still not very fast, but the delay is
now acceptable for me. So I need someone else to do the tests...
Luciano
["0001-Test-using-update-instead-of-repaint.patch" (text/x-diff)]
From a0fc7b3a40fd654ee237258d8822c8667df83cf7 Mon Sep 17 00:00:00 2001
From: Luciano Montanaro <mikelima@zaphod.(none)>
Date: Mon, 24 Sep 2007 08:12:07 +0200
Subject: [PATCH 1/1] Test using update() instead of repaint().
With repaint, there seem to be an unnecessary screen update which is quite
noticeable on slower machines, or when render is not accelerated.
---
kshisen/board.cpp | 17 +++++++++++++++--
1 files changed, 15 insertions(+), 2 deletions(-)
diff --git a/kshisen/board.cpp b/kshisen/board.cpp
index 5bff054..9f36e7a 100644
--- a/kshisen/board.cpp
+++ b/kshisen/board.cpp
@@ -38,6 +38,7 @@
*******************************************************************
*/
+#define USE_UPDATE 1
#include "board.h"
#include <klocale.h>
@@ -625,7 +626,11 @@ void Board::updateField(int x, int y)
tiles.width(),
tiles.height());
+#ifdef USE_UPDATE
+ update(r);
+#else
repaint(r);
+#endif
}
void Board::paintEvent(QPaintEvent *e)
@@ -1432,9 +1437,13 @@ void Board::drawConnection(int timeout)
if(connection.isEmpty())
return;
+ int x1 = connection.first().x;
+ int y1 = connection.first().y;
+ int x2 = connection.last().x;
+ int y2 = connection.last().y;
// lighten the fields
- updateField(connection.first().x, connection.first().y);
- updateField(connection.last().x, connection.last().y);
+ updateField(x1, y1);
+ updateField(x2, y2);
_connectionTimeout = timeout;
_paintConnection = true;
@@ -1448,7 +1457,11 @@ void Board::undrawConnection()
setField(tileRemove1.first, tileRemove1.second, EMPTY);
setField(tileRemove2.first, tileRemove2.second, EMPTY);
tileRemove1.first = -1;
+#ifdef USE_UPDATE
+ update();
+#else
repaint();
+#endif
}
/*if(grav_col_1 != -1 || grav_col_2 != -1)
--
1.5.2.5
_______________________________________________
kde-games-devel mailing list
kde-games-devel@kde.org
https://mail.kde.org/mailman/listinfo/kde-games-devel
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic