mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-22 10:00:33 +00:00
Fix crash but problem still remains.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@3953 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
615cc9ec4a
commit
82999ab588
@ -578,7 +578,7 @@ ButtonPolicy::SMInput FormGraphics::input(FL_OBJECT * ob, long)
|
||||
|
||||
// the bb section
|
||||
} else if (!controller().bbChanged &&
|
||||
(ob == bbox_->choice_bb_units ||
|
||||
(ob == bbox_->check_clip || ob == bbox_->choice_bb_units ||
|
||||
ob == bbox_->input_bb_x0 || ob == bbox_->input_bb_y0 ||
|
||||
ob == bbox_->input_bb_x1 || ob == bbox_->input_bb_y1)) {
|
||||
controller().bbChanged = true;
|
||||
|
@ -261,10 +261,10 @@ void xformsGImage::clip(GParams const & params)
|
||||
// Bounds are unchanged.
|
||||
return;
|
||||
|
||||
int const xoffset_l = params.bb.xl;
|
||||
int const xoffset_r = image_->w - params.bb.xr;
|
||||
int const yoffset_t = image_->h - params.bb.yt;
|
||||
int const yoffset_b = params.bb.yb;
|
||||
int const xoffset_l = std::max(0, params.bb.xl);
|
||||
int const xoffset_r = std::max(0, image_->w - params.bb.xr);
|
||||
int const yoffset_t = std::max(0, image_->h - params.bb.yt);
|
||||
int const yoffset_b = std::max(0, params.bb.yb);
|
||||
|
||||
flimage_crop(image_, xoffset_l, yoffset_t, xoffset_r, yoffset_b);
|
||||
}
|
||||
|
@ -36,20 +36,22 @@ GParams::GParams(InsetGraphicsParams const & iparams, string const & filepath)
|
||||
bb = iparams.bb;
|
||||
|
||||
// Get the original Bounding Box from the file
|
||||
string const bb_orig_str = readBB_from_PSFile(filename);
|
||||
if (!bb_orig_str.empty()) {
|
||||
BoundingBox bb_orig;
|
||||
bb_orig.xl = strToInt(token(bb_orig_str, ' ', 0));
|
||||
bb_orig.yb = strToInt(token(bb_orig_str, ' ', 1));
|
||||
bb_orig.xr = strToInt(token(bb_orig_str, ' ', 2));
|
||||
bb_orig.yt = strToInt(token(bb_orig_str, ' ', 3));
|
||||
string const tmp = readBB_from_PSFile(filename);
|
||||
if (!tmp.empty()) {
|
||||
int const bb_orig_xl = strToInt(token(tmp, ' ', 0));
|
||||
int const bb_orig_yb = strToInt(token(tmp, ' ', 1));
|
||||
|
||||
bb.xl -= bb_orig.xl;
|
||||
bb.xr -= bb_orig.xl;
|
||||
bb.yb -= bb_orig.yb;
|
||||
bb.yt -= bb_orig.yb;
|
||||
bb.xl -= bb_orig_xl;
|
||||
bb.xr -= bb_orig_xl;
|
||||
bb.yb -= bb_orig_yb;
|
||||
bb.yt -= bb_orig_yb;
|
||||
}
|
||||
|
||||
bb.xl = std::max(0, bb.xl);
|
||||
bb.xr = std::max(0, bb.xr);
|
||||
bb.yb = std::max(0, bb.yb);
|
||||
bb.yt = std::max(0, bb.yt);
|
||||
|
||||
// Paranoia check.
|
||||
int const width = bb.xr - bb.xl;
|
||||
int const height = bb.yt - bb.yb;
|
||||
|
Loading…
Reference in New Issue
Block a user