Infinite canvas issues
Sven Langkamp
sven.langkamp at gmail.com
Sat Jul 4 02:29:15 CEST 2009
On Thu, Jul 2, 2009 at 6:24 PM, LukasT.dev at gmail.com
<lukast.dev at gmail.com>wrote:
> Today I resolved issue with update rectangle which is moved. It was in
>
> KisCanvas2::updateCanvasProjection(const QRect & rc)
> vRect had to be translated by origin
>
> Now the rect is in correct position from the view perspective
> There is line
> m_d->prescaledProjection->updateCanvasProjection(rc);
> which gets rc which is in image coordinates.
>
> in KisPrescaledProjection::updateCanvasProjection(const QRect & rc)
> ...
> // this does not have to be moved I think -- tool calls
> updateCanvasProjection
> // with rc in image coordinates
> m_d->projectionCache.updateUnscaledCache( rc );
>
> // this vRect is in view coordinates (widget coordinates I suppose too) and
> // probably should be moved by origin
> QRect vRect = viewRectFromImagePixels(rc);
> if (!vRect.isEmpty()) {
> preScale(vRect);
> }
> ...
>
> I will add document origin to prescale projection and test it
> If you have anything to say to this, let me know. And I invite you to play
> with the updated patch [1] ;)
>
> Thanks
> Lukas
>
> [1] http://lukast.mediablog.sk/patches/qpainter_infinite_canvas.2.patch
>
Sorry I missed you on IRC. From what I see in patch I think there is a
thinking error:
<snip>
} else {
// Checks
//gc.fillRect(ev->rect(), m_d->checkBrush);
gc.fillRect(ev->rect(), Qt::green);
}
}
gc.setCompositionMode(QPainter::CompositionMode_SourceOver);
gc.translate( m_d->origin.x(), m_d->origin.y() );
if (cfg.noXRender()) {
gc.drawPixmap(ev->rect(), m_d->prescaledProjection->prescaledPixmap(),
ev->rect());
} else {
gc.drawImage(ev->rect(), m_d->prescaledProjection->prescaledQImage(),
ev->rect());
}
gc.translate( -m_d->origin.x(), -m_d->origin.y() );
</snip>
More information about the kimageshop
mailing list