Ignore:
Timestamp:
May 21, 2020, 7:58:42 PM (4 years ago)
Author:
chronos
Message:
  • Added: Inactive scaling functions for future HighDPI support.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/LocalPlayer/Help.pas

    r206 r245  
    441441const
    442442  nHeaven = 28;
    443   maxsum = 9 * 9 * 255 * 75 div 100;
     443  MaxSum = 9 * 9 * 255 * 75 div 100;
    444444var
    445445  x, y, dx, dy, xSrc, ySrc, sum, xx: integer;
     
    457457  xSrc := iix mod 7 * xSizeBig;
    458458  ySrc := (iix div 7 + 1) * ySizeBig;
    459   for y := 0 to ySizeBig * 2 - 1 do
    460     if ((y0 + y) >= 0) and ((y0 + y) < InnerHeight) then begin
    461       PaintPtr := PixelPointer(OffScreen, 0, y0 + y);
    462       CoalPtr := PixelPointer(Templates, 0, yCoal + y);
     459  for y := 0 to ScaleToNative(ySizeBig) * 2 - 1 do
     460    if ((ScaleToNative(y0) + y) >= 0) and ((ScaleToNative(y0) + y) < ScaleToNative(InnerHeight)) then begin
     461      PaintPtr := PixelPointer(OffScreen, 0, ScaleToNative(y0) + y);
     462      CoalPtr := PixelPointer(Templates, 0, ScaleToNative(yCoal) + y);
    463463      for dy := -1 to 1 do
    464         if ((Max(y + dy, 0) shr 1) >= 0) and ((Max(y + dy, 0) shr 1) < ySizeBig) then
    465           ImpPtr[dy] := PixelPointer(BigImp, 0, ySrc + (Max(y + dy, 0) shr 1));
    466       for x := 0 to xSizeBig * 2 - 1 do begin
     464        if ((Max(y + ScaleToNative(dy), 0) shr 1) >= 0) and ((Max(y + ScaleToNative(dy), 0) shr 1) < ScaleToNative(ySizeBig)) then
     465          ImpPtr[dy] := PixelPointer(BigImp, 0, ScaleToNative(ySrc) + (Max(y + ScaleToNative(dy), 0) shr 1));
     466      for x := 0 to ScaleToNative(xSizeBig) * 2 - 1 do begin
    467467        sum := 0;
    468468        for dx := -1 to 1 do begin
    469           xx := xSrc + Max((x + dx), 0) shr 1;
     469          xx := ScaleToNative(xSrc) + Max((x + ScaleToNative(dx)), 0) shr 1;
    470470          for dy := -1 to 1 do begin
    471471            ImpPtr[dy].SetX(xx);
    472             if ((y + dy) shr 1 < 0) or ((y + dy) shr 1 >= ySizeBig) or
    473               ((x + dx) shr 1 < 0) or ((x + dx) shr 1 >= xSizeBig) or
    474               ((y + dy) shr 1 < nHeaven) and
     472            if ((y + ScaleToNative(dy)) shr 1 < 0) or ((y + ScaleToNative(dy)) shr 1 >= ScaleToNative(ySizeBig)) or
     473              ((x + ScaleToNative(dx)) shr 1 < 0) or ((x + ScaleToNative(dx)) shr 1 >= ScaleToNative(xSizeBig)) or
     474              ((y + ScaleToNative(dy)) shr 1 < ScaleToNative(nHeaven)) and
    475475              (ImpPtr[dy].Pixel^.B shl 16 + ImpPtr[dy].Pixel^.G shl 8 +
    476               ImpPtr[dy].Pixel^.R = Heaven[(y + dy) shr 1]) then
     476              ImpPtr[dy].Pixel^.R = Heaven[(ScaleFromNative(y) + dy) shr 1]) then
    477477              sum := sum + 9 * 255
    478478            else
     
    481481          end;
    482482        end;
    483         if sum < maxsum then begin // no saturation
    484           CoalPtr.SetX(xCoal + x);
    485           sum := 1 shl 22 - (maxsum - sum) * (256 - CoalPtr.Pixel^.B * 2);
     483        if sum < MaxSum then begin // no saturation
     484          CoalPtr.SetX(ScaleToNative(xCoal) + x);
     485          sum := 1 shl 22 - (MaxSum - sum) * (256 - CoalPtr.Pixel^.B * 2);
    486486          PaintPtr.SetX(x0 + x);
    487487          PaintPtr.Pixel^.B := PaintPtr.Pixel^.B * sum shr 22;
Note: See TracChangeset for help on using the changeset viewer.