Changeset 46 for trunk/Start.pas


Ignore:
Timestamp:
Jan 11, 2017, 8:12:01 AM (7 years ago)
Author:
chronos
Message:
  • Fixed: Some graphic drawing problems caused by different pixel byte width of bitmaps under Linux.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Start.pas

    r41 r46  
    55
    66uses
    7   GameServer, Messg, ButtonBase, ButtonA, ButtonC, ButtonB, Area,
    8 
    9   LCLIntf, LCLType, LMessages, Messages, SysUtils, Classes, Graphics, Controls, Forms, StdCtrls,
     7  GameServer, Messg, ButtonBase, ButtonA, ButtonC, ButtonB, Area, Math,
     8  LCLIntf, LCLType, SysUtils, Classes, Graphics, Controls, Forms, StdCtrls,
    109  Menus, Registry;
    1110
     
    451450    BiColorTextOut(Canvas, Colors.Canvas.Pixels[clkAge0 - 1, cliDimmedText],
    452451      $000000, xAction, y + 21, Phrases2.Lookup(TextItem));
    453     BitBlt(LogoBuffer.Canvas.Handle, 0, 0, 50, 50, Canvas.Handle,
     452    BitBltCanvas(LogoBuffer.Canvas, 0, 0, 50, 50, Canvas,
    454453      xActionIcon - 2, y - 2, SRCCOPY);
    455454    GlowFrame(LogoBuffer, 8, 8, 34, 34, $202020);
     
    566565          h := ClientHeight - ActionBottomBorder -
    567566            (yAction + SelectedAction * ActionPitch - 8);
    568         BitBlt(LogoBuffer.Canvas.Handle, 0, 0, w, h, Canvas.Handle,
     567        BitBltCanvas(LogoBuffer.Canvas, 0, 0, w, h, Canvas,
    569568          ActionSideBorder + i * wBuffer, yAction + SelectedAction * ActionPitch
    570569          - 8, SRCCOPY);
     
    822821
    823822procedure TStartDlg.FormShow(Sender: TObject);
    824 type
    825   TLine = array [0 .. 99999999] of Byte;
    826 var
    827   i, x, y: integer;
    828   PictureLine: ^TLine;
     823var
     824  x, y: integer;
     825  PicturePixel: PPixel32;
    829826begin
    830827  SetMainTextureByAge(-1);
     
    836833  for y := 0 to 63 do
    837834  begin // darken texture for empty slot
    838     PictureLine := EmptyPicture.ScanLine[y];
    839     for x := 0 to 64 * 3 - 1 do
    840     begin
    841       i := integer(PictureLine[x]) - 28;
    842       if i < 0 then
    843         i := 0;
    844       PictureLine[x] := i;
     835    for x := 0 to 64 - 1 do
     836    begin
     837      PicturePixel := GetBitmapPixelPtr(EmptyPicture, x, y);
     838      PicturePixel^.B := Max(PicturePixel^.B - 28, 0);
     839      PicturePixel^.G := Max(PicturePixel^.G - 28, 0);
     840      PicturePixel^.R := Max(PicturePixel^.R - 28, 0);
    845841    end
    846842  end;
     
    10041000
    10051001  procedure PaintRandomMini(Brightness: integer);
    1006   type
    1007     TLine = array [0 .. lxmax * 2, 0 .. 2] of Byte;
    10081002  var
    10091003    i, x, y, xm, cm: integer;
    1010     MiniLine: ^TLine;
     1004    MiniPixel: PPixel32;
    10111005    Map: ^TTileList;
    10121006  begin
     
    10161010
    10171011    Mini.PixelFormat := pf24bit;
    1018     Mini.width := MiniWidth * 2;
    1019     Mini.height := MiniHeight;
     1012    Mini.SetSize(MiniWidth * 2, MiniHeight);
    10201013    Mini.BeginUpdate;
    1021     for y := 0 to MiniHeight - 1 do
    1022     begin
    1023       MiniLine := Mini.ScanLine[y];
    1024       for x := 0 to MiniWidth - 1 do
    1025         for i := 0 to 1 do
    1026         begin
     1014    for y := 0 to MiniHeight - 1 do begin
     1015      for x := 0 to MiniWidth - 1 do begin
     1016        for i := 0 to 1 do begin
    10271017          xm := (x * 2 + i + y and 1) mod (MiniWidth * 2);
     1018          MiniPixel := GetBitmapPixelPtr(Mini, xm, y);
    10281019          cm := MiniColors
    10291020            [Map[x * lxmax div MiniWidth + lxmax *
    10301021            ((y * (lymax - 1) + MiniHeight div 2) div (MiniHeight - 1))] and
    10311022            fTerrain, i];
    1032           MiniLine[xm, 0] := cm shr 16 * Brightness div 3;
    1033           MiniLine[xm, 1] := cm shr 8 and $FF * Brightness div 3;
    1034           MiniLine[xm, 2] := cm and $FF * Brightness div 3;
     1023          MiniPixel^.B := ((cm shr 16) and $FF) * Brightness div 3;
     1024          MiniPixel^.G := ((cm shr 8) and $FF) * Brightness div 3;
     1025          MiniPixel^.R := ((cm shr 0) and $FF) * Brightness div 3;
    10351026        end;
     1027      end;
    10361028    end;
    10371029    Mini.EndUpdate;
Note: See TracChangeset for help on using the changeset viewer.