[scribus-dev] Preview when moving

Pierre Marchand pierremarc at oep-h.com
Fri Dec 12 12:13:42 CET 2008


Hi,
I write it here because I’m too tired to follow long IRC chats these evenings, 
but I’ll try to keep the IRC style! Plus I won’t be there for the entire 
week-end.

context: when I worked on Canvas speedup i found that easy way to get previews 
of frames when moving and I was so happy I’ve yet saved a bunch of cycles 
that I felt I could spend some of them in this nicety. 

Now, it appears that it did introduce a lag when move starts, which can become 
quickly unbearable for big text frames. At this point I did take a deep 
breath and tried to generate the preview in a separate thread (in the same 
time fixing the low resolution of the preview). As you can imagine, it brings 
its own problems as long as PageItem is not exactly reentrant etc… But i 
finally got a working prototype --- modulo a high rate of segfaults caused by 
the yet mentioned reentrance problem (that could be *easily* fixed since we 
never go into layout() when preparing a preview). Frankly it’s _really_ cool 
to use when you get an accurate preview and it keeps it reactive, note it 
because it’s why I did not give up! :-) So I was play^^testing with it and 
make more & more huge frames, preparing a glass in the other hand, smiling 
till my ears because it was sooo cool and smooth. There I’ve had the idea to 
enjoy myself with the high res preview which allow precise positioning of 
_content_, thus zooming in. My glass fell down, my smile vanished. Yeah, it 
needs a huge amount of memory to store a scaled QImage of a frame, here is 
the hole:
	QImage retImg = 
QImage(qRound(gWidth*canvaScale),qRound(gHeight*canvaScale),QImage::Format_ARGB32);

where "canvaScale = m_Doc->view()->scale()", can be more than 20. "adieu veau, 
vache, cochon, couvée;" (VII, 9) Hopefully Craig came with an idea, drawing 
the preview as other objects, directly onto the visible part of the Canvas. 
It works, but sadly it reintroduces lag in the process, and continuously 
since you redraw it at each paint event.

My (temporary) conclusion, I got an acceptable solution when limiting the 
scale value for the preview with 
"canvaScale = qMin(m_Doc->view()->scale() ,6.0);" and thought it could be user 
defined, where he (the user) could adjust with his available memory (1G only 
here with Kdevelop always eating 250M & shared mem video 128M). It means that 
when zooming in a lot, you get less sharp shapes (though it’s still a way 
better than what’s in here by now). Or, second solution, give up with preview 
for 1.3.5., not to mention I’m pretty shared with this option :/

What’s yours?

-- 
Pierre Marchand
http://www.oep-h.com




More information about the scribus-dev mailing list