mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 19:57:35 +00:00
LibPDF: If softmask has different size than target bitmap, resize it
Size of smask and image aren't guaranteed to be equal by the spec (...except for /Matte, see page 555 of the PDF 1.7 spec, but we don't implement that), and in pratice they sometimes aren't. Fixes an assert on page 4 of https://devstreaming-cdn.apple.com/videos/wwdc/2017/821kjtggolzxsv/821/821_get_started_with_display_p3.pdf We now make it all the way to page 43 of 64 before crashing.
This commit is contained in:
parent
a4dec92ed0
commit
3c2d820391
1 changed files with 6 additions and 1 deletions
|
@ -892,7 +892,12 @@ PDFErrorOr<void> Renderer::show_image(NonnullRefPtr<StreamObject> image)
|
|||
auto image_bitmap = TRY(load_image(image));
|
||||
if (image_dict->contains(CommonNames::SMask)) {
|
||||
auto smask_bitmap = TRY(load_image(TRY(image_dict->get_stream(m_document, CommonNames::SMask))));
|
||||
VERIFY(smask_bitmap->rect() == image_bitmap->rect());
|
||||
|
||||
// Make softmask same size as image.
|
||||
// FIXME: The smask code here is fairly ad-hoc and incomplete.
|
||||
if (smask_bitmap->size() != image_bitmap->size())
|
||||
smask_bitmap = TRY(smask_bitmap->scaled_to_size(image_bitmap->size()));
|
||||
|
||||
for (int j = 0; j < image_bitmap->height(); ++j) {
|
||||
for (int i = 0; i < image_bitmap->width(); ++i) {
|
||||
auto image_color = image_bitmap->get_pixel(i, j);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue