Ignore:
Timestamp:
May 9, 2020, 4:02:07 PM (5 years ago)
Author:
chronos
Message:
  • Modified: Improved HighDPI branch. Imported new changes from trunk branch.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/highdpi/LocalPlayer/CityScreen.pas

    r193 r210  
    55
    66uses
    7   {$IFDEF LINUX}
     7  UDpiControls, {$IFDEF LINUX}
    88  LMessages,
    99  {$ENDIF}
    10   Protocol, ClientTools, Term, ScreenTools, IsoEngine, BaseWin, UDpiControls,
     10  Protocol, ClientTools, Term, ScreenTools, IsoEngine, BaseWin,
    1111  LCLIntf, LCLType, Messages, SysUtils, Classes, Graphics, Controls, Forms, ExtCtrls,
    1212  ButtonA, ButtonC, Area, GraphType;
     
    9090
    9191uses
    92   Select, Messg, MessgEx, Help, Tribes, Directories, Math;
     92  Select, Messg, MessgEx, Help, Tribes, Directories, Math, UPixelPointer, Sound;
    9393
    9494{$R *.lfm}
     
    216216  Template := TDpiBitmap.Create;
    217217  Template.PixelFormat := pf24bit;
    218   LoadGraphicFile(Template, HomeDir + 'Graphics' + DirectorySeparator + 'City.png', gfNoGamma);
     218  LoadGraphicFile(Template, GetGraphicsDir + DirectorySeparator + 'City.png', gfNoGamma);
    219219  CityMapTemplate := TDpiBitmap.Create;
    220220  CityMapTemplate.PixelFormat := pf24bit;
    221   LoadGraphicFile(CityMapTemplate, HomeDir + 'Graphics' + DirectorySeparator + 'BigCityMap.png', gfNoGamma);
     221  LoadGraphicFile(CityMapTemplate, GetGraphicsDir + DirectorySeparator + 'BigCityMap.png', gfNoGamma);
    222222  SmallCityMapTemplate := TDpiBitmap.Create;
    223223  SmallCityMapTemplate.PixelFormat := pf24bit;
    224   LoadGraphicFile(SmallCityMapTemplate, HomeDir + 'Graphics' + DirectorySeparator + 'SmallCityMap.png',
     224  LoadGraphicFile(SmallCityMapTemplate, GetGraphicsDir + DirectorySeparator + 'SmallCityMap.png',
    225225    gfNoGamma);
    226226  SmallCityMap := TDpiBitmap.Create;
     
    260260    Back.Canvas.FillRect(0, 0, ClientWidth, ClientHeight);
    261261
    262     Dpibitblt(Back.Canvas.Handle, 0, 0, ClientWidth, ClientHeight,
    263       MainTexture.Image.Canvas.Handle, 0, 0, SRCCOPY);
     262    DpiBitCanvas(Back.Canvas, 0, 0, ClientWidth, ClientHeight,
     263      MainTexture.Image.Canvas, 0, 0);
    264264    ImageOp_B(Back, Template, 0, 0, 0, 0, ClientWidth, ClientHeight);
    265265  end;
     
    291291  Color2 := Colors.Canvas.Pixels[clkAge0 + Age, cliHouse];
    292292  SmallCityMap.Canvas.FillRect(0, 0, SmallCityMap.Width, SmallCityMap.Height);
    293   Dpibitblt(SmallCityMap.Canvas.Handle, 0, 0, 83, hSmallMap,
    294     SmallCityMapTemplate.Canvas.Handle, 83 * SizeClass, 0, SRCCOPY);
     293  DpiBitCanvas(SmallCityMap.Canvas, 0, 0, 83, hSmallMap,
     294    SmallCityMapTemplate.Canvas, 83 * SizeClass, 0);
    295295  if IsPort then
    296296  begin
    297     Dpibitblt(SmallCityMap.Canvas.Handle, 83, 0, 15, hSmallMap,
    298       SmallCityMapTemplate.Canvas.Handle, 332 + 15, 0, SRCCOPY);
     297    DpiBitCanvas(SmallCityMap.Canvas, 83, 0, 15, hSmallMap,
     298      SmallCityMapTemplate.Canvas, 332 + 15, 0);
    299299    ImageOp_CCC(SmallCityMap, 0, 0, 83, hSmallMap, Color0, Color1, Color2);
    300300    Color2 := Colors.Canvas.Pixels[clkCity, cliWater];
     
    303303  else
    304304  begin
    305     Dpibitblt(SmallCityMap.Canvas.Handle, 83, 0, 15, hSmallMap,
    306       SmallCityMapTemplate.Canvas.Handle, 332, 0, SRCCOPY);
     305    DpiBitCanvas(SmallCityMap.Canvas, 83, 0, 15, hSmallMap,
     306      SmallCityMapTemplate.Canvas, 332, 0);
    307307    ImageOp_CCC(SmallCityMap, 0, 0, wSmallMap, hSmallMap, Color0,
    308308      Color1, Color2);
     
    311311  with SmallCityMap.Canvas do
    312312  begin
    313     brush.Color := ScreenTools.Colors.Canvas.Pixels[clkAge0 + Age, cliImp];
     313    Brush.Color := ScreenTools.Colors.Canvas.Pixels[clkAge0 + Age, cliImp];
    314314    for i := 0 to 29 do
    315315    begin
     
    359359  ZoomCityMap.Canvas.FillRect(0, 0, ZoomCityMap.Width, ZoomCityMap.Height);
    360360
    361   Dpibitblt(ZoomCityMap.Canvas.Handle, 0, 0, wZoomMap, hZoomMap,
    362     Back.Canvas.Handle, xZoomMap, yZoomMap, SRCCOPY);
     361  DpiBitCanvas(ZoomCityMap.Canvas, 0, 0, wZoomMap, hZoomMap,
     362    Back.Canvas, xZoomMap, yZoomMap);
    363363  if Mode = mImp then begin
    364364    if ZoomArea < 3 then begin
     
    442442    PixelPtr: TPixelPointer;
    443443  begin
     444    X := ScaleToVcl(X);
     445    Y := ScaleToVcl(Y);
     446    W := ScaleToVcl(W);
     447    H := ScaleToVcl(H);
    444448    Offscreen.BeginUpdate;
    445     PixelPtr.Init(Offscreen, X, Y);
     449    PixelPtr := PixelPointer(Offscreen, X, Y);
    446450    for YY := 0 to H - 1 do begin
    447451      for XX := 0 to W - 1 do begin
     
    498502
    499503var
    500   x, y, xGr, i, i1, j, iix, d, dx, dy, PrCost, Cnt, Loc1, FreeSupp, Paintiix,
     504  x, y, xGr, i, j, iix, d, dx, dy, PrCost, Cnt, Loc1, FreeSupp, Paintiix,
    501505    HappyGain, OptiType, rx, ry, TrueFood, TrueProd, TruePoll: integer;
    502506  av: integer;
     
    542546  RedTex.clTextShade := $0000FF;
    543547
    544   Dpibitblt(offscreen.Canvas.Handle, 0, 0, 640, 480, Back.Canvas.Handle, 0,
    545     0, SRCCOPY);
    546 
    547   offscreen.Canvas.Font.Assign(UniFont[ftCaption]);
     548  DpiBitCanvas(offscreen.Canvas, 0, 0, 640, 480, Back.Canvas, 0, 0);
     549
     550  Offscreen.Canvas.Font.Assign(UniFont[ftCaption]);
    548551  RisedTextOut(offscreen.Canvas, 42, 7, Caption);
    549552  with offscreen.Canvas do
     
    558561    TextOut(8 + 14 - textwidth(s) div 2, 7, s);
    559562  end;
    560   offscreen.Canvas.Font.Assign(UniFont[ftSmall]);
     563  Offscreen.Canvas.Font.Assign(UniFont[ftSmall]);
    561564
    562565  if not IsCityAlive then
     
    614617    false, AllowChange and IsCityAlive and
    615618    (c.Status and csResourceWeightsMask = 0));
    616   Dpibitblt(offscreen.Canvas.Handle, xmArea + 102, 42, 90, 33, Back.Canvas.Handle,
    617     xmArea + 102, 42, SRCCOPY);
     619  DpiBitCanvas(offscreen.Canvas, xmArea + 102, 42, 90, 33, Back.Canvas,
     620    xmArea + 102, 42);
    618621
    619622  if IsCityAlive then
     
    645648    else
    646649      xGr := 141;
    647     Dpibitblt(offscreen.Canvas.Handle, xmArea - 192 + 5 + i * d, ymArea - 96 - 29,
    648       27, 30, GrExt[HGrSystem].Mask.Canvas.Handle, xGr, 171, SRCAND); { shadow }
     650    DpiBitCanvas(offscreen.Canvas, xmArea - 192 + 5 + i * d, ymArea - 96 - 29,
     651      27, 30, GrExt[HGrSystem].Mask.Canvas, xGr, 171, SRCAND); { shadow }
    649652    Sprite(offscreen, HGrSystem, xmArea - 192 + 4 + i * d, ymArea - 96 - 30, 27,
    650653      30, xGr, 171);
     
    657660  begin
    658661    xGr := 1 + 112;
    659     Dpibitblt(offscreen.Canvas.Handle, xmArea + 192 - 27 + 1 - i * d, 29 + 1, 27,
    660       30, GrExt[HGrSystem].Mask.Canvas.Handle, xGr, 171, SRCAND); { shadow }
     662    DpiBitCanvas(offscreen.Canvas, xmArea + 192 - 27 + 1 - i * d, 29 + 1, 27,
     663      30, GrExt[HGrSystem].Mask.Canvas, xGr, 171, SRCAND); { shadow }
    661664    Sprite(offscreen, HGrSystem, xmArea + 192 - 27 - i * d, 29, 27, 30,
    662665      xGr, 171);
     
    803806
    804807  // small map
    805   Dpibitblt(offscreen.Canvas.Handle, xSmallMap, ySmallMap, wSmallMap, hSmallMap,
    806     SmallCityMap.Canvas.Handle, 0, 0, SRCCOPY);
     808  DpiBitCanvas(offscreen.Canvas, xSmallMap, ySmallMap, wSmallMap, hSmallMap,
     809    SmallCityMap.Canvas, 0, 0);
    807810  if Mode = mImp then
    808811    Frame(offscreen.Canvas, xSmallMap + 48 * (ZoomArea div 3),
     
    831834  Sprite(offscreen, HGrSystem, x + 6, y - 5, 10, 10, 154, 126);
    832835
    833   Dpibitblt(offscreen.Canvas.Handle, xZoomMap, yZoomMap, wZoomMap, hZoomMap,
    834     ZoomCityMap.Canvas.Handle, 0, 0, SRCCOPY);
     836  DpiBitCanvas(offscreen.Canvas, xZoomMap, yZoomMap, wZoomMap, hZoomMap,
     837    ZoomCityMap.Canvas, 0, 0);
    835838
    836839  for i := 0 to 5 do
     
    16201623      with Canvas do
    16211624      begin
    1622         Dpibitblt(Canvas.Handle, xView + 5, yView + 1, 64, 2, Back.Canvas.Handle,
    1623           xView + 5, yView + 1, SRCCOPY);
    1624         Dpibitblt(Canvas.Handle, xView + 5, yView + 3, 2, 42, Back.Canvas.Handle,
    1625           xView + 5, yView + 3, SRCCOPY);
    1626         Dpibitblt(Canvas.Handle, xView + 5 + 62, yView + 3, 2, 42,
    1627           Back.Canvas.Handle, xView + 5 + 62, yView + 3, SRCCOPY);
     1625        DpiBitCanvas(Canvas, xView + 5, yView + 1, 64, 2, Back.Canvas,
     1626          xView + 5, yView + 1);
     1627        DpiBitCanvas(Canvas, xView + 5, yView + 3, 2, 42, Back.Canvas,
     1628          xView + 5, yView + 3);
     1629        DpiBitCanvas(Canvas, xView + 5 + 62, yView + 3, 2, 42,
     1630          Back.Canvas, xView + 5 + 62, yView + 3);
    16281631        ScreenTools.Frame(Canvas, xView + 9 - 1, yView + 5 - 1, xView + 9 + xSizeBig,
    16291632          yView + 5 + ySizeBig, $B0B0B0, $FFFFFF);
    16301633        RFrame(Canvas, xView + 9 - 2, yView + 5 - 2, xView + 9 + xSizeBig + 1,
    16311634          yView + 5 + ySizeBig + 1, $FFFFFF, $B0B0B0);
    1632         brush.Color := $000000;
     1635        Brush.Color := $000000;
    16331636        FillRect(Rect(xView + 9, yView + 5, xView + 1 + 72 - 8,
    16341637          yView + 5 + 40));
    1635         brush.style := bsClear;
     1638        Brush.style := bsClear;
    16361639      end
    16371640    else if BlinkTime = 6 then
     
    16441647      else if c.Project and cpImp = 0 then
    16451648      begin // project is unit
    1646         Dpibitblt(Canvas.Handle, xView + 9, yView + 5, xSizeBig, ySizeBig,
    1647           bigimp.Canvas.Handle, 0, 0, SRCCOPY);
     1649        DpiBitCanvas(Canvas, xView + 9, yView + 5, xSizeBig, ySizeBig,
     1650          Bigimp.Canvas, 0, 0);
    16481651        with Tribe[cOwner].ModelPicture[c.Project and cpIndex] do
    16491652          Sprite(Canvas, HGr, xView + 5, yView + 1, 64, 44, pix mod 10 * 65 + 1,
Note: See TracChangeset for help on using the changeset viewer.