-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Simplify WriteScanlines #612
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
Conversation
📝 WalkthroughWalkthroughThe WriteScanlines method in QRCoder/PngByteQRCode.cs removes a .NET 3.5 conditional branch and always writes compressed IDAT data using idatStream.WriteTo(_stream), eliminating CopyTo usage and idatStream.Position resets. No public APIs were changed. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant W as WriteScanlines
participant D as DeflateStream
participant I as idatStream (MemoryStream)
participant S as _stream (output)
Note over W,I: Old flow (pre-change)
W->>D: Compress scanlines into IDAT
D-->>I: Write compressed bytes
W->>I: Reset Position = 0
alt NET35
W->>S: I.WriteTo(S)
else non-NET35
W->>S: I.CopyTo(S)
end
sequenceDiagram
autonumber
participant W as WriteScanlines
participant D as DeflateStream
participant I as idatStream (MemoryStream)
participant S as _stream (output)
rect rgba(220,240,255,0.5)
Note over W,I: New flow (post-change)
end
W->>D: Compress scanlines into IDAT
D-->>I: Write compressed bytes
Note over W,I: No Position reset
W->>S: I.WriteTo(S)
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
💤 Files with no reviewable changes (1)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
// Compressed data. | ||
idatStream.Position = 0; | ||
#if NET35 | ||
idatStream.WriteTo(_stream); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
WriteTo writes the entire MemoryStream (disregarding position) to the target stream, and is a supported method across all .NET variations.
Summary by CodeRabbit