Skip to content

Fix the color of marks - #16106

Merged
Dustin L. Howett (DHowett) merged 4 commits into
mainfrom
dev/migrie/b/wrong-marks-colors
Oct 17, 2023
Merged

Dustin L. Howett (DHowett) merged 4 commits into
mainfrom
dev/migrie/b/wrong-marks-colors

Conversation

@zadjii-msft

Copy link
Copy Markdown
Member

Guess what doesn't have the same layout as a bitmap? A til::color.

Noticed in 1.19.

Regressed in #16006

Guess what _doesn't_ have the same layout as a bitmap? A `til::color`.

Noticed in 1.19.
// a til::color does NOT have the same RGBA format as the bitmap.
#pragma warning(suppress : 26490) // Don't use reinterpret_cast (type.1).
std::fill_n(reinterpret_cast<til::color*>(beg), pipWidth, color);
const DWORD c = 0xff << 24 | GetRValue(color) << 16 | GetGValue(color) << 8 | GetBValue(color);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if you're going to shuffle the bits around manually, why change it to COLORREF at all? Just use til::color::r, til::color::g, etc.

@lhecker Leonard Hecker (lhecker) Oct 5, 2023 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for the testing-fuckup. I concur with Dustin.

Additionally, the beg pointer is already a uint8_t* so we can just:

*beg++ = color.r;
*beg++ = color.g;
*beg++ = color.b;
*beg++ = color.a;

(Or the other way around?)

Edit: But the DWORD code has the benefit that it can use std::fill_n so that's probably better.

@microsoft-github-policy-service microsoft-github-policy-service Bot added the Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something label Oct 5, 2023
@microsoft-github-policy-service microsoft-github-policy-service Bot removed the Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something label Oct 12, 2023
{
const auto row = m.Start.Y;
const til::color color{ m.Color.Color };
const COLORREF color{ til::color{ m.Color.Color } };

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are still converting it to a COLORREF just to convert it back in the call to drawPip. Is that intentional?

@microsoft-github-policy-service microsoft-github-policy-service Bot added the Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something label Oct 12, 2023
@microsoft-github-policy-service microsoft-github-policy-service Bot removed the Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something label Oct 13, 2023
@DHowett
Dustin L. Howett (DHowett) deleted the dev/migrie/b/wrong-marks-colors branch October 17, 2023 19:11
Dustin L. Howett (DHowett) pushed a commit that referenced this pull request Oct 26, 2023
Guess what _doesn't_ have the same layout as a bitmap? A `til::color`.

Noticed in 1.19.

Regressed in #16006

(cherry picked from commit 1745857)
Service-Card-Id: 90758500
Service-Version: 1.19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

No open projects

Development

Successfully merging this pull request may close these issues.

3 participants