Changeset 346


Ignore:
Timestamp:
Apr 6, 2021, 7:19:02 PM (7 months ago)
Author:
chronos
Message:
  • Modified: Optimized help water sign drawing.
Location:
trunk/LocalPlayer
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/LocalPlayer/Help.pas

    r331 r346  
    111111    procedure WaterSign(x0, y0, iix: Integer);
    112112    procedure Search(SearchString: string);
    113     procedure OnScroll(var m: TMessage); message WM_VSCROLL;
     113    procedure OnScroll(var Msg: TMessage); message WM_VSCROLL;
    114114    procedure OnMouseLeave(var Msg: TMessage); message CM_MOUSELEAVE;
    115115  public
     
    351351end;
    352352
    353 procedure THelpDlg.OnScroll(var m: TMessage);
     353procedure THelpDlg.OnScroll(var Msg: TMessage);
    354354begin
    355355  { TODO: Handled by MouseWheel event
    356   if ScrollBar.Process(m) then begin
     356  if ScrollBar.Process(Msg) then begin
    357357    Sel := -1;
    358358    SmartUpdateContent(true)
     
    452452  MaxSum = 9 * 9 * 255 * 75 div 100;
    453453var
    454   x, y, dx, dy, xSrc, ySrc, sum, xx: integer;
     454  x, y, dx, dy, xSrc, ySrc, Sum, xx: integer;
    455455  Heaven: array [0..nHeaven] of integer;
    456   PaintPtr, CoalPtr: TPixelPointer;
     456  PaintPtr: TPixelPointer;
     457  CoalPtr: TPixelPointer;
    457458  ImpPtr: array [-1..1] of TPixelPointer;
    458459begin
     
    466467  xSrc := iix mod 7 * xSizeBig;
    467468  ySrc := (iix div 7 + 1) * ySizeBig;
    468   for y := 0 to ScaleToNative(ySizeBig) * 2 - 1 do
     469  PaintPtr := PixelPointer(OffScreen, ScaleToNative(x0), ScaleToNative(y0));
     470  CoalPtr := PixelPointer(Templates.Data, ScaleToNative(xCoal), ScaleToNative(yCoal));
     471  for dy := -1 to 1 do
     472    ImpPtr[dy] := PixelPointer(BigImp, ScaleToNative(xSrc), ScaleToNative(ySrc));
     473  for y := 0 to ScaleToNative(ySizeBig) * 2 - 1 do begin
    469474    if ((ScaleToNative(y0) + y) >= 0) and ((ScaleToNative(y0) + y) < ScaleToNative(InnerHeight)) then begin
    470       PaintPtr := PixelPointer(OffScreen, 0, ScaleToNative(y0) + y);
    471       CoalPtr := PixelPointer(Templates.Data, 0, ScaleToNative(yCoal) + y);
    472475      for dy := -1 to 1 do
    473476        if ((Max(y + ScaleToNative(dy), 0) shr 1) >= 0) and ((Max(y + ScaleToNative(dy), 0) shr 1) < ScaleToNative(ySizeBig)) then
    474           ImpPtr[dy] := PixelPointer(BigImp, 0, ScaleToNative(ySrc) + (Max(y + ScaleToNative(dy), 0) shr 1));
    475       for x := 0 to ScaleToNative(xSizeBig) * 2 - 1 do begin
    476         sum := 0;
     477          ImpPtr[dy].SetXY(0, Max(y + ScaleToNative(dy), 0) shr 1);
     478      for x := 0 to ScaleToNative(xSizeBig * 2) - 1 do begin
     479        Sum := 0;
    477480        for dx := -1 to 1 do begin
    478           xx := ScaleToNative(xSrc) + Max((x + ScaleToNative(dx)), 0) shr 1;
     481          xx := Max((x + ScaleToNative(dx)), 0) shr 1;
    479482          for dy := -1 to 1 do begin
    480483            ImpPtr[dy].SetX(xx);
     
    483486              ((y + ScaleToNative(dy)) shr 1 < ScaleToNative(nHeaven)) and
    484487              (ImpPtr[dy].Pixel^.B shl 16 + ImpPtr[dy].Pixel^.G shl 8 +
    485               ImpPtr[dy].Pixel^.R = Heaven[(ScaleFromNative(y) + dy) shr 1]) then
    486               sum := sum + 9 * 255
     488              ImpPtr[dy].Pixel^.R = Heaven[(ScaleFromNative(y + ScaleToNative(dy))) shr 1]) then
     489              Sum := Sum + 9 * 255
    487490            else
    488               sum := sum + ImpPtr[dy].Pixel^.B + 5 * ImpPtr[dy].Pixel^.G + 3 *
     491              Sum := Sum + ImpPtr[dy].Pixel^.B + 5 * ImpPtr[dy].Pixel^.G + 3 *
    489492                ImpPtr[dy].Pixel^.R;
    490493          end;
    491494        end;
    492         if sum < MaxSum then begin // no saturation
    493           CoalPtr.SetX(ScaleToNative(xCoal) + x);
    494           sum := 1 shl 22 - (MaxSum - sum) * (256 - CoalPtr.Pixel^.B * 2);
    495           PaintPtr.SetX(x0 + x);
    496           PaintPtr.Pixel^.B := PaintPtr.Pixel^.B * sum shr 22;
    497           PaintPtr.Pixel^.G := PaintPtr.Pixel^.G * sum shr 22;
    498           PaintPtr.Pixel^.R := PaintPtr.Pixel^.R * sum shr 22;
     495        if Sum < MaxSum then begin // no saturation
     496          Sum := 1 shl 22 - (MaxSum - Sum) * (256 - CoalPtr.Pixel^.B * 2);
     497          PaintPtr.Pixel^.B := Min(PaintPtr.Pixel^.B * Sum shr 22, 255);
     498          PaintPtr.Pixel^.G := Min(PaintPtr.Pixel^.G * Sum shr 22, 255);
     499          PaintPtr.Pixel^.R := Min(PaintPtr.Pixel^.R * Sum shr 22, 255);
    499500        end;
     501        PaintPtr.NextPixel;
     502        CoalPtr.NextPixel;
    500503      end;
    501504    end;
     505    PaintPtr.NextLine;
     506    CoalPtr.NextLine;
     507  end;
    502508  Offscreen.EndUpdate;
    503509  BigImp.EndUpdate;
  • trunk/LocalPlayer/PVSB.pas

    r172 r346  
    3232    procedure Init(Max, PageSize: Integer);
    3333    procedure SetPos(Pos: Integer);
    34     function Process(const m: TMessage): boolean;
     34    function Process(const Msg: TMessage): boolean;
    3535    function ProcessMouseWheel(Delta: Integer): Boolean;
    3636    procedure Show(Visible: boolean);
     
    6565end;
    6666
    67 function TPVScrollBar.Process(const m: TMessage): boolean;
     67function TPVScrollBar.Process(const Msg: TMessage): boolean;
    6868var
    6969  NewPos: integer;
     
    7373    else
    7474    begin
    75       if (m.wParam and $ffff) in [SB_THUMBPOSITION, SB_THUMBTRACK] then
     75      if (Msg.wParam and $ffff) in [SB_THUMBPOSITION, SB_THUMBTRACK] then
    7676      begin
    77         result := ((m.wParam shr 16) and $ffff) <> ScrollBar.Position;
    78         ScrollBar.Position := (m.wParam shr 16) and $ffff;
     77        result := ((Msg.wParam shr 16) and $ffff) <> ScrollBar.Position;
     78        ScrollBar.Position := (Msg.wParam shr 16) and $ffff;
    7979      end else begin
    80         case (m.wParam and $ffff) of
     80        case (Msg.wParam and $ffff) of
    8181          SB_LINEUP:
    8282            NewPos := ScrollBar.Position - 1;
     
    9595          NewPos := Max - ScrollBar.PageSize + 1;
    9696        result := NewPos <> ScrollBar.Position;
    97         if (NewPos <> ScrollBar.Position) or ((m.wParam and $ffff) = SB_ENDSCROLL) then
     97        if (NewPos <> ScrollBar.Position) or ((Msg.wParam and $ffff) = SB_ENDSCROLL) then
    9898        begin
    9999          ScrollBar.Position := NewPos;
  • trunk/LocalPlayer/Select.pas

    r340 r346  
    4545  private
    4646    Kind: TListKind;
    47     LineDistance, MaxLines, cixProject, pView, Sel, DispLines, Layer, nColumn,
    48       TechNameSpace, ScienceNation: integer;
     47    LineDistance: Integer;
     48    MaxLines: Integer;
     49    cixProject: Integer;
     50    pView: Integer;
     51    Sel: Integer;
     52    DispLines: Integer;
     53    Layer: Integer;
     54    nColumn: Integer;
     55    TechNameSpace: Integer;
     56    ScienceNation: Integer;
    4957    sb: TPVScrollbar;
    5058    Lines, FirstShrinkedLine: array [0 .. MaxLayer - 1] of integer;
    5159    code: array [0 .. MaxLayer - 1, 0 .. 4095] of integer;
    5260    Column: array [0 .. nPl - 1] of integer;
    53     Closable, MultiPage: boolean;
     61    Closable: Boolean;
     62    MultiPage: Boolean;
    5463    ScienceNationDotBuffer: TBitmap;
    5564    procedure ScrollBarUpdate(Sender: TObject);
     
    5867    function RenameCity(cix: integer): boolean;
    5968    function RenameModel(mix: integer): boolean;
    60     procedure OnScroll(var m: TMessage); message WM_VSCROLL;
     69    procedure OnScroll(var Msg: TMessage); message WM_VSCROLL;
    6170    procedure OnMouseLeave(var Msg: TMessage); message CM_MOUSELEAVE;
    6271  public
     
    133142end;
    134143
    135 procedure TListDlg.OnScroll(var m: TMessage);
     144procedure TListDlg.OnScroll(var Msg: TMessage);
    136145begin
    137146  { TODO: Handled by MouseWheel event
    138   if sb.Process(m) then  begin
     147  if sb.Process(Msg) then  begin
    139148    Sel := -2;
    140149    SmartUpdateContent(true);
  • trunk/LocalPlayer/Term.pas

    r337 r346  
    322322    procedure LoadSettings;
    323323    procedure SaveSettings;
    324     procedure OnScroll(var m: TMessage); message WM_VSCROLL;
     324    procedure OnScroll(var Msg: TMessage); message WM_VSCROLL;
    325325    procedure OnEOT(var Msg: TMessage); message WM_EOT;
    326326    procedure SoundPreload(Check: TSoundBlocks);
     
    36683668end;
    36693669
    3670 procedure TMainScreen.OnScroll(var m: TMessage);
    3671 begin
    3672   if sb.Process(m) then begin
     3670procedure TMainScreen.OnScroll(var Msg: TMessage);
     3671begin
     3672  if sb.Process(Msg) then begin
    36733673    PanelPaint;
    36743674    Update;
Note: See TracChangeset for help on using the changeset viewer.