From 6bf1f4bb96832837a186a141098fd8d522e7e942 Mon Sep 17 00:00:00 2001 From: dmitry Date: Thu, 1 Jul 2010 06:48:58 +0000 Subject: [PATCH] carbon: fix bitmap's floodfilling git-svn-id: trunk@26378 - --- lcl/interfaces/carbon/carbongdiobjects.pp | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/lcl/interfaces/carbon/carbongdiobjects.pp b/lcl/interfaces/carbon/carbongdiobjects.pp index 2d06c26b12..c07b5c7129 100644 --- a/lcl/interfaces/carbon/carbongdiobjects.pp +++ b/lcl/interfaces/carbon/carbongdiobjects.pp @@ -2547,7 +2547,6 @@ begin try GetRGBA(Bitmap, x,y, sr, sg, sb, sa, clpos); if (sr=r) and (sg=g) and (sb=b) then Exit; - SetLength(data, Bitmap.Width*Bitmap.Height); cnt:=1; data[0].x:=x; @@ -2562,16 +2561,14 @@ begin begin i:=x+dx[k]; j:=y+dy[k]; - for j:=Max(0, y-1) to Min(Bitmap.Height-1, y+1) do + if (i<0) or (j<0) or (i>=Bitmap.Width) or (j>=Bitmap.Height) then Continue; + GetRGBA(Bitmap, i,j, tr, tg, tb, ta, clPos); + if (tr=sr) and (tg=sg) and (tb=sb) then begin - GetRGBA(Bitmap, i,j, tr, tg, tb, ta, clPos); - if (tr=sr) and (tg=sg) and (tb=sb) then - begin - SetRGBA(Bitmap, i,j, r, g, b, a, clPos); - data[cnt].X:=i; - data[cnt].Y:=j; - inc(cnt); - end; + SetRGBA(Bitmap, i,j, r, g, b, a, clPos); + data[cnt].X:=i; + data[cnt].Y:=j; + inc(cnt); end; end; dec(cnt);