Changeset 62 for trunk


Ignore:
Timestamp:
Jan 13, 2017, 7:45:16 PM (8 years ago)
Author:
chronos
Message:
  • Fixed: Replaced ScanLine access be linux supported pixel access.
Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/LocalPlayer/Draft.lfm

    r9 r62  
    11object DraftDlg: TDraftDlg
    22  Left = 325
     3  Height = 511
    34  Top = 206
     5  Width = 315
    46  BorderIcons = []
    57  BorderStyle = bsNone
     
    79  ClientWidth = 315
    810  Color = clBtnFace
    9   Font.Charset = DEFAULT_CHARSET
    1011  Font.Color = clWindowText
    1112  Font.Height = -13
    1213  Font.Name = 'MS Sans Serif'
    13   Font.Style = []
    1414  FormStyle = fsStayOnTop
    1515  OnCreate = FormCreate
     
    1818  OnMouseUp = PaintBox1MouseUp
    1919  OnShow = FormShow
    20   PixelsPerInch = 96
     20  LCLVersion = '1.6.0.4'
    2121  object OKBtn: TButtonA
    2222    Left = 196
     23    Height = 25
    2324    Top = 477
    2425    Width = 100
    25     Height = 25
    2626    Down = False
    2727    Permanent = False
    2828    OnClick = OKBtnClick
    29     Caption = ''
    3029  end
    3130  object CloseBtn: TButtonB
    3231    Left = 284
     32    Height = 25
    3333    Top = 6
    3434    Width = 25
    35     Height = 25
    3635    Down = False
    3736    Permanent = False
     
    4140  object GroundArea: TArea
    4241    Left = 30
     42    Height = 36
    4343    Top = 464
    4444    Width = 36
    45     Height = 36
    4645  end
    4746  object SeaArea: TArea
    4847    Left = 70
     48    Height = 36
    4949    Top = 464
    5050    Width = 36
    51     Height = 36
    5251  end
    5352  object AirArea: TArea
    5453    Left = 110
     54    Height = 36
    5555    Top = 464
    5656    Width = 36
    57     Height = 36
    5857  end
    5958end
  • trunk/LocalPlayer/Draft.pas

    r61 r62  
    1919    AirArea: TArea;
    2020    procedure FormCreate(Sender: TObject);
     21    procedure FormDestroy(Sender: TObject);
    2122    procedure FormShow(Sender: TObject);
    2223    procedure CloseBtnClick(Sender: TObject);
     
    2627    procedure PaintBox1MouseUp(Sender: TObject; Button: TMouseButton;
    2728      Shift: TShiftState; x, y: integer);
    28     procedure FormDestroy(Sender: TObject);
    2929  public
    3030    procedure ShowNewContent(NewMode: integer);
     
    232232begin
    233233  inherited;
     234  // TODO: Explicitly clear background to black but in fact BitBlt SRCCOPY should do it
     235  Back.Canvas.FillRect(0, 0, Back.Width, Back.Height);
    234236
    235237  ClientHeight := Template.Height - Cut;
  • trunk/LocalPlayer/MessgEx.pas

    r61 r62  
    232232  wScrewed = 43;
    233233  hScrewed = 27;
    234 type
    235   TLine = array [0 .. 9999, 0 .. 2] of Byte;
    236234var
    237235  ix, iy, xDst, yDst, dx, dy, xIcon, yIcon, xb, yb, wb, hb: integer;
    238236  x1, xR, yR, share: single;
    239237  Screwed: array [0 .. wScrewed - 1, 0 .. hScrewed - 1, 0 .. 3] of single;
    240   SrcLine: ^TLine;
    241 
    242 begin
    243   if IconIndex >= 0 then
    244   begin
     238  SrcPtr: TPixelPointer;
     239begin
     240  if IconIndex >= 0 then begin
    245241    xIcon := IconIndex mod 7 * xSizeBig;
    246242    yIcon := (IconIndex + SystemIconLines * 7) div 7 * ySizeBig;
     
    248244    fillchar(Screwed, sizeof(Screwed), 0);
    249245    BigImp.BeginUpdate;
    250     for iy := 0 to 39 do
    251     begin
    252       SrcLine := BigImp.ScanLine[iy + yIcon];
    253       for ix := 0 to 55 do
    254       begin
     246    for iy := 0 to 39 do begin
     247      for ix := 0 to 55 do begin
     248        SrcPtr.Init(BigImp, ix + xIcon, iy + yIcon);
    255249        xR := ix * (37 + iy * 5 / 40) / 56;
    256250        xDst := Trunc(xR);
     
    261255        yR := Frac(yR);
    262256        for dx := 0 to 1 do
    263           for dy := 0 to 1 do
    264           begin
     257          for dy := 0 to 1 do begin
    265258            if dx = 0 then
    266259              share := 1 - xR
     
    272265              share := share * yR;
    273266            Screwed[xDst + dx, yDst + dy, 0] := Screwed[xDst + dx, yDst + dy, 0]
    274               + share * SrcLine[ix + xIcon, 0];
     267              + share * SrcPtr.Pixel^.B;
    275268            Screwed[xDst + dx, yDst + dy, 1] := Screwed[xDst + dx, yDst + dy, 1]
    276               + share * SrcLine[ix + xIcon, 1];
     269              + share * SrcPtr.Pixel^.G;
    277270            Screwed[xDst + dx, yDst + dy, 2] := Screwed[xDst + dx, yDst + dy, 2]
    278               + share * SrcLine[ix + xIcon, 2];
     271              + share * SrcPtr.Pixel^.R;
    279272            Screwed[xDst + dx, yDst + dy, 3] := Screwed[xDst + dx, yDst + dy,
    280273              3] + share;
  • trunk/ScreenTools.pas

    r60 r62  
    3838    BytesPerPixel: Integer;
    3939    BytesPerLine: Integer;
    40     procedure NextLine;
    41     procedure NextPixel;
    42     procedure SetXY(X, Y: Integer);
    43     procedure SetX(X: Integer);
    44     procedure Init(Bitmap: TBitmap; X: Integer = 0; Y: Integer = 0);
     40    procedure NextLine; inline;
     41    procedure NextPixel; inline;
     42    procedure SetXY(X, Y: Integer); inline;
     43    procedure SetX(X: Integer); inline;
     44    procedure Init(Bitmap: TBitmap; X: Integer = 0; Y: Integer = 0); inline;
    4545  end;
    4646
     
    624624
    625625procedure MakeBlue(dst: TBitmap; x, y, w, h: integer);
    626 type
    627   TLine = array [0 .. 99999, 0 .. 2] of Byte;
    628   PLine = ^TLine;
    629 
    630   procedure BlueLine(line: PLine; Length: integer);
    631   var
    632     i: integer;
    633   begin
    634     for i := 0 to Length - 1 do
    635     begin
    636       line[i, 0] := line[i, 0] div 2;
    637       line[i, 1] := line[i, 1] div 2;
    638       line[i, 2] := line[i, 2] div 2;
    639     end
    640   end;
    641 
    642 var
    643   i: integer;
    644 begin
    645   dst.BeginUpdate;
    646   for i := 0 to h - 1 do
    647     BlueLine(@(PLine(dst.ScanLine[y + i])[x]), w);
    648   dst.EndUpdate;
     626var
     627  XX, YY: Integer;
     628  PixelPtr: TPixelPointer;
     629begin
     630  Dst.BeginUpdate;
     631  PixelPtr.Init(Dst, 0, 0);
     632  for yy := 0 to h - 1 do begin
     633    for xx := 0 to w - 1 do begin
     634      PixelPtr.Pixel^.B := PixelPtr.Pixel^.B div 2;
     635      PixelPtr.Pixel^.G := PixelPtr.Pixel^.G div 2;
     636      PixelPtr.Pixel^.R := PixelPtr.Pixel^.R div 2;
     637      PixelPtr.NextPixel;
     638    end;
     639    PixelPtr.NextLine;
     640  end;
     641  Dst.EndUpdate;
    649642end;
    650643
     
    916909
    917910procedure GlowFrame(dst: TBitmap; x0, y0, Width, Height: integer; cl: TColor);
    918 type
    919   TLine = array [0 .. 649, 0 .. 2] of Byte;
    920911var
    921912  x, y, ch, r: integer;
    922   DstLine: ^TLine;
     913  DstPtr: TPixelPointer;
    923914begin
    924915  dst.BeginUpdate;
    925916  for y := -GlowRange + 1 to Height - 1 + GlowRange - 1 do
    926917  begin
    927     DstLine := dst.ScanLine[y0 + y];
    928918    for x := -GlowRange + 1 to Width - 1 + GlowRange - 1 do
    929919    begin
     920      DstPtr.Init(dst, x0 + x, y0 + y);
    930921      if x < 0 then
    931922        if y < 0 then
     
    952943      if r < GlowRange then
    953944        for ch := 0 to 2 do
    954           DstLine[x0 + x][2 - ch] :=
    955             (DstLine[x0 + x][2 - ch] * (r - 1) + (cl shr (8 * ch) and $FF) *
     945          DstPtr.Pixel^.Planes[2 - ch] :=
     946            (DstPtr.Pixel^.Planes[2 - ch] * (r - 1) + (cl shr (8 * ch) and $FF) *
    956947            (GlowRange - r)) div (GlowRange - 1);
    957948    end;
Note: See TracChangeset for help on using the changeset viewer.