-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Optimize PDF path algorithm by using RLE #650
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
|
Important Review skippedReview was skipped due to path filters ⛔ Files ignored due to path filters (1)
CodeRabbit blocks several paths by default. You can override this behavior by explicitly including those paths in the path filters. For example, including You can disable this status message by setting the 📝 WalkthroughWalkthroughRefactors PDF path generation in QRCoder/PdfByteQRCode.cs to replace per-module 1x1 rectangle emission with run-length encoding per row, batching contiguous dark modules into single rectangle commands via a while-based scan. No public API changes. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor Caller
participant PdfByteQRCode
participant CreatePathFromModules as CreatePathFromModules()
Caller->>PdfByteQRCode: Request PDF path for QR matrix
PdfByteQRCode->>CreatePathFromModules: Build path from module matrix
loop for each row y
CreatePathFromModules->>CreatePathFromModules: Advance x while modules are light
alt dark run found
CreatePathFromModules->>CreatePathFromModules: Record startX and runLength
CreatePathFromModules-->>PdfByteQRCode: Emit "startX y runLength 1 re"
else no dark modules
CreatePathFromModules-->>PdfByteQRCode: Continue to next row
end
end
PdfByteQRCode-->>Caller: Return consolidated PDF path
note over CreatePathFromModules: Replaced per-module rectangles with RLE per-row
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Pre-merge checks and finishing touches✅ Passed checks (3 passed)
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 |
Cuts file size in half or so.
Summary by CodeRabbit
New Features
Refactor
Documentation