diff options
| author | MenTaLguY <mental@rydia.net> | 2007-03-10 20:54:38 +0000 |
|---|---|---|
| committer | mental <mental@users.sourceforge.net> | 2007-03-10 20:54:38 +0000 |
| commit | a99764de718f7331615d3f9449e10a56dee62fb6 (patch) | |
| tree | d60bc8389777a4384b8c931867a93c6491fffee5 /src/extension/internal/odf.cpp | |
| parent | fix setting knot->pos for node handles, but remove coords updating - now done... (diff) | |
| download | inkscape-a99764de718f7331615d3f9449e10a56dee62fb6.tar.gz inkscape-a99764de718f7331615d3f9449e10a56dee62fb6.zip | |
Merge further bbox work
(bzr r2596)
Diffstat (limited to 'src/extension/internal/odf.cpp')
| -rw-r--r-- | src/extension/internal/odf.cpp | 30 |
1 files changed, 18 insertions, 12 deletions
diff --git a/src/extension/internal/odf.cpp b/src/extension/internal/odf.cpp index 48e217bd8..8645205f2 100644 --- a/src/extension/internal/odf.cpp +++ b/src/extension/internal/odf.cpp @@ -958,14 +958,16 @@ static NR::Matrix getODFTransform(const SPItem *item) * Get the bounding box of an item, as mapped onto * an ODF document, in cm. */ -static NR::Rect getODFBoundingBox(const SPItem *item) +static NR::Maybe<NR::Rect> getODFBoundingBox(const SPItem *item) { - NR::Rect bbox = sp_item_bbox_desktop((SPItem *)item); - double doc_height = sp_document_height(SP_ACTIVE_DOCUMENT); - NR::Matrix doc2dt_tf = NR::Matrix(NR::scale(1.0, -1.0)); - doc2dt_tf = doc2dt_tf * NR::Matrix(NR::translate(0, doc_height)); - bbox = bbox * doc2dt_tf; - bbox = bbox * NR::Matrix(NR::scale(pxToCm)); + NR::Maybe<NR::Rect> bbox = sp_item_bbox_desktop((SPItem *)item); + if (bbox) { + double doc_height = sp_document_height(SP_ACTIVE_DOCUMENT); + NR::Matrix doc2dt_tf = NR::Matrix(NR::scale(1.0, -1.0)); + doc2dt_tf = doc2dt_tf * NR::Matrix(NR::translate(0, doc_height)); + bbox = *bbox * doc2dt_tf; + bbox = *bbox * NR::Matrix(NR::scale(pxToCm)); + } return bbox; } @@ -1866,11 +1868,15 @@ bool OdfOutput::writeTree(Writer &couts, Writer &souts, NR::Matrix tf = getODFTransform(item); //### Get ODF bounding box params for item - NR::Rect bbox = getODFBoundingBox(item); - double bbox_x = bbox.min()[NR::X]; - double bbox_y = bbox.min()[NR::Y]; - double bbox_width = bbox.max()[NR::X] - bbox.min()[NR::X]; - double bbox_height = bbox.max()[NR::Y] - bbox.min()[NR::Y]; + NR::Maybe<NR::Rect> bbox = getODFBoundingBox(item); + if (!bbox) { + return true; + } + + double bbox_x = bbox->min()[NR::X]; + double bbox_y = bbox->min()[NR::Y]; + double bbox_width = bbox->extent(NR::X); + double bbox_height = bbox->extent(NR::Y); double rotate; double xskew; |
