Bug 27208 - Problem with softmasks
Summary: Problem with softmasks
Status: RESOLVED FIXED
Alias: None
Product: poppler
Classification: Unclassified
Component: splash backend (show other bugs)
Version: unspecified
Hardware: All All
: medium normal
Assignee: poppler-bugs
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-03-20 08:55 UTC by Thomas Freitag
Modified: 2010-03-22 12:05 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments
This should solve the problem (1.14 KB, patch)
2010-03-20 09:00 UTC, Thomas Freitag
Details | Splinter Review
with interpreting alpha is shape (1.34 KB, patch)
2010-03-21 06:00 UTC, Thomas Freitag
Details | Splinter Review
RGB output (58.62 KB, image/jpeg)
2010-03-21 06:44 UTC, Thomas Freitag
Details
CMYK output (74.91 KB, image/jpeg)
2010-03-21 06:45 UTC, Thomas Freitag
Details
complete patch with changed inline skip (2.75 KB, text/plain)
2010-03-21 07:17 UTC, Thomas Freitag
Details
next try (800 bytes, patch)
2010-03-21 12:18 UTC, Thomas Freitag
Details | Splinter Review

Description Thomas Freitag 2010-03-20 08:55:40 UTC
If a softmask is smaller a then the page bitmap, everything outside the softmask will be removed
Comment 1 Thomas Freitag 2010-03-20 09:00:17 UTC
Created attachment 34261 [details] [review]
This should solve the problem

If the splash page bitmap is initialized with 255 instead of 0, and then the softmask bitmap is drawn on it, it works
Comment 2 Albert Astals Cid 2010-03-21 04:15:37 UTC
The patch causes regressions in lots of files, one of them is http://launchpadlibrarian.net/15866941/1und1_DSL_Flyer_partner.pdf
Comment 3 Thomas Freitag 2010-03-21 05:58:51 UTC
(In reply to comment #2)
> The patch causes regressions in lots of files, one of them is
> http://launchpadlibrarian.net/15866941/1und1_DSL_Flyer_partner.pdf
> 

Nice, that You give a German sample, it's easier to read for me than a Spanish one :-)
Seems as if the interesting switch wether to preset with 0 or 255 is AIS (alpha is shape). At least if I look at this parameter, this is one of the differents between Your pdf and my PDFs which causes the problem. So with a small change (but I need the gfx state, SplashOutputDev ignores that in the moment) it works at least with either my PDFs and the one You point to. I upload a new patch.

Best regards,
Thomas
Comment 4 Thomas Freitag 2010-03-21 06:00:07 UTC
Created attachment 34280 [details] [review]
with interpreting alpha is shape
Comment 5 Albert Astals Cid 2010-03-21 06:31:49 UTC
That second patch does not fix the pdf you sent in private
Comment 6 Thomas Freitag 2010-03-21 06:44:01 UTC
(In reply to comment #5)
> That second patch does not fix the pdf you sent in private
> 

Are You sure? I tested it with SPASH_CMYK and default (RGB), I attach my previews...

Here the only interesting code as snippet:

  unsigned char fill = (state->getAlphaIsShape()) ? 255 : 0;
  memset(softMask->getDataPtr(), fill,
	 softMask->getRowSize() * softMask->getHeight());

I attach the result bitmaps...
Comment 7 Thomas Freitag 2010-03-21 06:44:53 UTC
Created attachment 34281 [details]
RGB output
Comment 8 Thomas Freitag 2010-03-21 06:45:21 UTC
Created attachment 34282 [details]
CMYK output
Comment 9 Albert Astals Cid 2010-03-21 06:56:26 UTC
Yeah, i'm sure, i've added a printf state->getAlphaIsShape() and it is giving me 0 in your file
Which branch/release are you using as base of the patch?
Comment 10 Thomas Freitag 2010-03-21 07:08:57 UTC
(In reply to comment #9)
> Yeah, i'm sure, i've added a printf state->getAlphaIsShape() and it is giving
> me 0 in your file
> Which branch/release are you using as base of the patch?
> 

I checked it out with git clone on 17th of march, 13:57 CET, and compiled it with defines

WIN32;_DEBUG;_WINDOWS;SPLASH_CMYK;USE_FREETYPE2_STATIC;_CRT_SECURE_NO_WARNINGS;ENABLE_LIBPNG;WITH_FONTCONFIGURATION_WIN32;OPI_SUPPORT 

Confused,
Thomas
Comment 11 Thomas Freitag 2010-03-21 07:16:40 UTC
(In reply to comment #9)
> Yeah, i'm sure, i've added a printf state->getAlphaIsShape() and it is giving
> me 0 in your file
> Which branch/release are you using as base of the patch?
> 

Oh, I forgot: I made an additional change in Gfx.cc, because I had sometimes problems with inline images compresses as jpeg binary. So I add this change from my old version to the actual but hadn't tested it in general, therefore I omit it in my path, but to be sure (even if I don't believe that this cause the problem), I'll add a complete diff.

Thomas
Comment 12 Thomas Freitag 2010-03-21 07:17:35 UTC
Created attachment 34286 [details]
complete patch with changed inline skip
Comment 13 Thomas Freitag 2010-03-21 08:06:35 UTC
(In reply to comment #9)
> Yeah, i'm sure, i've added a printf state->getAlphaIsShape() and it is giving
> me 0 in your file
> Which branch/release are you using as base of the patch?
> 

Wait, it seems to be a compiler problem: 

printf("fill: %d because of AlphaIsShape: %d(%d)\n", fill, (int) state->getAlphaIsShape() == gTrue, state->getAlphaIsShape());

results in:

fill: 255 because of AlphaIsShape: 0(-842150451)

I have another look at it!

Thomas
Comment 14 Thomas Freitag 2010-03-21 12:17:09 UTC
(In reply to comment #3)
> (In reply to comment #2)
> > The patch causes regressions in lots of files, one of them is
> > http://launchpadlibrarian.net/15866941/1und1_DSL_Flyer_partner.pdf
> > 
> 
> Nice, that You give a German sample, it's easier to read for me than a Spanish
> one :-)
> Seems as if the interesting switch wether to preset with 0 or 255 is AIS (alpha
> is shape). At least if I look at this parameter, this is one of the differents
> between Your pdf and my PDFs which causes the problem. So with a small change
> (but I need the gfx state, SplashOutputDev ignores that in the moment) it works
> at least with either my PDFs and the one You point to. I upload a new patch.
> 
> Best regards,
> Thomas
> 

Forget the nonsense with AIS, I went completely in the wrong direction. The filling with a value other then 0 in some cases was a good idea, but to find the correct cases....
After debugging instead of looking into Your PDF directly I think I found the solution now: We have to initialize the grayscale softmask with the grascale value of the backdrop color, at least if blending ColorSpace is available (otherwise I default to zero).
Patch follows immediately.

Sorry again for the inconvenience,
Thomas 

Comment 15 Thomas Freitag 2010-03-21 12:18:35 UTC
Created attachment 34301 [details] [review]
next try
Comment 16 Albert Astals Cid 2010-03-22 12:05:58 UTC
I've commited the fix, thanks for the patch. If anyone ever needs the file mail me since i have it.


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.