Summary: | crash when saving .ps as .tif | ||
---|---|---|---|
Product: | [Applications] karbon | Reporter: | Thorsten Staerk <dev> |
Component: | general | Assignee: | Tim Beaulen <tbscope> |
Status: | VERIFIED FIXED | ||
Severity: | crash | ||
Priority: | NOR | ||
Version: | unspecified | ||
Target Milestone: | --- | ||
Platform: | Compiled Sources | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: | ||
Attachments: | the ps file I am trying to convert |
Description
Thorsten Staerk
2007-01-28 20:35:49 UTC
Created attachment 19459 [details]
the ps file I am trying to convert
SVN commit 628943 by jaham: * fix the png export by using the vcomputeboundingbox visitor to calculate the documents bounding box * do not consider deleted objects when computing the bounding box This fixes bug 140790 because when exporting to tiff the filter chain exports to png first and then uses a krita filter to convert to tiff. BUG:140790 M +6 -21 filters/karbon/png/pngexport.cc M +6 -0 karbon/visitors/vcomputeboundingbox.cc --- branches/koffice/1.6/koffice/filters/karbon/png/pngexport.cc #628942:628943 @@ -34,6 +34,7 @@ #include "vselection.h" #include "vkopainter.h" #include "vlayer.h" +#include "vcomputeboundingbox.h" #include <kdebug.h> @@ -67,20 +68,11 @@ VDocument doc; doc.load( docNode ); - VLayerListIterator layerItr( doc.layers() ); - VLayer *currentLayer; + // calculate the documents bounding box + VComputeBoundingBox bbox( true ); + doc.accept( bbox ); + const KoRect &rect = bbox.boundingRect(); - for( ; currentLayer = layerItr.current(); ++layerItr ) - { - if( currentLayer->state() == VObject::normal || currentLayer->state() == VObject::normal_locked || currentLayer->state() == VObject::selected ) - { - doc.selection()->append(currentLayer->objects()); - } - } - - // get the bounding box of all selected objects: - const KoRect& rect = doc.selection()->boundingBox(); - // create image with correct width and height QImage img( int( rect.width() ), int( rect.height() ), 32 ); //img.setAlphaBuffer( true ); @@ -89,16 +81,9 @@ VKoPainter p( img.bits(), rect.width(), rect.height() ); p.clear( qRgba( 0xFF, 0xFF, 0xFF, 0xFF ) ); p.setWorldMatrix( QWMatrix().translate( -rect.x(), -rect.y() ) ); - VObjectList objects = doc.selection()->objects(); - VObjectListIterator itr = objects; - // we dont need the selection anymore: - doc.selection()->clear(); + doc.draw( &p, &rect ); - // paint shapes over image - for ( ; itr.current(); ++itr ) - itr.current()->draw( &p, &rect ); - QImage image = img.swapRGB(); QImage mirrored = image.mirror( false, true ); // save png --- branches/koffice/1.6/koffice/karbon/visitors/vcomputeboundingbox.cc #628942:628943 @@ -38,6 +38,8 @@ for( ; itr.current(); ++itr ) { + if( itr.current()->state() == VObject::deleted ) + continue; // do not use hidden layers if( m_omitHidden && ! isVisible( itr.current() ) ) continue; @@ -52,6 +54,8 @@ for( ; itr.current(); ++itr ) { + if( itr.current()->state() == VObject::deleted ) + continue; // do not export hidden objects if( m_omitHidden && ! isVisible( itr.current() ) ) continue; @@ -66,6 +70,8 @@ for( ; itr.current(); ++itr ) { + if( itr.current()->state() == VObject::deleted ) + continue; // do not use hidden child objects if( m_omitHidden && ! isVisible( itr.current() ) ) continue; Cool reaction time, correct solution. |