[PR #4967] [MERGED] til::bitmap #26060

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

📋 Pull Request Information

Original PR: https://github.com/microsoft/terminal/pull/4967
Author: @miniksa
Created: 3/17/2020
Status: ✅ Merged
Merged: 3/19/2020
Merged by: @undefined

Base: master ← Head: dev/miniksa/til_bitmap


📝 Commits (10+)

  • d637178 bring bitmap and supporting rectangle mods over, implement more bitmap tests.
  • 70567d4 Make bitmap tests. Add supplemental helpers to rectangle and some, also add associated tests.
  • 69b44ae Add tests for setting/resetting points/rectangles out of bounds. Add support method for checking if rectangle contains another, add test for that too.
  • fca07fa code format pass.
  • 79d1f33 Don't include stuff at the top of bitmap. Don't use reserved naming for iterator. Fix unsigned issues for x86.
  • 81af5aa Fix comment
  • 09139c4 SA fixes.
  • de20c5a make bitmap track a rectangle inside. remove empty and add bitset methods of all/any/none. also add convenience one() method in prediction of what conpty will be looking for.
  • a86b8fa Some frees members, some comments about the rectangle iterator and move it to details namespace.
  • c4df795 Make resize work and add tests. Add constructors that let you allocate a bitmap already filled. Generalize the bit checking method in the tests.

📊 Changes

9 files changed (+1141 additions, -0 deletions)

View changed files

📝 src/inc/til.h (+1 -0)
➕ src/inc/til/bitmap.h (+267 -0)
📝 src/inc/til/rectangle.h (+154 -0)
📝 src/inc/til/some.h (+18 -0)
➕ src/til/ut_til/BitmapTests.cpp (+445 -0)
📝 src/til/ut_til/RectangleTests.cpp (+220 -0)
📝 src/til/ut_til/SomeTests.cpp (+34 -0)
📝 src/til/ut_til/til.unit.tests.vcxproj (+1 -0)
📝 src/til/ut_til/til.unit.tests.vcxproj.filters (+1 -0)

📄 Description

Summary of the Pull Request

Introduces type til::bitmap which implements an NxM grid of bits that can be used to track dirty/clean state on a per-cell basis throughout a rectangle.

PR Checklist

  • In support of Differential Rendering #778
  • I work here.
  • Tests added/passed
  • I'm a core contributor.

Detailed Description of the Pull Request / Additional comments

  • Adds const_iterator to til::rectangle that will walk from top to bottom, left to right every position in the rectangle as a til::point and associated test.
  • Adds bool til::rectangle::contains(til::point) to determine if a point lies within the rectangle and the associated test
  • Adds complementary methods to til::rectangle of index_of(til::point) and point_at(ptrdiff_t) which will convert between a valid point position that lies inside the rectangle and the index as a count of cells from the top left corner (origin) in a top to bottom & left to right counting fashion (and associated tests).
  • Adds til::some<T, N>::clear() to empty out the contents of the some and associated test.
    THEN with all that support...
  • Adds til::bitmap which represents a 2 dimensional grid of boolean/bit flags. This class contains set and reset methods for the entire region, and set only for a single til::point or a subregion as specified by a til::rectangle (and associated tests.)
  • Adds convenience methods of any(), one(), none(), and all() to the til::bitmap to check some of its state.
  • Adds convenience method of resize() to til::bitmap that will grow or shrink the bitmap, copying whatever is left of the previous one that still fits and optionally filling or blanking the new space.
  • Adds a const_iterator for til::bitmap that will walk top to bottom, left to right and return a til::rectangle representing a run of bits that are all on sequentially in a row. Breaks per row. Exactly as we expect to be drawing things (and associated tests.)

Validation Steps Performed

  • See automated tests of functionality.

🔄 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/4967 **Author:** [@miniksa](https://github.com/miniksa) **Created:** 3/17/2020 **Status:** ✅ Merged **Merged:** 3/19/2020 **Merged by:** [@undefined](undefined) **Base:** `master` ← **Head:** `dev/miniksa/til_bitmap` --- ### 📝 Commits (10+) - [`d637178`](https://github.com/microsoft/terminal/commit/d637178cc0a511eea8ea626c00aa5c066910f5ee) bring bitmap and supporting rectangle mods over, implement more bitmap tests. - [`70567d4`](https://github.com/microsoft/terminal/commit/70567d46f722b6c8e94e00c37e3d7588c35f0965) Make bitmap tests. Add supplemental helpers to rectangle and some, also add associated tests. - [`69b44ae`](https://github.com/microsoft/terminal/commit/69b44ae7472fc2b4fb9dd2737d1890a4e803a7b5) Add tests for setting/resetting points/rectangles out of bounds. Add support method for checking if rectangle contains another, add test for that too. - [`fca07fa`](https://github.com/microsoft/terminal/commit/fca07facaa739df3fee37b72f03786ec8564d22d) code format pass. - [`79d1f33`](https://github.com/microsoft/terminal/commit/79d1f332c78e9c9406ccfc8e6c0597e7bf53f286) Don't include stuff at the top of bitmap. Don't use reserved naming for iterator. Fix unsigned issues for x86. - [`81af5aa`](https://github.com/microsoft/terminal/commit/81af5aaf2a0d0fed20766cb61dcb5e70dfff5dd6) Fix comment - [`09139c4`](https://github.com/microsoft/terminal/commit/09139c449eaf703ddebe8218f95ee2933a78db67) SA fixes. - [`de20c5a`](https://github.com/microsoft/terminal/commit/de20c5ab6bdc9ea3fba6922ff1c19feefaee421b) make bitmap track a rectangle inside. remove empty and add bitset methods of all/any/none. also add convenience one() method in prediction of what conpty will be looking for. - [`a86b8fa`](https://github.com/microsoft/terminal/commit/a86b8fa6dd1599f38ce027550a9fc4a1f621ff43) Some frees members, some comments about the rectangle iterator and move it to details namespace. - [`c4df795`](https://github.com/microsoft/terminal/commit/c4df795a1972c8bc2dda4bc5f2d700f540a7ccb2) Make resize work and add tests. Add constructors that let you allocate a bitmap already filled. Generalize the bit checking method in the tests. ### 📊 Changes **9 files changed** (+1141 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `src/inc/til.h` (+1 -0) ➕ `src/inc/til/bitmap.h` (+267 -0) 📝 `src/inc/til/rectangle.h` (+154 -0) 📝 `src/inc/til/some.h` (+18 -0) ➕ `src/til/ut_til/BitmapTests.cpp` (+445 -0) 📝 `src/til/ut_til/RectangleTests.cpp` (+220 -0) 📝 `src/til/ut_til/SomeTests.cpp` (+34 -0) 📝 `src/til/ut_til/til.unit.tests.vcxproj` (+1 -0) 📝 `src/til/ut_til/til.unit.tests.vcxproj.filters` (+1 -0) </details> ### 📄 Description ## Summary of the Pull Request Introduces type `til::bitmap` which implements an NxM grid of bits that can be used to track dirty/clean state on a per-cell basis throughout a rectangle. ## PR Checklist * [x] In support of Differential Rendering #778 * [X] I work here. * [x] Tests added/passed * [x] I'm a core contributor. ## Detailed Description of the Pull Request / Additional comments - Adds `const_iterator` to `til::rectangle` that will walk from top to bottom, left to right every position in the rectangle as a `til::point` and associated test. - Adds `bool til::rectangle::contains(til::point)` to determine if a point lies within the rectangle and the associated test - Adds complementary methods to `til::rectangle` of `index_of(til::point)` and `point_at(ptrdiff_t)` which will convert between a valid `point` position that lies inside the `rectangle` and the index as a count of cells from the top left corner (origin) in a top to bottom & left to right counting fashion (and associated tests). - Adds `til::some<T, N>::clear()` to empty out the contents of the `some` and associated test. THEN with all that support... - Adds `til::bitmap` which represents a 2 dimensional grid of boolean/bit flags. This class contains set and reset methods for the entire region, and set only for a single `til::point` or a subregion as specified by a `til::rectangle` (and associated tests.) - Adds convenience methods of `any()`, `one()`, `none()`, and `all()` to the `til::bitmap` to check some of its state. - Adds convenience method of `resize()` to `til::bitmap` that will grow or shrink the bitmap, copying whatever is left of the previous one that still fits and optionally filling or blanking the new space. - Adds a `const_iterator` for `til::bitmap` that will walk top to bottom, left to right and return a `til::rectangle` representing a run of bits that are all on sequentially in a row. Breaks per row. Exactly as we expect to be drawing things (and associated tests.) ## Validation Steps Performed - See automated tests of functionality. --- <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:13:40 +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#26060