Changeset 246 for branches/highdpi/LocalPlayer/Help.pas
- Timestamp:
- May 21, 2020, 8:17:38 PM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/highdpi/LocalPlayer/Help.pas
r213 r246 443 443 MaxSum = 9 * 9 * 255 * 75 div 100; 444 444 var 445 x, y, dx, dy, xSrc, ySrc, Sum, xx: integer;445 x, y, dx, dy, xSrc, ySrc, sum, xx: integer; 446 446 Heaven: array [0..nHeaven] of integer; 447 PaintPtr: TPixelPointer; 448 CoalPtr: TPixelPointer; 447 PaintPtr, CoalPtr: TPixelPointer; 449 448 ImpPtr: array [-1..1] of TPixelPointer; 450 449 begin … … 458 457 xSrc := iix mod 7 * xSizeBig; 459 458 ySrc := (iix div 7 + 1) * ySizeBig; 460 for y := 0 to ScaleTo Vcl(ySizeBig * 2)- 1 do461 if ((ScaleTo Vcl(y0) + y) >= 0) and ((ScaleToVcl(y0) + y) < ScaleToVcl(InnerHeight)) then begin462 PaintPtr := PixelPointer(OffScreen, 0, ScaleTo Vcl(y0) + y);463 CoalPtr := PixelPointer(Templates, 0, ScaleTo Vcl(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); 464 463 for dy := -1 to 1 do 465 if ((Max(y + ScaleTo Vcl(dy), 0) shr 1) >= 0) and ((Max(y + ScaleToVcl(dy), 0) shr 1) < ScaleToVcl(ySizeBig)) then466 ImpPtr[dy] := PixelPointer(BigImp, 0, ScaleTo Vcl(ySrc) + (Max(y + ScaleToVcl(dy), 0) shr 1));467 for x := 0 to ScaleTo Vcl(xSizeBig * 2)- 1 do begin468 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; 469 468 for dx := -1 to 1 do begin 470 xx := ScaleTo Vcl(xSrc) + Max((x + ScaleToVcl(dx)), 0) shr 1;469 xx := ScaleToNative(xSrc) + Max((x + ScaleToNative(dx)), 0) shr 1; 471 470 for dy := -1 to 1 do begin 472 471 ImpPtr[dy].SetX(xx); 473 if ((y + ScaleTo Vcl(dy)) shr 1 < 0) or ((y + ScaleToVcl(dy)) shr 1 >= ScaleToVcl(ySizeBig)) or474 ((x + ScaleTo Vcl(dx)) shr 1 < 0) or ((x + ScaleToVcl(dx)) shr 1 >= ScaleToVcl(xSizeBig)) or475 ((y + ScaleTo Vcl(dy)) shr 1 < ScaleToVcl(nHeaven)) and472 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 476 475 (ImpPtr[dy].Pixel^.B shl 16 + ImpPtr[dy].Pixel^.G shl 8 + 477 ImpPtr[dy].Pixel^.R = Heaven[(ScaleFrom Vcl(y) + dy) shr 1]) then478 Sum := Sum + 9 * 255476 ImpPtr[dy].Pixel^.R = Heaven[(ScaleFromNative(y) + dy) shr 1]) then 477 sum := sum + 9 * 255 479 478 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 * 481 480 ImpPtr[dy].Pixel^.R; 482 481 end; 483 482 end; 484 if Sum < MaxSum then begin // no saturation485 CoalPtr.SetX(ScaleTo Vcl(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); 487 486 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; 491 490 end; 492 491 end;
Note:
See TracChangeset
for help on using the changeset viewer.