Ignore:
Timestamp:
May 21, 2020, 10:30:59 PM (4 years ago)
Author:
chronos
Message:
  • Modified: Enabled scaling under Windows.
  • Fixed: Use correct scaled Windows BitBlt.
  • Modified: Fixed and optimized help watermark method.
File:
1 edited

Legend:

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

    r246 r247  
    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, CoalPtr: TPixelPointer;
     447  PaintPtr: TPixelPointer;
     448  CoalPtr: TPixelPointer;
    448449  ImpPtr: array [-1..1] of TPixelPointer;
    449450begin
     
    457458  xSrc := iix mod 7 * xSizeBig;
    458459  ySrc := (iix div 7 + 1) * ySizeBig;
    459   for y := 0 to ScaleToNative(ySizeBig) * 2 - 1 do
     460  PaintPtr := PixelPointer(OffScreen, ScaleToNative(x0), ScaleToNative(y0));
     461  CoalPtr := PixelPointer(Templates, ScaleToNative(xCoal), ScaleToNative(yCoal));
     462  for dy := -1 to 1 do
     463    ImpPtr[dy] := PixelPointer(BigImp, ScaleToNative(xSrc), ScaleToNative(ySrc));
     464  for y := 0 to ScaleToNative(ySizeBig) * 2 - 1 do begin
    460465    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);
    463466      for dy := -1 to 1 do
    464467        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;
     468          ImpPtr[dy].SetXY(0, Max(y + ScaleToNative(dy), 0) shr 1);
     469      for x := 0 to ScaleToNative(xSizeBig * 2) - 1 do begin
     470        Sum := 0;
    468471        for dx := -1 to 1 do begin
    469           xx := ScaleToNative(xSrc) + Max((x + ScaleToNative(dx)), 0) shr 1;
     472          xx := Max((x + ScaleToNative(dx)), 0) shr 1;
    470473          for dy := -1 to 1 do begin
    471474            ImpPtr[dy].SetX(xx);
     
    475478              (ImpPtr[dy].Pixel^.B shl 16 + ImpPtr[dy].Pixel^.G shl 8 +
    476479              ImpPtr[dy].Pixel^.R = Heaven[(ScaleFromNative(y) + dy) shr 1]) then
    477               sum := sum + 9 * 255
     480              Sum := Sum + 9 * 255
    478481            else
    479               sum := sum + ImpPtr[dy].Pixel^.B + 5 * ImpPtr[dy].Pixel^.G + 3 *
     482              Sum := Sum + ImpPtr[dy].Pixel^.B + 5 * ImpPtr[dy].Pixel^.G + 3 *
    480483                ImpPtr[dy].Pixel^.R;
    481484          end;
    482485        end;
    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);
    486           PaintPtr.SetX(x0 + x);
    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;
     486        if Sum < MaxSum then begin // no saturation
     487          Sum := 1 shl 22 - (MaxSum - Sum) * (256 - CoalPtr.Pixel^.B * 2);
     488          PaintPtr.Pixel^.B := Min(PaintPtr.Pixel^.B * Sum shr 22, 255);
     489          PaintPtr.Pixel^.G := Min(PaintPtr.Pixel^.G * Sum shr 22, 255);
     490          PaintPtr.Pixel^.R := Min(PaintPtr.Pixel^.R * Sum shr 22, 255);
    490491        end;
     492        PaintPtr.NextPixel;
     493        CoalPtr.NextPixel;
    491494      end;
    492495    end;
     496    PaintPtr.NextLine;
     497    CoalPtr.NextLine;
     498  end;
    493499  Offscreen.EndUpdate;
    494500  BigImp.EndUpdate;
Note: See TracChangeset for help on using the changeset viewer.