Fixed preview updates drawing outside pixbuf on resize
This commit is contained in:
parent
a3d2150349
commit
5f8cd19e0c
2 changed files with 7 additions and 10 deletions
|
@ -118,7 +118,7 @@ public:
|
|||
|
||||
if (changed)
|
||||
{
|
||||
_need_render = not _preview->commitChunkTransaction(&pixbuf, _xstart, _ystart, _xsize, _ysize, revision);
|
||||
_need_render = not _preview->commitChunkTransaction(pixbuf, _xstart, _ystart, _xsize, _ysize, revision);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -613,7 +613,7 @@ QImage BasePreview::startChunkTransaction(int x, int y, int w, int h, int* revis
|
|||
return result;
|
||||
}
|
||||
|
||||
bool BasePreview::commitChunkTransaction(QImage* chunk, int x, int y, int w, int h, int revision)
|
||||
bool BasePreview::commitChunkTransaction(const QImage &chunk, int x, int y, int w, int h, int revision)
|
||||
{
|
||||
bool result;
|
||||
|
||||
|
@ -621,13 +621,8 @@ bool BasePreview::commitChunkTransaction(QImage* chunk, int x, int y, int w, int
|
|||
|
||||
if (revision == _revision)
|
||||
{
|
||||
for (int ix = 0; ix < w; ix++)
|
||||
{
|
||||
for (int iy = 0; iy < h; iy++)
|
||||
{
|
||||
_pixbuf->setPixel(x + ix, y + iy, chunk->pixel(ix, iy));
|
||||
}
|
||||
}
|
||||
QPainter painter(_pixbuf);
|
||||
painter.drawImage(x, y, chunk, 0, 0, w, h);
|
||||
emit contentChange();
|
||||
result = true;
|
||||
}
|
||||
|
@ -740,6 +735,8 @@ void BasePreview::resizeEvent(QResizeEvent* event)
|
|||
|
||||
delete image;
|
||||
|
||||
_revision++;
|
||||
|
||||
this->_lock_drawing->unlock();
|
||||
}
|
||||
|
||||
|
|
|
@ -48,7 +48,7 @@ public:
|
|||
void redraw();
|
||||
|
||||
QImage startChunkTransaction(int x, int y, int w, int h, int* revision);
|
||||
bool commitChunkTransaction(QImage* chunk, int x, int y, int w, int h, int revision);
|
||||
bool commitChunkTransaction(const QImage &chunk, int x, int y, int w, int h, int revision);
|
||||
void rollbackChunkTransaction();
|
||||
|
||||
QColor getPixelColor(int x, int y);
|
||||
|
|
Loading…
Reference in a new issue