This repository was archived by the owner on Mar 7, 2025. It is now read-only.
Fixed issues that prevented visibly drawing many WMF files#135
Merged
akoeplinger merged 2 commits intomono:masterfrom Nov 24, 2017
Merged
Fixed issues that prevented visibly drawing many WMF files#135akoeplinger merged 2 commits intomono:masterfrom
akoeplinger merged 2 commits intomono:masterfrom
Conversation
* Added a new drawing instruction / record (METAFILE_RECORD_DIBSTRETCHBLT) which is substantially the same as METAFILE_RECORD_STRETCHDIBITS * Corrected parsing of certain values so that they're treated as signed instead of unsigned, including adding a GETS macro to complement the existing GETW but returning a SHORT instead of a WORD * Fixed scaling for drawing to a specified size and improved translation at the same time * Corrected handling of the DIB BitmapInfoHandler ImageSize field -- it now calculates the value when compression is not used (Compression field = 0 / RGB)
Member
Author
|
@hughbe not sure if you played with the WMF code before but if you did I'd appreciate a review from you :) |
hughbe
approved these changes
Nov 23, 2017
src/metafile.c
Outdated
| // Per the spec, if compression is RGB ImageSize must be ignored (and it should be zero anyway) | ||
| // and calculated according to the following formula. | ||
| ms.size = (((lpBitsInfo->bmiHeader.biWidth * lpBitsInfo->bmiHeader.biPlanes * | ||
| lpBitsInfo->bmiHeader.biBitCount + 31) & ~31) / 8) * abs(lpBitsInfo->bmiHeader.biHeight); |
Contributor
There was a problem hiding this comment.
the thing that is being multiplied by abs(lpBits...) needs to be floored according to https://en.m.wikipedia.org/wiki/BMP_file_format#Pixel_Storage
hughbe
reviewed
Nov 23, 2017
src/metafile.c
Outdated
| #endif | ||
| ms.ptr = (BYTE*)lpBitsInfo; | ||
| ms.size = lpBitsInfo->bmiHeader.biSizeImage; | ||
| if (lpBitsInfo->bmiHeader.biCompression == 0) { // 0 == RGB |
See formula in https://en.wikipedia.org/wiki/BMP_file_format#Pixel_Storage. Also use BI_RGB macro instead of hardcoding 0.
Member
Author
|
@hughbe fixed, thanks! |
Contributor
|
Looks great thanks! I don’t understand the rest of the #28 changes that aren’t related to metafiles |
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Note: these are the extracted WMF changes from #28 + cleanup, let's see what CI says 😄