Changeset 213 for branches/highdpi/LocalPlayer/Help.pas
- Timestamp:
- May 9, 2020, 11:21:54 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/highdpi/LocalPlayer/Help.pas
r212 r213 441 441 const 442 442 nHeaven = 28; 443 maxsum = 9 * 9 * 255 * 75 div 100;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 447 PaintPtr: TPixelPointer; … … 458 458 xSrc := iix mod 7 * xSizeBig; 459 459 ySrc := (iix div 7 + 1) * ySizeBig; 460 for y := 0 to ySizeBig * 2- 1 do461 if (( y0 + y) >= 0) and ((y0 + y) < InnerHeight) then begin462 PaintPtr := PixelPointer(OffScreen, 0, y0+ y);463 CoalPtr := PixelPointer(Templates, 0, yCoal+ y);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); 464 464 for dy := -1 to 1 do 465 if ((Max(y + dy, 0) shr 1) >= 0) and ((Max(y + dy, 0) shr 1) < ySizeBig) then466 ImpPtr[dy] := PixelPointer(BigImp, 0, ySrc + (Max(y + dy, 0) shr 1));467 for x := 0 to xSizeBig * 2- 1 do begin468 sum := 0;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; 469 469 for dx := -1 to 1 do begin 470 xx := xSrc + Max((x + dx), 0) shr 1;470 xx := ScaleToVcl(xSrc) + Max((x + ScaleToVcl(dx)), 0) shr 1; 471 471 for dy := -1 to 1 do begin 472 472 ImpPtr[dy].SetX(xx); 473 if ((y + dy) shr 1 < 0) or ((y + dy) shr 1 >= ySizeBig) or474 ((x + dx) shr 1 < 0) or ((x + dx) shr 1 >= xSizeBig) or475 ((y + dy) shr 1 < nHeaven) and473 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 476 476 (ImpPtr[dy].Pixel^.B shl 16 + ImpPtr[dy].Pixel^.G shl 8 + 477 ImpPtr[dy].Pixel^.R = Heaven[( y+ dy) shr 1]) then478 sum := sum + 9 * 255477 ImpPtr[dy].Pixel^.R = Heaven[(ScaleFromVcl(y) + dy) shr 1]) then 478 Sum := Sum + 9 * 255 479 479 else 480 sum := sum + ImpPtr[dy].Pixel^.B + 5 * ImpPtr[dy].Pixel^.G + 3 *480 Sum := Sum + ImpPtr[dy].Pixel^.B + 5 * ImpPtr[dy].Pixel^.G + 3 * 481 481 ImpPtr[dy].Pixel^.R; 482 482 end; 483 483 end; 484 if sum < maxsum then begin // no saturation485 CoalPtr.SetX( xCoal+ x);486 sum := 1 shl 22 - (maxsum - sum) * (256 - CoalPtr.Pixel^.B * 2);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); 487 487 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;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; 491 491 end; 492 492 end;
Note:
See TracChangeset
for help on using the changeset viewer.