Misc: Switch x and y loops at several places. Issue #40231

This commit is contained in:
wp_xyz 2023-04-29 16:38:00 +02:00
parent 7c60b62155
commit 77ae9452b9
9 changed files with 24 additions and 23 deletions

View File

@ -1868,8 +1868,8 @@ begin
begin begin
if (lImageWidth*lImageHeight)*4 > Length(lImageData) then if (lImageWidth*lImageHeight)*4 > Length(lImageData) then
raise Exception.Create(Format('[TvEPSVectorialReader.ExecutePaintingOperator] operator image: image data too small. Expected=%d Found=%d', [Length(lImageData), (lImageWidth*lImageHeight)*4])); raise Exception.Create(Format('[TvEPSVectorialReader.ExecutePaintingOperator] operator image: image data too small. Expected=%d Found=%d', [Length(lImageData), (lImageWidth*lImageHeight)*4]));
for x := 0 to lImageWidth - 1 do for y := 0 to lImageHeight - 1 do
for y := 0 to lImageHeight - 1 do for x := 0 to lImageWidth - 1 do
begin begin
lColorC := lImageData[(x+y*lImageWidth)*4] / $FF; lColorC := lImageData[(x+y*lImageWidth)*4] / $FF;
lColorM := lImageData[(x+y*lImageWidth)*4+1] / $FF; lColorM := lImageData[(x+y*lImageWidth)*4+1] / $FF;
@ -1886,8 +1886,8 @@ begin
begin begin
if (lImageWidth*lImageHeight)*3 > Length(lImageData) then if (lImageWidth*lImageHeight)*3 > Length(lImageData) then
raise Exception.Create(Format('[TvEPSVectorialReader.ExecutePaintingOperator] operator image: image data too small. Expected=%d Found=%d', [Length(lImageData), (lImageWidth*lImageHeight)*3])); raise Exception.Create(Format('[TvEPSVectorialReader.ExecutePaintingOperator] operator image: image data too small. Expected=%d Found=%d', [Length(lImageData), (lImageWidth*lImageHeight)*3]));
for x := 0 to lImageWidth - 1 do for y := 0 to lImageHeight - 1 do
for y := 0 to lImageHeight - 1 do for x := 0 to lImageWidth - 1 do
begin begin
lColor.Alpha := alphaOpaque; lColor.Alpha := alphaOpaque;
lColor.Red := lImageData[(x+y*lImageWidth)*3] * $101; lColor.Red := lImageData[(x+y*lImageWidth)*3] * $101;

View File

@ -329,8 +329,8 @@ begin
lFile := TFileStream.Create('Terrain.raw', fmCreate); lFile := TFileStream.Create('Terrain.raw', fmCreate);
try try
for x := 0 to 1023 do for y := 0 to 1023 do
for y := 0 to 1023 do for x := 0 to 1023 do
begin begin
lRed := lRasterImage.RasterImage.Colors[x, y].Red; lRed := lRasterImage.RasterImage.Colors[x, y].Red;
lFile.WriteByte(Byte(lRed div $FF)); lFile.WriteByte(Byte(lRed div $FF));

View File

@ -57,8 +57,8 @@ begin
AImage.SetRawImage(lRawImage); AImage.SetRawImage(lRawImage);
for x := 0 to RAW_IMAGE_WIDTH - 1 do for y := 0 to RAW_IMAGE_HEIGHT - 1 do
for y := 0 to RAW_IMAGE_HEIGHT - 1 do for x := 0 to RAW_IMAGE_WIDTH - 1 do
begin begin
lColor.Red := AStream.ReadByte() * $FF; lColor.Red := AStream.ReadByte() * $FF;
AImage.Colors[x, y] := lColor; AImage.Colors[x, y] := lColor;

View File

@ -500,8 +500,8 @@ begin
begin begin
TmpImage.Canvas.BrushCopy(IRect, FOriginal, ORect, FTransparentColor); TmpImage.Canvas.BrushCopy(IRect, FOriginal, ORect, FTransparentColor);
with TmpImage do with TmpImage do
for X := 0 to Width - 1 do for Y := 0 to Height - 1 do
for Y := 0 to Height - 1 do for X := 0 to Width - 1 do
Canvas.Pixels[X, Y] := MapColor(Canvas.Pixels[X, Y]); Canvas.Pixels[X, Y] := MapColor(Canvas.Pixels[X, Y]);
FIndexs[State] := FGlyphList.AddMasked(TmpImage, TColor(ColorToRGB(clBtnFace))); FIndexs[State] := FGlyphList.AddMasked(TmpImage, TColor(ColorToRGB(clBtnFace)));
end; end;

View File

@ -662,8 +662,8 @@ begin
if UseTransparentCopy then begin if UseTransparentCopy then begin
if Images[FCurrentFrame].Bitmap <> nil then if Images[FCurrentFrame].Bitmap <> nil then
for x := 0 to Images[FCurrentFrame].Bitmap.Width - 1 do for y := 0 to Images[FCurrentFrame].Bitmap.Height - 1 do
for y := 0 to Images[FCurrentFrame].Bitmap.Height - 1 do for x := 0 to Images[FCurrentFrame].Bitmap.Width - 1 do
if Images[FCurrentFrame].Bitmap.Canvas.Pixels[x, y] <> if Images[FCurrentFrame].Bitmap.Canvas.Pixels[x, y] <>
Images[FCurrentFrame].TransparentColor then begin Images[FCurrentFrame].TransparentColor then begin
if (x + Images[FCurrentFrame].XOffset < Bitmap.Width) and if (x + Images[FCurrentFrame].XOffset < Bitmap.Width) and

View File

@ -105,11 +105,12 @@ begin
FBitmap.Canvas.Brush.Style := bsSolid; FBitmap.Canvas.Brush.Style := bsSolid;
FBitmap.Canvas.Brush.Color := colorBG; FBitmap.Canvas.Brush.Color := colorBG;
FBitmap.Canvas.Rectangle(0,0,7,7); FBitmap.Canvas.Rectangle(0,0,7,7);
for x := 0 to 7 do for y := 0 to 7 do for y := 0 to 7 do
begin for x := 0 to 7 do
if ((not Odd(x)) and (not Odd(y))) xor ((Odd(x)) and (Odd(y))) then begin
FBitmap.Canvas.Pixels[x,y] := colorFG; if ((not Odd(x)) and (not Odd(y))) xor ((Odd(x)) and (Odd(y))) then
end; FBitmap.Canvas.Pixels[x,y] := colorFG;
end;
end; end;
destructor TPatternBitmap.Destroy; destructor TPatternBitmap.Destroy;

View File

@ -300,8 +300,8 @@ begin
W := (R.Right - R.Left - 1) div DX; W := (R.Right - R.Left - 1) div DX;
H := (R.Bottom - R.Top - 1) div DY; H := (R.Bottom - R.Top - 1) div DY;
for X := 0 to W do for Y := 0 to H do
for Y := 0 to H do for X := 0 to W do
QtDC.drawPoint(R.Left + X * DX, R.Top + Y * DY + 1); QtDC.drawPoint(R.Left + X * DX, R.Top + Y * DY + 1);
finally finally
QtDC.restore; QtDC.restore;

View File

@ -298,8 +298,8 @@ begin
W := (R.Right - R.Left - 1) div DX; W := (R.Right - R.Left - 1) div DX;
H := (R.Bottom - R.Top - 1) div DY; H := (R.Bottom - R.Top - 1) div DY;
for X := 0 to W do for Y := 0 to H do
for Y := 0 to H do for X := 0 to W do
QtDC.drawPoint(R.Left + X * DX, R.Top + Y * DY + 1); QtDC.drawPoint(R.Left + X * DX, R.Top + Y * DY + 1);
finally finally
QtDC.restore; QtDC.restore;

View File

@ -298,8 +298,8 @@ begin
W := (R.Right - R.Left - 1) div DX; W := (R.Right - R.Left - 1) div DX;
H := (R.Bottom - R.Top - 1) div DY; H := (R.Bottom - R.Top - 1) div DY;
for X := 0 to W do for Y := 0 to H do
for Y := 0 to H do for X := 0 to W do
QtDC.drawPoint(R.Left + X * DX, R.Top + Y * DY + 1); QtDC.drawPoint(R.Left + X * DX, R.Top + Y * DY + 1);
finally finally
QtDC.restore; QtDC.restore;