From 0d61bb01ab3fc48819b89a1045625e6b0b05a416 Mon Sep 17 00:00:00 2001 From: Vassilii Khachaturov Date: Thu, 12 Dec 2013 17:28:59 +0200 Subject: [PATCH] 7288/7290: refactor fix from matthiasbasler Cluster DPI-aware code together More precise comment --- src/plugins/docgen/ODFDoc.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/plugins/docgen/ODFDoc.py b/src/plugins/docgen/ODFDoc.py index ca960ef8a..133d84461 100644 --- a/src/plugins/docgen/ODFDoc.py +++ b/src/plugins/docgen/ODFDoc.py @@ -1025,10 +1025,6 @@ class ODFDoc(BaseDoc, TextDoc, DrawDoc): pos = pos.title() if pos in ['left', 'right', 'single'] else 'Row' if crop: - dpi = ImgManip.image_dpi(file_name) - if not dpi: - dpi = (96.0,96.0) #LibOO 3.6 assumes this if image contains no DPI info - # Gramps cropping coordinates are [0, 100], so we need to convert to pixels # No rounding here, would lead to unwanted effects. start_x = crop[0]/100.0*x @@ -1042,7 +1038,11 @@ class ODFDoc(BaseDoc, TextDoc, DrawDoc): x_cm, y_cm, int(end_x-start_x), int(end_y-start_y) ) - # ODF wants crop measurements in inch. + dpi = ImgManip.image_dpi(file_name) + if not dpi: + dpi = (96.0,96.0) #LibOO 3.6 assumes this if image contains no DPI info + + # ODF wants crop measurements in inch and as margins from each side left = start_x/dpi[0] right = (x - end_x)/dpi[0] top = start_y/dpi[1]