Conversation
Guess what _doesn't_ have the same layout as a bitmap? A `til::color`. Noticed in 1.19.
DHowett
requested changes
Oct 5, 2023
| // 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); |
Member
There was a problem hiding this comment.
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.
Member
There was a problem hiding this comment.
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.
DHowett
requested changes
Oct 12, 2023
| { | ||
| const auto row = m.Start.Y; | ||
| const til::color color{ m.Color.Color }; | ||
| const COLORREF color{ til::color{ m.Color.Color } }; |
Member
There was a problem hiding this comment.
We are still converting it to a COLORREF just to convert it back in the call to drawPip. Is that intentional?
lhecker
approved these changes
Oct 16, 2023
DHowett
approved these changes
Oct 17, 2023
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Guess what doesn't have the same layout as a bitmap? A
til::color.Noticed in 1.19.
Regressed in #16006