You've already forked lazarus-ccr
lazmapviewer: Better fix for crash when painting outside the buffer.
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@7170 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@@ -166,24 +166,24 @@ begin
|
|||||||
try
|
try
|
||||||
if UseAlphaChannel then begin
|
if UseAlphaChannel then begin
|
||||||
for j := 0 to intfImg.Height - 1 do
|
for j := 0 to intfImg.Height - 1 do
|
||||||
for i := 0 to intfImg.Width - 1 do begin
|
if InRange(j + Y, 0, FBuffer.Height - 1) then
|
||||||
cimg := intfImg.Colors[i, j];
|
for i := 0 to intfImg.Width - 1 do begin
|
||||||
alpha := cimg.Alpha / word($FFFF);
|
cimg := intfImg.Colors[i, j];
|
||||||
if not InRange(i + X, 0, FBuffer.Width-1) then
|
alpha := cimg.Alpha / word($FFFF);
|
||||||
Continue;
|
if InRange(i + X, 0, FBuffer.Width-1) then begin
|
||||||
if not InRange(j + Y, 0, FBuffer.Height-1) then
|
cbuf := FBuffer.Colors[i + X, j + Y];
|
||||||
Continue;
|
cbuf.Red := Round(alpha * cimg.Red + (1 - alpha) * cbuf.Red);
|
||||||
cbuf := FBuffer.Colors[i + X, j + Y];
|
cbuf.Green := Round(alpha * cimg.Green + (1 - alpha) * cbuf.Green);
|
||||||
cbuf.Red := Round(alpha * cimg.Red + (1 - alpha) * cbuf.Red);
|
cbuf.Blue := Round(alpha * cimg.Blue + (1 - alpha) * cbuf.Blue);
|
||||||
cbuf.Green := Round(alpha * cimg.Green + (1 - alpha) * cbuf.Green);
|
FBuffer.Colors[i + X, j + Y] := cbuf;
|
||||||
cbuf.Blue := Round(alpha * cimg.Blue + (1 - alpha) * cbuf.Blue);
|
end;
|
||||||
FBuffer.Colors[i + X, j + Y] := cbuf;
|
end;
|
||||||
end;
|
|
||||||
end else
|
end else
|
||||||
for j := 0 to intfImg.Height - 1 do
|
for j := 0 to intfImg.Height - 1 do
|
||||||
for i := 0 to intfImg.Width - 1 do
|
if InRange(j + Y, 0, FBuffer.Height - 1) then
|
||||||
if InRange(i + x, 0, FBuffer.Width-1) and InRange(j + Y, 0, FBuffer.Height-1) then
|
for i := 0 to intfImg.Width - 1 do
|
||||||
FBuffer.Colors[i + X, j + Y] := intfImg.Colors[i, j];
|
if InRange(i + x, 0, FBuffer.Width-1) then
|
||||||
|
FBuffer.Colors[i + X, j + Y] := intfImg.Colors[i, j];
|
||||||
finally
|
finally
|
||||||
intfimg.Free;
|
intfimg.Free;
|
||||||
end;
|
end;
|
||||||
|
|||||||
Reference in New Issue
Block a user