#include "GraphicsParams.h"
#include "insets/insetgraphicsParams.h"
#include "lyxrc.h"
+#include "support/filetools.h"
#include "support/lstrings.h"
+#include "support/LAssert.h"
namespace grfx {
-GParams::GParams(InsetGraphicsParams const & iparams)
- : filename(iparams.filename),
- width(0),
+GParams::GParams(InsetGraphicsParams const & iparams, string const & filepath)
+ : width(0),
height(0),
scale(0),
angle(0)
{
+ filename = iparams.filename;
+ if (!filepath.empty()) {
+ filename = MakeAbsPath(filename, filepath);
+ }
+
if (iparams.clip)
bb = iparams.bb;
-
+
if (iparams.rotate)
angle = int(iparams.rotateAngle);
// inPixels returns a value scaled by lyxrc.zoom.
// We want, therefore, to undo this.
double const scaling_factor = 100.0 / double(lyxrc.zoom);
- width = int(scaling_factor * width);
- height = int(scaling_factor * height);
+ width = uint(scaling_factor * width);
+ height = uint(scaling_factor * height);
}
}
return;
LyXLength const length_yb(tmp1);
-
+
tmp2 = split(tmp2, tmp1, ' ');
if (!isValidLength(tmp1) || !isValidLength(tmp2))
return;
// want the bounding box in Postscript pixels.
// Note further that there are 72 Postscript pixels per inch.
double const scaling_factor = 7200.0 / (lyxrc.dpi * lyxrc.zoom);
- xl = int(scaling_factor * length_xl.inPixels(1, 1));
- yb = int(scaling_factor * length_yb.inPixels(1, 1));
- xr = int(scaling_factor * length_xr.inPixels(1, 1));
- yt = int(scaling_factor * length_yt.inPixels(1, 1));
+ xl = uint(scaling_factor * length_xl.inPixels(1, 1));
+ yb = uint(scaling_factor * length_yb.inPixels(1, 1));
+ xr = uint(scaling_factor * length_xr.inPixels(1, 1));
+ yt = uint(scaling_factor * length_yt.inPixels(1, 1));
if (xr <= xl || yt <= yb) {
xl = 0;
}
-bool BoundingBox::empty() const
+bool BoundingBox::empty() const
{
return (!xl && !yb && !xr && !yt);
}