Changeset 515 for trunk


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

Legend:

Unmodified
Added
Removed
  • trunk/LocalPlayer/Term.pas

    r513 r515  
    27712771      begin
    27722772        SaveSettings;
    2773         CityDlg.CloseAction := None;
     2773        if Assigned(FCityDlg) then CityDlg.CloseAction := None;
    27742774        ApplyToVisibleForms(faClose);
    27752775        if LogDlg.Visible then
  • 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;
  • trunk/Packages/DpiControls/Dpi.Common.pas

    r514 r515  
    185185  DstWidth, DstHeight: Integer;
    186186  SrcWidth, SrcHeight: Integer;
    187   ReduceWidth, ReduceHeight: Integer;
    188187begin
    189188  {$IFDEF WINDOWS}
     
    198197  SrcWidth := ScaleToNativeDist(XSrc, Width);
    199198  SrcHeight := ScaleToNativeDist(YSrc, Height);
    200   if (Frac(ScaleFloatToNative(XSrc)) > 0) or
    201     (Frac(ScaleFloatToNative(X)) > 0) then ReduceWidth := 1
    202     else ReduceWidth := 0;
    203   if (Frac(ScaleFloatToNative(YSrc)) > 0) or
    204     (Frac(ScaleFloatToNative(Y)) > 0) then ReduceHeight := 1
    205     else ReduceHeight := 0;
    206199  if (DstWidth = SrcWidth) and (DstHeight = SrcHeight) then begin
    207200    Result := LCLIntf.BitBlt(DestDC, ScaleToNative(X), ScaleToNative(Y),
     
    210203  end else begin
    211204    Result := LCLIntf.BitBlt(DestDC, ScaleToNative(X), ScaleToNative(Y),
    212       DstWidth - ReduceWidth, DstHeight - ReduceHeight, SrcDC,
     205      SrcWidth, SrcHeight, SrcDC,
    213206      ScaleToNative(XSrc), ScaleToNative(YSrc), Rop);
    214207
     
    224217        ScaleToNative(XSrc), ScaleToNative(YSrc) + SrcHeight - (DstHeight - SrcHeight), Rop);
    225218    end;
    226 
    227219  {  Result := LCLIntf.StretchBlt(DestDC, ScaleToNative(X), ScaleToNative(Y),
    228220      DstWidth, DstHeight, SrcDC,
Note: See TracChangeset for help on using the changeset viewer.