Ignore:
Timestamp:
Jun 25, 2020, 10:24:44 PM (4 years ago)
Author:
chronos
Message:
  • Fixed: Scaling IsoEngine ForgOfWar sprites.
  • Fixed: PopupMenu position calculated using not scaled GetSystemMetrics.
  • Fixed: Scale TDpiBitmaps using normal scaling functions to get pixels on valid expected possition.
  • Fixed: DpiBitBlt needs to be executed as StretchDraw for non-integer pixel scaling. This leads to slower drawing.
File:
1 edited

Legend:

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

    r254 r265  
    563563  nx := BigImp.Width div xSizeBig * xSizeSmall;
    564564  ny := BigImp.Height div ySizeBig * ySizeSmall;
     565  SmallImp.SetSize(nx, ny);
     566  SmallImp.Canvas.StretchDraw(Rect(0, 0, SmallImp.Width, SmallImp.Height), BigImp);
     567
     568{  nx := BigImp.Width div xSizeBig * xSizeSmall;
     569  ny := BigImp.Height div ySizeBig * ySizeSmall;
    565570
    566571  // resample icons
     
    636641  SmallImp.EndUpdate;
    637642  FreeMem(Resampled);
     643  }
    638644end;
    639645
     
    35833589  sb.SetBorderSpacing(ClientHeight - yTroop - 24, ClientWidth - xRightPanel + 8, 8);
    35843590  {TODO:
    3585   SetWindowPos(sb.ScrollBar.Handle, 0, xRightPanel + 10 - 14 - GetSystemMetrics(SM_CXVSCROLL),
     3591  SetWindowPos(sb.ScrollBar.Handle, 0, xRightPanel + 10 - 14 - DpiGetSystemMetrics(SM_CXVSCROLL),
    35863592    ClientHeight - MidPanelHeight + 8, 0, 0, SWP_NOSIZE or SWP_NOZORDER);
    35873593    }
     
    36693675    if SmallScreen and not supervising then
    36703676      xTroop := xRightPanel + 10 - 3 * 66 -
    3671         GetSystemMetrics(SM_CXVSCROLL) - 19 - 4;
     3677        DpiGetSystemMetrics(SM_CXVSCROLL) - 19 - 4;
    36723678    // not perfect but we assume almost no one is still playing on a 800x600 screen
    36733679  end;
    3674   TrRow := (xRightPanel + 10 - xTroop - GetSystemMetrics(SM_CXVSCROLL) - 19)
     3680  TrRow := (xRightPanel + 10 - xTroop - DpiGetSystemMetrics(SM_CXVSCROLL) - 19)
    36753681    div TrPitch;
    36763682end;
     
    53305336      else
    53315337        EditPopup.Popup(Left + x + 4,
    5332           Top + y + GetSystemMetrics(SM_CYCAPTION) + 4);
     5338          Top + y + DpiGetSystemMetrics(SM_CYCAPTION) + 4);
    53335339    end
    53345340    else if (UnFocus >= 0) and (MyUn[UnFocus].Loc <> MouseLoc) then
     
    62146220        StatPopup.Popup(Left + ClientWidth - xPalace + 6,
    62156221          Top + ClientHeight - PanelHeight + yPalace + ySizeBig +
    6216           GetSystemMetrics(SM_CYCAPTION) + 3)
     6222          DpiGetSystemMetrics(SM_CYCAPTION) + 3)
    62176223    end
    62186224    (* else if (x>=xAdvisor-3) and (y>=yAdvisor-3)
     
    63066312begin
    63076313  TroopLoc := Loc;
    6308   TrRow := (xRightPanel + 10 - xTroop - GetSystemMetrics(SM_CXVSCROLL) - 19)
     6314  TrRow := (xRightPanel + 10 - xTroop - DpiGetSystemMetrics(SM_CXVSCROLL) - 19)
    63096315    div TrPitch;
    63106316  TrCnt := 0;
     
    74407446  else
    74417447    Popup.Popup(Left + TDpiControl(Sender).Left + 4, Top + TDpiControl(Sender).Top +
    7442       GetSystemMetrics(SM_CYCAPTION) + 4);
     7448      DpiGetSystemMetrics(SM_CYCAPTION) + 4);
    74437449end;
    74447450
     
    76007606          GamePopup.Popup(Left, Top + TopBarHeight - 1)
    76017607        else
    7602           GamePopup.Popup(Left + 4, Top + GetSystemMetrics(SM_CYCAPTION) + 4 +
     7608          GamePopup.Popup(Left + 4, Top + DpiGetSystemMetrics(SM_CYCAPTION) + 4 +
    76037609            TopBarHeight - 1);
    76047610      end
     
    78907896      GamePopup.Popup(Left, Top + TopBarHeight - 1)
    78917897    else
    7892       GamePopup.Popup(Left + 4, Top + GetSystemMetrics(SM_CYCAPTION) + 4 +
     7898      GamePopup.Popup(Left + 4, Top + DpiGetSystemMetrics(SM_CYCAPTION) + 4 +
    78937899        TopBarHeight - 1);
    78947900    exit
Note: See TracChangeset for help on using the changeset viewer.