Ignore:
Timestamp:
Jan 3, 2024, 4:53:46 PM (12 months ago)
Author:
chronos
Message:
  • Modified: Improved scaling of ImageOp_BCC procedure.
  • Fixed: Do not initialize City dialog on game closure.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Packages/CevoComponents/ScreenTools.pas

    r514 r515  
    695695    PixelSrc.NextLine;
    696696  end;
    697   src.EndUpdate;
     697  Src.EndUpdate;
    698698  Dst.EndUpdate;
    699699end;
     
    709709  SrcPixel: TPixelPointer;
    710710  DstPixel: TPixelPointer;
    711 begin
     711  DstWidth, DstHeight: Integer;
     712  SrcWidth, SrcHeight: Integer;
     713begin
     714  if xDst < 0 then begin
     715    Width := Width + xDst;
     716    xSrc := xSrc - xDst;
     717    xDst := 0;
     718  end;
     719  if yDst < 0 then begin
     720    Height := Height + yDst;
     721    ySrc := ySrc - yDst;
     722    yDst := 0;
     723  end;
     724  if xDst + Width > Dst.Width then
     725    Width := Dst.Width - xDst;
     726  if yDst + Height > Dst.Height then
     727    Height := Dst.Height - yDst;
     728  if (Width < 0) or (Height < 0) then
     729    Exit;
     730  DstWidth := ScaleToNativeDist(xDst, Width);
     731  DstHeight := ScaleToNativeDist(yDst, Height);
     732  SrcWidth := ScaleToNativeDist(xSrc, Width);
     733  SrcHeight := ScaleToNativeDist(ySrc, Height);
    712734  xDst := ScaleToNative(xDst);
    713735  yDst := ScaleToNative(yDst);
    714736  xSrc := ScaleToNative(xSrc);
    715737  ySrc := ScaleToNative(ySrc);
    716   Width := ScaleToNative(Width);
    717   Height := ScaleToNative(Height);
    718   if xDst < 0 then begin
    719     Width := Width + xDst;
    720     xSrc := xSrc - xDst;
    721     xDst := 0;
    722   end;
    723   if yDst < 0 then begin
    724     Height := Height + yDst;
    725     ySrc := ySrc - yDst;
    726     yDst := 0;
    727   end;
    728   if xDst + Width > ScaleToNative(Dst.Width) then
    729     Width := ScaleToNative(Dst.Width) - xDst;
    730   if yDst + Height > ScaleToNative(Dst.Height) then
    731     Height := ScaleToNative(Dst.Height) - yDst;
    732   if (Width < 0) or (Height < 0) then
    733     Exit;
    734738
    735739  Src.BeginUpdate;
     
    737741  SrcPixel := TPixelPointer.Create(Src, xSrc, ySrc);
    738742  DstPixel := TPixelPointer.Create(Dst, xDst, yDst);
    739   for iy := 0 to Height - 1 do begin
    740     for ix := 0 to Width - 1 do begin
     743  for iy := 0 to DstHeight - 1 do begin
     744    for ix := 0 to DstWidth - 1 do begin
    741745      trans := SrcPixel.PixelB * 2; // green channel = transparency
    742746      amp1 := SrcPixel.PixelG * 2;
     
    756760      end;
    757761
    758       SrcPixel.NextPixel;
     762      if ix < SrcWidth - 1 then SrcPixel.NextPixel;
    759763      DstPixel.NextPixel;
    760764    end;
    761     SrcPixel.NextLine;
     765    if iy < SrcHeight - 1 then SrcPixel.NextLine
     766      else SrcPixel.SetX(0);
    762767    DstPixel.NextLine;
    763768  end;
Note: See TracChangeset for help on using the changeset viewer.