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)
|
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
|
else
|
||||||
{
|
{
|
||||||
|
@ -613,7 +613,7 @@ QImage BasePreview::startChunkTransaction(int x, int y, int w, int h, int* revis
|
||||||
return result;
|
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;
|
bool result;
|
||||||
|
|
||||||
|
@ -621,13 +621,8 @@ bool BasePreview::commitChunkTransaction(QImage* chunk, int x, int y, int w, int
|
||||||
|
|
||||||
if (revision == _revision)
|
if (revision == _revision)
|
||||||
{
|
{
|
||||||
for (int ix = 0; ix < w; ix++)
|
QPainter painter(_pixbuf);
|
||||||
{
|
painter.drawImage(x, y, chunk, 0, 0, w, h);
|
||||||
for (int iy = 0; iy < h; iy++)
|
|
||||||
{
|
|
||||||
_pixbuf->setPixel(x + ix, y + iy, chunk->pixel(ix, iy));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
emit contentChange();
|
emit contentChange();
|
||||||
result = true;
|
result = true;
|
||||||
}
|
}
|
||||||
|
@ -740,6 +735,8 @@ void BasePreview::resizeEvent(QResizeEvent* event)
|
||||||
|
|
||||||
delete image;
|
delete image;
|
||||||
|
|
||||||
|
_revision++;
|
||||||
|
|
||||||
this->_lock_drawing->unlock();
|
this->_lock_drawing->unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -48,7 +48,7 @@ public:
|
||||||
void redraw();
|
void redraw();
|
||||||
|
|
||||||
QImage startChunkTransaction(int x, int y, int w, int h, int* revision);
|
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();
|
void rollbackChunkTransaction();
|
||||||
|
|
||||||
QColor getPixelColor(int x, int y);
|
QColor getPixelColor(int x, int y);
|
||||||
|
|
Loading…
Reference in a new issue