Changeset 247 for branches/highdpi/LocalPlayer/Help.pas
- Timestamp:
- May 21, 2020, 10:30:59 PM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/highdpi/LocalPlayer/Help.pas
r246 r247 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, CoalPtr: TPixelPointer; 447 PaintPtr: TPixelPointer; 448 CoalPtr: TPixelPointer; 448 449 ImpPtr: array [-1..1] of TPixelPointer; 449 450 begin … … 457 458 xSrc := iix mod 7 * xSizeBig; 458 459 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 460 465 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);463 466 for dy := -1 to 1 do 464 467 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 begin467 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; 468 471 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; 470 473 for dy := -1 to 1 do begin 471 474 ImpPtr[dy].SetX(xx); … … 475 478 (ImpPtr[dy].Pixel^.B shl 16 + ImpPtr[dy].Pixel^.G shl 8 + 476 479 ImpPtr[dy].Pixel^.R = Heaven[(ScaleFromNative(y) + dy) shr 1]) then 477 sum := sum + 9 * 255480 Sum := Sum + 9 * 255 478 481 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 * 480 483 ImpPtr[dy].Pixel^.R; 481 484 end; 482 485 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); 490 491 end; 492 PaintPtr.NextPixel; 493 CoalPtr.NextPixel; 491 494 end; 492 495 end; 496 PaintPtr.NextLine; 497 CoalPtr.NextLine; 498 end; 493 499 Offscreen.EndUpdate; 494 500 BigImp.EndUpdate;
Note:
See TracChangeset
for help on using the changeset viewer.