diff --git a/win/Qt/tileedit.cpp b/win/Qt/tileedit.cpp index a594d3a7b..16e2002c1 100644 --- a/win/Qt/tileedit.cpp +++ b/win/Qt/tileedit.cpp @@ -180,9 +180,10 @@ void TrivialTileEditor::setColor( QRgb rgb ) { pen = rgb; for (penpixel = 0; - penpixelpos()); + if ( !img.rect().contains(p) ) + return; uchar& pixel = img.scanLine(p.y())[p.x()]; if ( e->button() == LeftButton ) { pixel = penpixel; @@ -226,7 +229,8 @@ void TrivialTileEditor::mousePressEvent(QMouseEvent* e) emit pick( img.color(pixel) ); } else if ( e->button() == MidButton ) { QPainter painter(this); - fill(painter,p,pixel); + if ( pixel != penpixel ) + fill(painter,p,pixel); } } @@ -253,6 +257,8 @@ void TrivialTileEditor::mouseReleaseEvent(QMouseEvent* e) void TrivialTileEditor::mouseMoveEvent(QMouseEvent* e) { QPoint p = imagePoint(e->pos()); + if ( !img.rect().contains(p) ) + return; uchar& pixel = img.scanLine(p.y())[p.x()]; pixel = penpixel; QPainter painter(this);