mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-22 21:21:32 +00:00
More signed/unsigned stuff.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@3604 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
04196c1a6c
commit
01df791351
@ -1,5 +1,7 @@
|
||||
2002-02-28 Angus Leeming <a.leeming@ic.ac.uk>
|
||||
|
||||
* GraphicsParams.[Ch]:
|
||||
* GraphicsImage.C:
|
||||
* GraphicsImageXPM.C: properly resolve more warnings about comparison
|
||||
between signed and unsigned integer expressions.
|
||||
|
||||
|
@ -33,11 +33,12 @@ GImage::getScaledDimensions(GParams const & params) const
|
||||
// No scaling
|
||||
return std::make_pair(getWidth(), getHeight());
|
||||
|
||||
unsigned int width = 0;
|
||||
unsigned int height = 0;
|
||||
typedef unsigned int dimension;
|
||||
dimension width = 0;
|
||||
dimension height = 0;
|
||||
if (params.scale != 0) {
|
||||
width = getWidth() * params.scale / 100.0;
|
||||
height = getHeight() * params.scale / 100.0;
|
||||
width = dimension(getWidth() * params.scale / 100.0);
|
||||
height = dimension(getHeight() * params.scale / 100.0);
|
||||
} else {
|
||||
width = params.width;
|
||||
height = params.height;
|
||||
|
@ -73,8 +73,8 @@ GParams::GParams(InsetGraphicsParams const & iparams)
|
||||
// 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);
|
||||
}
|
||||
}
|
||||
|
||||
@ -133,10 +133,10 @@ BoundingBox::BoundingBox(string const & bb)
|
||||
// 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;
|
||||
|
@ -37,60 +37,48 @@ struct BoundingBox {
|
||||
|
||||
/// 0 0 0 0 is empty!
|
||||
bool empty() const;
|
||||
///
|
||||
int xl;
|
||||
int yb;
|
||||
int xr;
|
||||
int yt;
|
||||
|
||||
unsigned int xl;
|
||||
unsigned int yb;
|
||||
unsigned int xr;
|
||||
unsigned int yt;
|
||||
};
|
||||
|
||||
///
|
||||
bool operator==(BoundingBox const &, BoundingBox const &);
|
||||
///
|
||||
bool operator!=(BoundingBox const &, BoundingBox const &);
|
||||
|
||||
struct GParams
|
||||
{
|
||||
///
|
||||
GParams(InsetGraphicsParams const &);
|
||||
|
||||
/// How is the image to be displayed on the LyX screen?
|
||||
enum DisplayType {
|
||||
///
|
||||
COLOR,
|
||||
///
|
||||
GRAYSCALE,
|
||||
///
|
||||
MONOCHROME,
|
||||
/// We aren't going to display it at all!
|
||||
NONE
|
||||
};
|
||||
|
||||
///
|
||||
DisplayType display;
|
||||
|
||||
/// The image filename.
|
||||
string filename;
|
||||
|
||||
///
|
||||
BoundingBox bb;
|
||||
|
||||
/** The size of the view inside lyx in pixels or the scaling of the
|
||||
* image.
|
||||
*/
|
||||
unsigned int width;
|
||||
///
|
||||
unsigned int height;
|
||||
///
|
||||
unsigned int scale;
|
||||
|
||||
/// Rotation angle.
|
||||
int angle;
|
||||
};
|
||||
|
||||
///
|
||||
bool operator==(GParams const &, GParams const &);
|
||||
///
|
||||
bool operator!=(GParams const &, GParams const &);
|
||||
|
||||
} // namespace grfx
|
||||
|
Loading…
Reference in New Issue
Block a user