krita slow - tried with valgrind (cache)
Roger Larsson
roger.larsson at norran.net
Wed Feb 11 01:59:32 CET 2004
On Tuesday 10 February 2004 21.31, Boudewijn Rempt wrote:
> On Tuesday 10 February 2004 02:37, you wrote:
>
> (Cc'd to the list, because Patrick might be able to correct me in places.)
>
> > Very few misses - but X is not included...
> > But probably it burns CPU cycles on its own.
> >
> > How about a test - no explicit updates. Only updates on View->Redisplay.
> > Will it be able to keep up?
>
> Nope... I tried that today, and it still cannot handle mouse movement as
> quick as the Gimp. Now I know that a) the Gimp is really optimized and b)
> GTK/GDK seems to have really fast routines for displaying bits of memory
> that happen to contain image data, but it should be possible to speed Krita
> up so it becomes usable. And I haven't even done the necessary code for
> sub-pixel positioning of brushes, so the lines aren't even anti-aliased.
>
> But I'm not nearly close to anything approaching knowledgability; all I
> know I have from http://www.levien.com/gimp/brush-arch.html and the source
> of the Gimp, which I don't understand much.
>
> The redisplay and the painting code are already pretty well separated -- I
> don't know whether you have the Krita code handy, but what happens when
> painting is:
>
> kis_tool_brush.cc: from mouseMoveEvent, paintLine is called, with the the
> previous mouse position and the current position (which should be as small
> as possible). paintLine calls KisPainter::paintLine. Here, we check whether
> the delta between pos1 and pos2 was big enough so we need to paint.
>
This line can become costly - if called often enough...
length = sqrt (length);
To get this correct to the last decimal will take time - possibly usage of
compilation option -ffast_math could help...
1) So - removed it instead... (temporarily)
2) I wonder if the m_dirtyRect reset disturbed your update at timer tests?
3) And finally a m_painter NULL virtual call problem.
The update is strange - I move, stop, but the drawing stops too!? Why???
/RogerL
Index: core/kis_painter.cc
===================================================================
RCS file: /home/kde/koffice/krita/core/kis_painter.cc,v
retrieving revision 1.66
diff -u -3 -p -r1.66 kis_painter.cc
--- core/kis_painter.cc 6 Feb 2004 20:12:25 -0000 1.66
+++ core/kis_painter.cc 11 Feb 2004 00:03:46 -0000
@@ -517,7 +517,9 @@ void KisPainter::fillRect(Q_INT32 x1, Q_
}
QRect KisPainter::dirtyRect() {
- return m_dirtyRect;
+ QRect dirtyRect = m_dirtyRect;
+ m_dirtyRect = QRect();
+ return dirtyRect;
}
@@ -579,7 +581,6 @@ float KisPainter::paintLine(const QPoint
float l_savedDist = savedDist;
if (static_cast<int>(dist) < spacing) {
- m_dirtyRect = QRect();
return dist;
}
@@ -589,7 +590,7 @@ float KisPainter::paintLine(const QPoint
y = dragVec.y();
z = dragVec.z();
length = x * x + y * y + z * z;
- length = sqrt (length);
+// length = sqrt (length);
if (length)
{
@@ -718,7 +719,6 @@ float KisPainter::eraseLine(const QPoint
float l_savedDist = savedDist;
if (static_cast<int>(dist) < spacing) {
- m_dirtyRect = QRect();
return dist;
}
Index: core/kis_painter.h
===================================================================
RCS file: /home/kde/koffice/krita/core/kis_painter.h,v
retrieving revision 1.36
diff -u -3 -p -r1.36 kis_painter.h
--- core/kis_painter.h 3 Feb 2004 21:32:27 -0000 1.36
+++ core/kis_painter.h 11 Feb 2004 00:03:46 -0000
@@ -114,6 +114,7 @@ public:
// The methods below are 'higher' level than the above methods. They
need brushes, colors etc.
// set before they can be called. The methods do not directly tell the
image to update, but
// you can call dirtyRect() to get the rect that needs to be notified
by your painting code.
+ // Call will reset it!
QRect dirtyRect();
//
------------------------------------------------------------------------------------------
Index: tools/kis_tool_line.cc
===================================================================
RCS file: /home/kde/koffice/krita/tools/kis_tool_line.cc,v
retrieving revision 1.24
diff -u -3 -p -r1.24 kis_tool_line.cc
--- tools/kis_tool_line.cc 6 Feb 2004 20:12:25 -0000 1.24
+++ tools/kis_tool_line.cc 11 Feb 2004 00:03:46 -0000
@@ -149,7 +149,11 @@ void KisToolLine::mouseRelease(QMouseEve
delete m_painter;
m_painter = 0;
}
- controller -> updateCanvas(m_painter -> dirtyRect()); //
Removes the last remaining line.
+ else
+ {
+ // m_painter can be 0 here...!!!
+ controller -> updateCanvas(m_painter -> dirtyRect()); //
Removes the last remaining line.
+ }
}
}
--
Roger Larsson
Skellefteå
Sweden
More information about the kimageshop
mailing list