Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit 95b972e8 authored by Thorsten Zachmann's avatar Thorsten Zachmann

o Fix pixmap generation to contain the content of all painted shapes

  fully.
  This fixes various problems in kpresenter, kopageapp and other places
  where a KoShapePainter is used to get a pixmap of the shapes.

svn path=/trunk/koffice/; revision=1011567
parent c93b7996
......@@ -848,9 +848,10 @@ void KoShape::setName(const QString & name)
d->name = name;
}
void KoShape::waitUntilReady(const KoViewConverter &converter) const
void KoShape::waitUntilReady(const KoViewConverter &converter, bool asynchronous) const
{
Q_UNUSED(converter);
Q_UNUSED(asynchronous);
}
void KoShape::deleteLater()
......
......@@ -708,14 +708,17 @@ public:
/**
* A shape can be in a state that it is doing processing data like loading or text layout.
* In which case
* it can be shown on screen just fine (probably partially) but it should really not be printed
* In this case it can be shown on screen probably partially but it should really not be printed
* until it is fully done processing.
* Flake will call this method from a non-main thread and only start printing it when the
* method returned.
* Warning! This method can be blocking for a long time, never call it on the gui-thread!
*/
virtual void waitUntilReady(const KoViewConverter &converter) const;
* Warning! This method can be blocking for a long time
* @param asynchronous If set to true the processing will can take place in a different thread and the
* function will not block until the shape is finised.
* In case of printing Flake will call this method from a non-main thread and only
* start printing it when the in case of printing method returned.
* If set to false the processing needs to be done synchronously and will
* block until the result is finished.
*/
virtual void waitUntilReady(const KoViewConverter &converter, bool asynchronous = true) const;
/**
* Schedule the shape for thread-safe deletion.
......
......@@ -28,6 +28,7 @@
#include <KoShape.h>
#include <KoShapeBorderModel.h>
#include <KoShapeGroup.h>
#include <KoShapeContainer.h>
#include <QtGui/QImage>
......@@ -136,6 +137,10 @@ void KoShapePainter::setShapes( const QList<KoShape*> &shapes )
void KoShapePainter::paintShapes( QPainter & painter, KoViewConverter & converter )
{
foreach (KoShape *shape, d->canvas->shapeManager()->shapes()) {
shape->waitUntilReady(converter, false);
}
d->canvas->shapeManager()->paint( painter, converter, true );
}
......
......@@ -321,6 +321,7 @@ bool Layout::nextParag()
const qreal offsetInShape = m_y - m_data->documentOffset();
shape->update(QRectF(0.0, offsetInShape, shape->size().width(), shape->size().height() - offsetInShape));
// cleanup and repaint rest of shapes.
m_data->wipe();
m_textShape->markLayoutDone();
cleanupShapes();
return false;
......
......@@ -359,17 +359,26 @@ void TextShape::markLayoutDone()
}
}
void TextShape::waitUntilReady(const KoViewConverter &) const
void TextShape::waitUntilReady(const KoViewConverter &, bool asynchronous) const
{
synchronized(m_mutex) {
if (m_textShapeData->isDirty()) {
m_textShapeData->fireResizeEvent(); // triggers a relayout
if (QThread::currentThread() != QApplication::instance()->thread()) {
// only wait if this is called in the non-main thread.
// this avoids locks due to the layout code expecting the GUI thread to be free while layouting.
m_waiter.wait(&m_mutex);
if (asynchronous) {
synchronized(m_mutex) {
if (m_textShapeData->isDirty()) {
m_textShapeData->fireResizeEvent(); // triggers a relayout
if (QThread::currentThread() != QApplication::instance()->thread()) {
// only wait if this is called in the non-main thread.
// this avoids locks due to the layout code expecting the GUI thread to be free while layouting.
m_waiter.wait(&m_mutex);
}
}
}
}
else {
KoTextDocumentLayout *lay = dynamic_cast<KoTextDocumentLayout*>(m_textShapeData->document()->documentLayout());
if ( lay ) {
while (m_textShapeData->isDirty()){
lay->layout();
}
}
}
}
......@@ -51,7 +51,7 @@ public:
/// reimplemented
void paintDecorations(QPainter &painter, const KoViewConverter &converter, const KoCanvasBase *canvas);
/// reimplemented
virtual void waitUntilReady(const KoViewConverter &converter) const;
virtual void waitUntilReady(const KoViewConverter &converter, bool asynchronous) const;
/// helper method.
QPointF convertScreenPos(const QPointF &point);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment