mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-21 03:39:18 +02:00
LCL: Eliminate a nested loop in TLazIntfImage.CopyPixels.
git-svn-id: trunk@64413 -
This commit is contained in:
parent
f852f4d56a
commit
9e251a5c0a
@ -3820,16 +3820,15 @@ begin
|
|||||||
begin
|
begin
|
||||||
SrcHasMask := SrcImg.FRawImage.Description.MaskBitsPerPixel > 0;
|
SrcHasMask := SrcImg.FRawImage.Description.MaskBitsPerPixel > 0;
|
||||||
DstHasMask := FRawImage.Description.MaskBitsPerPixel > 0;
|
DstHasMask := FRawImage.Description.MaskBitsPerPixel > 0;
|
||||||
if DstHasMask then
|
|
||||||
for y:= yStart to yStop do
|
|
||||||
for x:=xStart to xStop do
|
|
||||||
Masked[x+XDst,y+YDst] := SrcHasMask and SrcImg.Masked[x,y];
|
|
||||||
// Optimization for common case. Inner loop is called millions of times in a big app.
|
// Optimization for common case. Inner loop is called millions of times in a big app.
|
||||||
for y:=yStart to yStop do
|
for y:=yStart to yStop do
|
||||||
for x:=xStart to xStop do
|
for x:=xStart to xStop do
|
||||||
begin
|
begin
|
||||||
SrcImg.FGetInternalColorProc(x,y,c); // c := SrcImg.Colors[x,y];
|
SrcImg.FGetInternalColorProc(x,y,c); // c := SrcImg.Colors[x,y];
|
||||||
if not DstHasMask and SrcHasMask and (c.alpha = $FFFF) then
|
if DstHasMask then // This can be optimized if needed.
|
||||||
|
Masked[x+XDst,y+YDst] := SrcHasMask and SrcImg.Masked[x,y]
|
||||||
|
else
|
||||||
|
if SrcHasMask and (c.alpha = $FFFF) then
|
||||||
begin // copy mask to alpha channel
|
begin // copy mask to alpha channel
|
||||||
SrcImg.GetXYMaskPosition(x,y,Position); //if SrcImg.Masked[x,y] then
|
SrcImg.GetXYMaskPosition(x,y,Position); //if SrcImg.Masked[x,y] then
|
||||||
SrcImg.FRawimage.ReadMask(Position, SrcMaskPix);
|
SrcImg.FRawimage.ReadMask(Position, SrcMaskPix);
|
||||||
|
Loading…
Reference in New Issue
Block a user