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

BMP write bug fix #2101 #2289

Merged
merged 2 commits into from
Mar 18, 2022
Merged

Conversation

KartikShrivastava
Copy link
Contributor

Hi, this is the fix which updates the bmp header present in image_save_bmp(...) method of image_formats.cpp from 40 byte BITMAPINFOHEADER to 108 byte BITMAPV4HEADER to support transparency.

Reference used for fix: BMP_Wiki.

Copy link
Member

@JoshDreamland JoshDreamland left a comment

Choose a reason for hiding this comment

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

Thanks for the fix! I have a small nit to pick, but otherwise, I think this is correct. I am not sure if our CI exercises this routine, though.

fwrite_wrapper("\x20\0", 2, 1, bmp);
// x03 indicates compression method as BI_BITFIELDS
fwrite_wrapper("\x03\0\0\0", 4, 1, bmp);
fwrite_wrapper("\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0", 20, 1, bmp);
Copy link
Member

Choose a reason for hiding this comment

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

nit: can you use constexpr char k48Zeros[48] = {}; for these buffers, instead of the arbitrarily-long string literals?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure, will update that.

@KartikShrivastava
Copy link
Contributor Author

I've made the changes.

@codecov
Copy link

codecov bot commented Mar 17, 2022

Codecov Report

Merging #2289 (15d6900) into master (65f91e2) will increase coverage by 0.02%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2289      +/-   ##
==========================================
+ Coverage   35.25%   35.27%   +0.02%     
==========================================
  Files         213      213              
  Lines       20460    20474      +14     
==========================================
+ Hits         7213     7223      +10     
- Misses      13247    13251       +4     
Impacted Files Coverage Δ
...GMAsystem/SHELL/Universal_System/image_formats.cpp 74.81% <100.00%> (-0.19%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5c99b2e...15d6900. Read the comment docs.

@fundies fundies self-requested a review March 18, 2022 07:49
@fundies fundies merged commit 6aa9187 into enigma-dev:master Mar 18, 2022
@KartikShrivastava KartikShrivastava deleted the ka_sh/BMP_bug branch March 20, 2022 03:50
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.

None yet

3 participants