[PR #5427] [MERGED] Various Differential Drawing fixes for #5345 #26316

Open
opened 2026-01-31 09:15:19 +00:00 by claunia · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/microsoft/terminal/pull/5427
Author: @zadjii-msft
Created: 4/20/2020
Status: ✅ Merged
Merged: 4/20/2020
Merged by: @miniksa

Base: dev/miniksa/dpi ← Head: dev/migrie/dpi


📝 Commits (10+)

  • 1f2a2e0 Merge remote-tracking branch 'origin/master' into dev/migrie/dpi
  • ef246ca This seems to work, but can it avoid resizing the buffer twice on a DPI change?
  • 87f833c Add a doc comment that should have been in the previous commit
  • 96c6ba9 Remove some dead code I didn't end up needing
  • 727fb06 convert TSFInputControl::_RedrawCanvas to use til wherever possible
  • defba05 I think this works fine on high-dpi for latin, cyrillic, emoji, chinese
  • 4c41188 This actaully works and displays the composition correctly. Needs comments
  • f870470 Clean up this code significantly
  • ace7a88 This does in fact work
  • 24eb455 Skip one of the two resizes during a DPI scale change.

📊 Changes

9 files changed (+250 additions, -105 deletions)

View changed files

📝 src/cascadia/TerminalControl/TSFInputControl.cpp (+47 -30)
📝 src/cascadia/TerminalControl/TermControl.cpp (+126 -45)
📝 src/cascadia/TerminalControl/TermControl.h (+1 -0)
📝 src/host/screenInfo.cpp (+14 -0)
📝 src/inc/til/bitmap.h (+4 -22)
📝 src/inc/til/point.h (+13 -2)
📝 src/inc/til/rectangle.h (+12 -0)
📝 src/inc/til/size.h (+23 -3)
📝 src/renderer/dx/DxRenderer.cpp (+10 -3)

📄 Description

Summary of the Pull Request

This is everything I've found in my attempt to resurrect #5345.

There are a bunch of new bugs and edge cases I've added to https://github.com/microsoft/terminal/pull/5345#issuecomment-614127648. Largely, things are much better.

TermControl.cpp

  • Use the font size in DIPs for pointer movement events, mouse scrolling events
  • When the settings are reloaded, if we change the font size, resize the buffer to fit the current window.
  • Actually whenever the font size changes, make sure to refresh the size of the buffer for the new font size in this window.
  • Use the engine's curent scale when dealing with a swapchain size change to avoid a bug where only part of the biewport would get redrawn
    • (this might actually not be needed anymore)
  • When the DPI changes, guess what, the font size might change too. Resize the buffer if it did.
  • When we're trying to get the pointer position inside the terminal, use til to make our lives easier.

TSFInputControl.cpp

  • Use til in this method to make our life easier
  • Properly account for things that are in DIPs and things that aren't anymore.

ScreenInfo.cpp

  • Make sure to update the size of the viewport with the VtEngine as soon as a resize happens, otherwise the rest of the invalidates that happen in this frame are going to error out and cause tearing.

point.h

  • add a point(float, float) ctor.

rectangle.h

  • add a winrt Rect cast.

size.h

  • add a size(int, ptrdiff_t) ctor.
  • add a size(ptrdiff_t, int) ctor.
  • add a size(float, float) ctor.

DxRenderer.cpp

  • When we incalidate all, just mark this as a _firstFrame, and don't bother with Present1. We know it won't work. So don't.
  • Don't use _invalidMap.all() in PaintBackground, because it mostly won't work.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/microsoft/terminal/pull/5427 **Author:** [@zadjii-msft](https://github.com/zadjii-msft) **Created:** 4/20/2020 **Status:** ✅ Merged **Merged:** 4/20/2020 **Merged by:** [@miniksa](https://github.com/miniksa) **Base:** `dev/miniksa/dpi` ← **Head:** `dev/migrie/dpi` --- ### 📝 Commits (10+) - [`1f2a2e0`](https://github.com/microsoft/terminal/commit/1f2a2e0c3ff16061ce48d481a9da7a410e811c59) Merge remote-tracking branch 'origin/master' into dev/migrie/dpi - [`ef246ca`](https://github.com/microsoft/terminal/commit/ef246caf86cb5ed3d63556f8b51daa82f7116c5b) This seems to work, but can it avoid resizing the buffer twice on a DPI change? - [`87f833c`](https://github.com/microsoft/terminal/commit/87f833c966c14cef0425b4c35c811228ed21a057) Add a doc comment that should have been in the previous commit - [`96c6ba9`](https://github.com/microsoft/terminal/commit/96c6ba9c491367e8b4962c7434e5aa894a6398cb) Remove some dead code I didn't end up needing - [`727fb06`](https://github.com/microsoft/terminal/commit/727fb065747c70ab0401873910994aba5940c2a8) convert TSFInputControl::_RedrawCanvas to use til wherever possible - [`defba05`](https://github.com/microsoft/terminal/commit/defba0544c71cdc88caa4efe0ca57526949b3f05) I think this works fine on high-dpi for latin, cyrillic, emoji, chinese - [`4c41188`](https://github.com/microsoft/terminal/commit/4c411882dbbb8e66166aea62cff2e26a98cbf88d) This _actaully_ works and displays the composition correctly. Needs comments - [`f870470`](https://github.com/microsoft/terminal/commit/f8704703af64bf5432508ee05bf80d2e61c7a82a) Clean up this code significantly - [`ace7a88`](https://github.com/microsoft/terminal/commit/ace7a889205dd12007206426a54585e7252e58b6) This does in fact work - [`24eb455`](https://github.com/microsoft/terminal/commit/24eb455d1b64db8990210726980fbef43b950759) Skip one of the two resizes during a DPI scale change. ### 📊 Changes **9 files changed** (+250 additions, -105 deletions) <details> <summary>View changed files</summary> 📝 `src/cascadia/TerminalControl/TSFInputControl.cpp` (+47 -30) 📝 `src/cascadia/TerminalControl/TermControl.cpp` (+126 -45) 📝 `src/cascadia/TerminalControl/TermControl.h` (+1 -0) 📝 `src/host/screenInfo.cpp` (+14 -0) 📝 `src/inc/til/bitmap.h` (+4 -22) 📝 `src/inc/til/point.h` (+13 -2) 📝 `src/inc/til/rectangle.h` (+12 -0) 📝 `src/inc/til/size.h` (+23 -3) 📝 `src/renderer/dx/DxRenderer.cpp` (+10 -3) </details> ### 📄 Description ## Summary of the Pull Request This is everything I've found in my attempt to resurrect #5345. There are a bunch of new bugs and edge cases I've added to https://github.com/microsoft/terminal/pull/5345#issuecomment-614127648. Largely, things are much better. ### `TermControl.cpp` * Use the font size in DIPs for pointer movement events, mouse scrolling events * When the settings are reloaded, if we change the font size, resize the buffer to fit the current window. * Actually whenever the font size changes, make sure to refresh the size of the buffer for the new font size in this window. * Use the engine's curent scale when dealing with a swapchain size change to avoid a bug where only part of the biewport would get redrawn - (this might actually not be needed anymore) * When the DPI changes, guess what, the font size might change too. Resize the buffer if it did. * When we're trying to get the pointer position inside the terminal, use `til` to make our lives easier. ### `TSFInputControl.cpp` * Use `til` in this method to make our life easier * Properly account for things that are in DIPs and things that aren't anymore. ### `ScreenInfo.cpp` * Make sure to update the size of the viewport with the VtEngine as soon as a resize happens, otherwise the rest of the invalidates that happen in this frame are going to error out and cause tearing. ### `point.h` * add a `point(float, float)` ctor. ### `rectangle.h` * add a winrt `Rect` cast. ### `size.h` * add a `size(int, ptrdiff_t)` ctor. * add a `size(ptrdiff_t, int)` ctor. * add a `size(float, float)` ctor. ### `DxRenderer.cpp` * When we incalidate all, just mark this as a `_firstFrame`, and don't bother with `Present1`. We know it won't work. So don't. * Don't use `_invalidMap.all()` in `PaintBackground`, because it mostly won't work. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
claunia added the pull-request label 2026-01-31 09:15:19 +00:00
Sign in to join this conversation.
No Label pull-request
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#26316