Issue 48495 - Exporting to pdf presentation with png image, will crash application
Summary: Exporting to pdf presentation with png image, will crash application
Status: CLOSED FIXED
Alias: None
Product: Impress
Classification: Application
Component: save-export (show other issues)
Version: OOo 2.0 Beta
Hardware: PC Linux, all
: P3 Trivial (vote)
Target Milestone: OOo 2.0
Assignee: christian.guenther
QA Contact: issues@graphics
URL:
Keywords: crash, oooqa
Depends on:
Blocks:
 
Reported: 2005-04-30 15:15 UTC by alt_os
Modified: 2005-07-20 13:34 UTC (History)
3 users (show)

See Also:
Issue Type: DEFECT
Latest Confirmation in: ---
Developer Difficulty: ---


Attachments
The presentation that make the error. (19.91 KB, application/vnd.oasis.opendocument.presentation)
2005-04-30 15:16 UTC, alt_os
no flags Details

Note You need to log in before you can comment on or make changes to this issue.
Description alt_os 2005-04-30 15:15:22 UTC
I made a png image from a svg file. I imported the png image in a OOo
presentation (odp), changed the background color of the image (to white, it was
trasparent) and then tryed to export it in pdf. 

The application says "Main memory shortage" even if there are more than 256 Mb
of memory available, and that the whole presentation file is a few kb big.
Comment 1 alt_os 2005-04-30 15:16:09 UTC
Created attachment 25672 [details]
The presentation that make the error.
Comment 2 flibby05 2005-04-30 17:33:57 UTC
confirm crash with m95
Comment 3 wolframgarten 2005-05-02 07:55:40 UTC
Reproducible on linux, followed by a crash.
Reassigned. Please have a look.
Comment 4 sven.jacobi 2005-05-19 16:49:17 UTC
accepted
Comment 5 sven.jacobi 2005-05-19 16:49:46 UTC
sj: this issue has been fixed in cws[sj19]
Comment 6 sven.jacobi 2005-06-27 15:57:19 UTC
changed target from OOo 2.01 to OOo 2.0
Comment 7 sven.jacobi 2005-06-28 17:04:14 UTC
sj->cgu: this issue is ready to be verified in cws[sj21]

re-open issue and reassign to cgu@openoffice.org
Comment 8 sven.jacobi 2005-06-28 17:04:20 UTC
reassign to cgu@openoffice.org
Comment 9 sven.jacobi 2005-06-28 17:04:27 UTC
reset resolution to FIXED
Comment 10 christian.guenther 2005-06-30 16:46:14 UTC
The bug still occures.
With linux it lasts now longer but at the end it still crash.
On Sols it crash immediately.
Please have a look again.

re-open issue and reassign to sj@openoffice.org
Comment 11 christian.guenther 2005-06-30 16:46:53 UTC
reassign to sj@openoffice.org
Comment 12 christian.guenther 2005-06-30 16:47:54 UTC
reset resolution to FIXED
Comment 13 sven.jacobi 2005-07-01 15:58:48 UTC
sj->thb: The reason for the crash I fixed first was the graphic in the bugdoc
with zero size.

But there are more pitfalls awaiting, if you are exporting the bugdoc, a lot of
memory is consumed so that the office might crash on some computers. Another
problem is the time it last to store the document, this is definitely too long.

I think is the shadow on the filled graphic leads to the first problem, in the
method SdrGraphObj::ImpDoGrafObjShadow following code is executed:

...
if(IsObjectTransparent())
{
  // object which casts the shadow is somehow transparent, create a transparent
  // shadow
  Rectangle aSnapRect(GetSnapRect());
  aSnapRect.Move(nXDist, nYDist);
  const Rectangle aSnapRectPixel(pOutDev->LogicToPixel(aSnapRect));

  // get BitmapEx
  Graphic aTempGraphic = GetTransformedGraphic();
  Size aPixelSize(aSnapRectPixel.GetSize());
  BitmapEx aTempBitmapEx = aTempGraphic.GetBitmapEx(&aPixelSize);
....

The result from LogicToPixel is definitive too big to be used for bitmaps if the
device is having such a high resolution as it is having in pdf devices.

The second problem seems to be a similar problem, when painting the fill bitmap
intersect clip region with a rectangle is executed, and in this case the region
is creating too many RegionBands.

I think this issue is in good hands now as I am on vacation next monday and this
issue has to be fixed for OOo2.0 

re-open issue and reassign to thb@openoffice.org
Comment 14 sven.jacobi 2005-07-01 15:58:53 UTC
reassign to thb@openoffice.org
Comment 15 sven.jacobi 2005-07-01 15:58:58 UTC
reset resolution to FIXED
Comment 16 sven.jacobi 2005-07-01 16:02:16 UTC
reopened
Comment 17 thb 2005-07-02 23:37:03 UTC
@aw: please have a look at this one, too. At least the shadow creation could be
adapted by you, couldn't it?
Comment 18 thb 2005-07-04 13:15:58 UTC
@aw: please take over, should be fixed within svdograf.cxx for 2.0...
Comment 19 Armin Le Grand 2005-07-04 16:22:40 UTC
AW: Doing some tests. Indeed, in ImpDoPaintGrafObjShadow, aPixelSize is big
(19799x19798 pixels). But DrawingLayer code in ImpDoPaintGrafObjShadow() only
takes some seconds and a 1-bit mask bitmap. This takes some memory (ca. 50 mb)
but does not stress the system. System is then stressed in pdffilter and
svtools, see stack on break:
>	vcl680mi.dll!BitmapReadAccess::GetPaletteColor(unsigned short nColor=0)  Line
469 + 0x5	C++
 	svt680mi.dll!0152bfee() 	
 	svt680mi.dll!0152c28f() 	
 	svt680mi.dll!01569d9b() 	
 	svt680mi.dll!0152c200() 	
 	svt680mi.dll!0152c261() 	
 	svt680mi.dll!0146c600() 	
 	pdffilter680mi.dll!0c5553ae() 	
AW: This also happens when i force the pixel size to (10,10) in
ImpDoPaintGrafObjShadow. Still, a lot of time is consumed afterwards in
pdffilter. Interestingly, the pdf file size is always ca. 80kb...
Comment 20 Armin Le Grand 2005-07-04 17:24:51 UTC
AW: Tried a simple fix, just cropping the output when a quadraticpixel size
value is reached (a fixed one for now). Code is:

				// #i48495#
				// When this is done on a very fine resolutin OutputDevice (e.g. PDF export)
it may lead
				// to problems since huge bitmaps may be created. Sizes need to be cropped
here. Later
				// it may be nice to have the quadratic pixel size configurable somewhere.
				const sal_uInt32 nMaxBitmapPixels(800L * 800L);
				const sal_uInt32 nAllPixels(aPixelSize.getWidth() * aPixelSize.getHeight());

				if(nAllPixels > nMaxBitmapPixels)
				{
					const double fScale(sqrt(nMaxBitmapPixels) / sqrt(nAllPixels));
					aPixelSize.setWidth(FRound(aPixelSize.getWidth() * fScale));
					aPixelSize.setHeight(FRound(aPixelSize.getHeight() * fScale));
				}

and needs to be put between 
				Size aPixelSize(aSnapRectPixel.GetSize());
and
				BitmapEx aTempBitmapEx = aTempGraphic.GetBitmapEx(&aPixelSize);
in SdrGrafObj::ImpDoPaintGrafObjShadow.
Comment 21 Armin Le Grand 2005-07-06 17:03:37 UTC
AW: Okay, tested using unxlngi6.pro and added to CWS impress63.
Comment 22 Armin Le Grand 2005-07-12 11:19:22 UTC
AW->CGU: Re-checked in CWS. To test, just open the bugdoc and export to pdf.

re-open issue and reassign to cgu@openoffice.org
Comment 23 Armin Le Grand 2005-07-12 11:19:27 UTC
reassign to cgu@openoffice.org
Comment 24 Armin Le Grand 2005-07-12 11:19:39 UTC
reset resolution to FIXED
Comment 25 christian.guenther 2005-07-12 16:24:48 UTC
Verified in cws impress63
Comment 26 christian.guenther 2005-07-20 13:34:31 UTC
Integrated in src680m118.