[PR #6224] [CLOSED] WIP: Draw backgrounds separately from foregrounds #26602

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

📋 Pull Request Information

Original PR: https://github.com/microsoft/terminal/pull/6224
Author: @DHowett
Created: 5/27/2020
Status: Closed

Base: masterHead: dev/duhowett/background-atlas


📝 Commits (3)

📊 Changes

15 files changed (+328 additions, -46 deletions)

View changed files

📝 src/buffer/out/TextAttribute.hpp (+14 -6)
📝 src/buffer/out/TextColor.h (+1 -0)
📝 src/renderer/base/renderer.cpp (+229 -36)
📝 src/renderer/base/renderer.hpp (+18 -0)
📝 src/renderer/dx/CustomTextRenderer.cpp (+0 -2)
📝 src/renderer/dx/DxRenderer.cpp (+12 -0)
📝 src/renderer/dx/DxRenderer.hpp (+3 -0)
📝 src/renderer/gdi/gdirenderer.hpp (+3 -0)
📝 src/renderer/gdi/paint.cpp (+17 -1)
📝 src/renderer/gdi/state.cpp (+2 -1)
📝 src/renderer/inc/IRenderEngine.hpp (+18 -0)
📝 src/renderer/uia/UiaRenderer.cpp (+5 -0)
📝 src/renderer/uia/UiaRenderer.hpp (+1 -0)
📝 src/renderer/vt/paint.cpp (+4 -0)
📝 src/renderer/vt/vtrenderer.hpp (+1 -0)

📄 Description

This implements #6193. It's a WIP.

Summary of the Pull Request


Alright, I've got this down to a single function that takes each dirty region and produces...

  • A list of damaged backgrounds to repaint
  • A list of colored cluster lists to repaint

I don't like the number of vectors here, but... we're saving money by invalidating narrowly whenever possible.

Dirty Region [1..n]
- Origin (SCREEN CHAR COORDS)
- At line wrap point
- Region intersected right half of DBCS char (left trim)
- Background Run [1..n]
  - Attribute
  - Rect Covered (SCREEN CHAR COORDS)
- Colored Foreground Run [1..n]
  - Attribute
  - Columns
  - Cluster [1..n]

Right now, because of some minor issues (#2661), backgrounds are attributes and actual final colors. It's not pleasant!

To fix:

  • reverse is occasionally (!) broken
  • render engines need flags to say "plz no background splitting" (vt engine needs to update drawing brushes per text run, foreground and background)
  • need to re-enable space optimization (if the cell is non-printing (and has no underline, etc.), no point in forwarding it to the cluster renderer!)

References

PR Checklist

  • Closes #xxx
  • CLA signed. If not, go over here and sign the CLA
  • Tests added/passed
  • Requires documentation to be updated
  • I've discussed this with core contributors already. If not checked, I'm ready to accept this work might be rejected in favor of a different grand plan. Issue number where discussion took place: #xxx

Detailed Description of the Pull Request / Additional comments

Validation Steps Performed


🔄 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/6224 **Author:** [@DHowett](https://github.com/DHowett) **Created:** 5/27/2020 **Status:** ❌ Closed **Base:** `master` ← **Head:** `dev/duhowett/background-atlas` --- ### 📝 Commits (3) - [`890043c`](https://github.com/microsoft/terminal/commit/890043c8b77ae2545a3e8e69def61c35ed9a35fe) background atlas I - [`8786c6b`](https://github.com/microsoft/terminal/commit/8786c6b1165875f552bf80bed0c49ac5e9fe0f3a) Background atlas 2 - [`bc7012f`](https://github.com/microsoft/terminal/commit/bc7012f646b5650f47d359165134bde5d427242a) background atlas 3 ### 📊 Changes **15 files changed** (+328 additions, -46 deletions) <details> <summary>View changed files</summary> 📝 `src/buffer/out/TextAttribute.hpp` (+14 -6) 📝 `src/buffer/out/TextColor.h` (+1 -0) 📝 `src/renderer/base/renderer.cpp` (+229 -36) 📝 `src/renderer/base/renderer.hpp` (+18 -0) 📝 `src/renderer/dx/CustomTextRenderer.cpp` (+0 -2) 📝 `src/renderer/dx/DxRenderer.cpp` (+12 -0) 📝 `src/renderer/dx/DxRenderer.hpp` (+3 -0) 📝 `src/renderer/gdi/gdirenderer.hpp` (+3 -0) 📝 `src/renderer/gdi/paint.cpp` (+17 -1) 📝 `src/renderer/gdi/state.cpp` (+2 -1) 📝 `src/renderer/inc/IRenderEngine.hpp` (+18 -0) 📝 `src/renderer/uia/UiaRenderer.cpp` (+5 -0) 📝 `src/renderer/uia/UiaRenderer.hpp` (+1 -0) 📝 `src/renderer/vt/paint.cpp` (+4 -0) 📝 `src/renderer/vt/vtrenderer.hpp` (+1 -0) </details> ### 📄 Description This implements #6193. It's a WIP. ## Summary of the Pull Request --- Alright, I've got this down to a single function that takes each dirty region and produces... * A list of damaged backgrounds to repaint * A list of colored cluster lists to repaint I don't like the number of vectors here, but... we're saving money by invalidating narrowly whenever possible. ``` Dirty Region [1..n] - Origin (SCREEN CHAR COORDS) - At line wrap point - Region intersected right half of DBCS char (left trim) - Background Run [1..n] - Attribute - Rect Covered (SCREEN CHAR COORDS) - Colored Foreground Run [1..n] - Attribute - Columns - Cluster [1..n] ``` Right now, because of some minor issues (#2661), backgrounds are attributes _and_ actual final colors. It's not pleasant! To fix: * [ ] reverse is occasionally (!) broken * [x] render engines need flags to say "plz no background splitting" (vt engine needs to update drawing brushes per text run, foreground _and_ background) * [ ] need to re-enable space optimization (if the cell is non-printing (and has no underline, etc.), no point in forwarding it to the cluster renderer!) --- <!-- Other than the issue solved, is this relevant to any other issues/existing PRs? --> ## References <!-- Please review the items on the PR checklist before submitting--> ## PR Checklist * [ ] Closes #xxx * [ ] CLA signed. If not, go over [here](https://cla.opensource.microsoft.com/microsoft/Terminal) and sign the CLA * [ ] Tests added/passed * [ ] Requires documentation to be updated * [ ] I've discussed this with core contributors already. If not checked, I'm ready to accept this work might be rejected in favor of a different grand plan. Issue number where discussion took place: #xxx <!-- Provide a more detailed description of the PR, other things fixed or any additional comments/features here --> ## Detailed Description of the Pull Request / Additional comments <!-- Describe how you validated the behavior. Add automated tests wherever possible, but list manual validation steps taken as well --> ## Validation Steps Performed --- <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:17:05 +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#26602