Changeset 308


Ignore:
Timestamp:
Mar 9, 2021, 9:13:07 PM (4 years ago)
Author:
chronos
Message:
  • Modified: Better scaled bitmaps drawing.
Location:
branches/highdpi
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/highdpi/Packages/DpiControls/UDpiControls.pas

    r303 r308  
    99  Controls, StdCtrls, fgl, Graphics, ComCtrls, ExtCtrls, LCLType, GraphType,
    1010  Types, CustApp, LMessages, LCLIntf, Menus, Math, UPixelPointer2;
     11
     12const
     13  FixedDpi = -1;
    1114
    1215type
     
    10711074function ScaleToNative(Value: Integer): Integer;
    10721075begin
    1073   Result := Round(Value * DpiScreen.Dpi / 96);
     1076  Result := Trunc(Value * DpiScreen.Dpi / 96);
    10741077end;
    10751078
     
    30683071procedure TDpiScreen.UpdateScreen;
    30693072begin
    3070   Dpi := Screen.PixelsPerInch;
     3073  if FixedDpi = -1 then Dpi := Screen.PixelsPerInch
     3074    else Dpi := FixedDpi;
    30713075end;
    30723076
  • branches/highdpi/Start.pas

    r303 r308  
    380380  MiniPixel: TPixelPointer;
    381381  PrevMiniPixel: TPixelPointer;
     382  TerrainTile: Cardinal;
    382383begin
    383384  OwnColor := GrExt[HGrSystem].Data.Canvas.Pixels[95, 67];
     
    415416              cm := OwnColor
    416417            else cm := EnemyColor
    417           else
    418             cm := Colors[Tile and fTerrain, i];
     418          else begin
     419            TerrainTile := Tile and fTerrain;
     420            if TerrainTile > 11 then TerrainTile := 0;
     421            cm := Colors[TerrainTile, i];
     422          end;
    419423          MiniPixel.Pixel^.B := (cm shr 16) and $ff;
    420424          MiniPixel.Pixel^.G := (cm shr 8) and $ff;
Note: See TracChangeset for help on using the changeset viewer.