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

fix offset parsing #20

Merged
merged 1 commit into from
Dec 31, 2023
Merged
Show file tree
Hide file tree
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
4 changes: 4 additions & 0 deletions src/network.rs
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,10 @@ mod test {
"PX 0 0 ffffff\nPX 42 42 000000\n"
)] // The get pixel result is also offseted
#[case("OFFSET 0 0\nPX 0 42 abcdef\nPX 0 42\n", "PX 0 42 abcdef\n")]
#[case(
"OFFSET 10 10\nPX 0 0 ffffff\nOFFSET 0 0\nPX 0 0\nPX 10 10\n",
"PX 0 0 000000\nPX 10 10 ffffff\n"
)]
#[tokio::test]
async fn test_setting_pixel(
#[case] input: &str,
Expand Down
2 changes: 1 addition & 1 deletion src/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ pub async fn parse_pixelflut_commands(
continue;
}
}
} else if current_command & 0x0000_ffff_ffff_ffff == string_to_number(b"OFFSET \0\0") {
} else if current_command & 0x00ff_ffff_ffff_ffff == string_to_number(b"OFFSET \0\0") {
i += 7;

let (x, y, present) = parse_pixel_coordinates(buffer.as_ptr(), &mut i);
Expand Down
Loading