-
Notifications
You must be signed in to change notification settings - Fork 778
优化 APNG 支持 #4230
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
优化 APNG 支持 #4230
Conversation
This comment was marked as outdated.
This comment was marked as outdated.
Sorry, something went wrong.
...eCanvas.java Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
...eCanvas.java Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
...eCanvas.java Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
...eCanvas.java Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
...eAnimationImage.java Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
...eCanvas.java Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This comment was marked as outdated.
This comment was marked as outdated.
Sorry, something went wrong.
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.
Pull Request Overview
This PR refactors the APNG (Animated PNG) support system to optimize image handling for animated images. The changes replace the old interface-based animation system with a new class-based approach and introduce specialized BGRA pre-multiplied pixel handling for better animation performance.
Key changes:
- Converts
AnimationImagefrom interface to abstract class with built-in animation timeline management - Introduces new BGRA pre-multiplied pixel format classes for more efficient animation frame handling
- Replaces the old APNG processing logic in
ImageUtilswith a new director-based approach
Reviewed Changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
AnimationImage.java |
Converted from interface to abstract class with animation timeline management |
AnimationFrame.java |
New interface defining animation frame duration contract |
BgraPreCanvas.java |
New canvas class for BGRA pre-multiplied pixel operations |
BgraPreFrame.java |
New animation frame implementation extending BgraPreCanvas |
BgraPreAnimationImage.java |
New animation image implementation using BGRA pre-multiplied format |
AnimationImageImpl.java |
Refactored to extend new AnimationImage base class |
BgraPreBitmapDirector.java |
New director class for processing APNG files into BGRA format |
Argb8888Director.java |
Added exception handling to receiveFrameImage method |
ImageUtils.java |
Simplified APNG loading by replacing complex logic with director pattern |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Copilot
AI
Aug 14, 2025
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.
The argbToPre method lacks documentation explaining what 'pre' means and the purpose of the alpha premultiplication calculation.
Copilot
AI
Aug 14, 2025
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.
The toString() method override simply calls super.toString() without adding any value. This override should either provide meaningful information about the canvas state or be removed.
Copilot
AI
Aug 14, 2025
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.
Commented-out code should be removed. These TODO comments and dead code lines make the codebase harder to maintain.
Copilot
AI
Aug 14, 2025
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.
Debug print statement should be removed from production code.
Copilot
AI
Aug 14, 2025
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.
Commented-out code should be removed to keep the codebase clean.
Copilot
AI
Aug 14, 2025
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.
TODO comment indicates uncertainty about potential issues. This should be investigated and resolved or properly documented if the concern is valid.
Copilot
AI
Aug 14, 2025
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.
The scaling functionality is not implemented but the method can be called when doScale is true. This will cause runtime failures when users request scaled images.
目前还无法工作,待修复。