Ignore:
Timestamp:
May 21, 2020, 8:17:38 PM (4 years ago)
Author:
chronos
Message:
  • Modified: Update from trunk rev 245.
  • Modified: Vcl prefix/suffix changed to Native.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/highdpi/LocalPlayer/Help.pas

    r213 r246  
    443443  MaxSum = 9 * 9 * 255 * 75 div 100;
    444444var
    445   x, y, dx, dy, xSrc, ySrc, Sum, xx: integer;
     445  x, y, dx, dy, xSrc, ySrc, sum, xx: integer;
    446446  Heaven: array [0..nHeaven] of integer;
    447   PaintPtr: TPixelPointer;
    448   CoalPtr: TPixelPointer;
     447  PaintPtr, CoalPtr: TPixelPointer;
    449448  ImpPtr: array [-1..1] of TPixelPointer;
    450449begin
     
    458457  xSrc := iix mod 7 * xSizeBig;
    459458  ySrc := (iix div 7 + 1) * ySizeBig;
    460   for y := 0 to ScaleToVcl(ySizeBig * 2) - 1 do
    461     if ((ScaleToVcl(y0) + y) >= 0) and ((ScaleToVcl(y0) + y) < ScaleToVcl(InnerHeight)) then begin
    462       PaintPtr := PixelPointer(OffScreen, 0, ScaleToVcl(y0) + y);
    463       CoalPtr := PixelPointer(Templates, 0, ScaleToVcl(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);
    464463      for dy := -1 to 1 do
    465         if ((Max(y + ScaleToVcl(dy), 0) shr 1) >= 0) and ((Max(y + ScaleToVcl(dy), 0) shr 1) < ScaleToVcl(ySizeBig)) then
    466           ImpPtr[dy] := PixelPointer(BigImp, 0, ScaleToVcl(ySrc) + (Max(y + ScaleToVcl(dy), 0) shr 1));
    467       for x := 0 to ScaleToVcl(xSizeBig * 2) - 1 do begin
    468         Sum := 0;
     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
     467        sum := 0;
    469468        for dx := -1 to 1 do begin
    470           xx := ScaleToVcl(xSrc) + Max((x + ScaleToVcl(dx)), 0) shr 1;
     469          xx := ScaleToNative(xSrc) + Max((x + ScaleToNative(dx)), 0) shr 1;
    471470          for dy := -1 to 1 do begin
    472471            ImpPtr[dy].SetX(xx);
    473             if ((y + ScaleToVcl(dy)) shr 1 < 0) or ((y + ScaleToVcl(dy)) shr 1 >= ScaleToVcl(ySizeBig)) or
    474               ((x + ScaleToVcl(dx)) shr 1 < 0) or ((x + ScaleToVcl(dx)) shr 1 >= ScaleToVcl(xSizeBig)) or
    475               ((y + ScaleToVcl(dy)) shr 1 < ScaleToVcl(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
    476475              (ImpPtr[dy].Pixel^.B shl 16 + ImpPtr[dy].Pixel^.G shl 8 +
    477               ImpPtr[dy].Pixel^.R = Heaven[(ScaleFromVcl(y) + dy) shr 1]) then
    478               Sum := Sum + 9 * 255
     476              ImpPtr[dy].Pixel^.R = Heaven[(ScaleFromNative(y) + dy) shr 1]) then
     477              sum := sum + 9 * 255
    479478            else
    480               Sum := Sum + ImpPtr[dy].Pixel^.B + 5 * ImpPtr[dy].Pixel^.G + 3 *
     479              sum := sum + ImpPtr[dy].Pixel^.B + 5 * ImpPtr[dy].Pixel^.G + 3 *
    481480                ImpPtr[dy].Pixel^.R;
    482481          end;
    483482        end;
    484         if Sum < MaxSum then begin // no saturation
    485           CoalPtr.SetX(ScaleToVcl(xCoal) + x);
    486           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);
    487486          PaintPtr.SetX(x0 + x);
    488           PaintPtr.Pixel^.B := PaintPtr.Pixel^.B * Sum shr 22;
    489           PaintPtr.Pixel^.G := PaintPtr.Pixel^.G * Sum shr 22;
    490           PaintPtr.Pixel^.R := PaintPtr.Pixel^.R * Sum shr 22;
     487          PaintPtr.Pixel^.B := PaintPtr.Pixel^.B * sum shr 22;
     488          PaintPtr.Pixel^.G := PaintPtr.Pixel^.G * sum shr 22;
     489          PaintPtr.Pixel^.R := PaintPtr.Pixel^.R * sum shr 22;
    491490        end;
    492491      end;
Note: See TracChangeset for help on using the changeset viewer.