[scribus-dev] Question about culling area

Elvis Stansvik elvstone at gmail.com
Thu Aug 11 06:08:57 UTC 2011


Hi,

The text frames of the cells are painted as part of the normal table
painting. However, I obviously don't want to re-paint the entire table
on each keystroke in a cell.

Currently, PageItem_Table::DrawObj_Item(...) sets the clip path to the
PoLine (frame rectangle) unconditionally before painting. Like this:

// Set the clip path.
p->setupPolygon(&PoLine);
p->setClipPath();

I would like to change this so that it actually respects the QRectF
argument passed to DrawObj_Item(..). This would allow me to do
something like this after text is typed in a cell:

m_canvas->update(canvasToLocal(cell.contentRect()));

A lot of unnecessary code paths would still be followed in the table
painting code, but at least the actual stroking where it's not needed
would be avoided.

There's a problem however: In PageItem::DrawObj(..), which is the
function calling my DrawObj_Item(..) there's this snippet of code:

if (cullingArea.isNull())
{
	cullingArea = QRectF(QPointF(m_Doc->minCanvasCoordinate.x(),
m_Doc->minCanvasCoordinate.y()),
							 QPointF(m_Doc->maxCanvasCoordinate.x(),
m_Doc->maxCanvasCoordinate.y())).toAlignedRect();
}

This means that if the passed rectangle is null, it's setting the
culling area to the entire canvas. Why is it doing this? Why not use
the bounding rectangle of the item?

Because of this, there's really no way for me to know when to use the
PoLine as clip path, and when to use the passed in rectangle.

I hope you see what I mean.

Regards,
Elvis



More information about the scribus-dev mailing list