Skip to content

ICO: Change select best entry logic#3045

Draft
mpospelova wants to merge 1 commit into
image-rs:mainfrom
mpospelova:ico-best-entry
Draft

ICO: Change select best entry logic#3045
mpospelova wants to merge 1 commit into
image-rs:mainfrom
mpospelova:ico-best-entry

Conversation

@mpospelova

Copy link
Copy Markdown
Contributor

As discussed in #3032, this PR updates the best entry selection logic to match the one from Chrome: first, compare the area, and then bpp. This PR also adds logic to fill in missing bpp values (use color_count to set bits_per_pixel = ceil(log2(color_count))).

@RunDevelopment RunDevelopment left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks for working on this!

LGTM; Just one minor thing. Then this is ready to go.

Comment thread src/codecs/ico/decoder.rs
Comment on lines 208 to 210
if spec == SpecCompliance::Strict && bits_per_pixel > 256 {
return Err(DecoderError::IcoEntryTooManyBitsPerPixelOrHotspot.into());
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Could you please move this back up to where bits_per_pixel is defined? This is a check for the raw data of the file, not on the value we infer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants