Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support null hdcSrc when using BLACKNESS rop #50

Merged
merged 1 commit into from
Sep 14, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions win32/src/winapi/gdi32/bitmap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,11 @@ pub fn BitBlt(
y1: i32,
rop: u32,
) -> bool {
if rop == BLACKNESS {
// It seems like passing null as `hdcSrc` when using BLACKNESS is supported on Windows.
Copy link
Owner

Choose a reason for hiding this comment

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

Looking at the docs, it's plausible to me that maybe all of the modes that don't involve one of the SRC* variants don't care about hdcsrc?

(You don't need to change this, just thinking out loud)

Copy link
Owner

Choose a reason for hiding this comment

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

...also, sorry for my terrible clunky bitmap code, I still don't have the right mental model about how it ought to work for me to write it better :(

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, it was a bit hard to follow the code, but I don't really know how to do it better 😅

First I started wrapping the source in an Option but it became very messy, not sure how to best do this 🤔

return PatBlt(machine, hdc, x, y, cx as i32, cy as i32, BLACKNESS);
}

let src_dc = machine.state.gdi32.dcs.get(hdcSrc).unwrap();
let src_bitmap = match src_dc.target {
DCTarget::Memory(bitmap) => {
Expand Down