From 3c0c8b0516305e1b7833e738f023b6848f1cb5f7 Mon Sep 17 00:00:00 2001 From: warwick Date: Tue, 22 Jan 2002 08:44:37 +0000 Subject: [PATCH] Fix some crashes in unused tile editor. tileedit is the program I use to edit tile files (directly). --- win/Qt/tileedit.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) 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);