From: warwick Date: Tue, 22 Jan 2002 08:44:37 +0000 (+0000) Subject: Fix some crashes in unused tile editor. X-Git-Tag: MOVE2GIT~3393 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=3c0c8b0516305e1b7833e738f023b6848f1cb5f7;p=nethack Fix some crashes in unused tile editor. tileedit is the program I use to edit tile files (directly). --- 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);