Apache OpenOffice (AOO) Bugzilla – Issue 48495
Exporting to pdf presentation with png image, will crash application
Last modified: 2005-07-20 13:34:31 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.
Created attachment 25672 [details] The presentation that make the error.
confirm crash with m95
Reproducible on linux, followed by a crash. Reassigned. Please have a look.
accepted
sj: this issue has been fixed in cws[sj19]
changed target from OOo 2.01 to OOo 2.0
sj->cgu: this issue is ready to be verified in cws[sj21] re-open issue and reassign to cgu@openoffice.org
reassign to cgu@openoffice.org
reset resolution to FIXED
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
reassign to sj@openoffice.org
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
reassign to thb@openoffice.org
reopened
@aw: please have a look at this one, too. At least the shadow creation could be adapted by you, couldn't it?
@aw: please take over, should be fixed within svdograf.cxx for 2.0...
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...
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.
AW: Okay, tested using unxlngi6.pro and added to CWS impress63.
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
Verified in cws impress63
Integrated in src680m118.