From: Angus Leeming Date: Thu, 28 Feb 2002 11:50:42 +0000 (+0000) Subject: More signed/unsigned stuff. X-Git-Tag: 1.6.10~19792 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=01df7913511c31751d65186a60dd18a421f602b2;p=features.git More signed/unsigned stuff. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@3604 a592a061-630c-0410-9148-cb99ea01b6c8 --- diff --git a/src/graphics/ChangeLog b/src/graphics/ChangeLog index 3bccbec74a..cd1ca136a0 100644 --- a/src/graphics/ChangeLog +++ b/src/graphics/ChangeLog @@ -1,5 +1,7 @@ 2002-02-28 Angus Leeming + * GraphicsParams.[Ch]: + * GraphicsImage.C: * GraphicsImageXPM.C: properly resolve more warnings about comparison between signed and unsigned integer expressions. diff --git a/src/graphics/GraphicsImage.C b/src/graphics/GraphicsImage.C index 6e7c8300aa..97ee4ed3d2 100644 --- a/src/graphics/GraphicsImage.C +++ b/src/graphics/GraphicsImage.C @@ -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; diff --git a/src/graphics/GraphicsParams.C b/src/graphics/GraphicsParams.C index f289b305a1..9554e5eb71 100644 --- a/src/graphics/GraphicsParams.C +++ b/src/graphics/GraphicsParams.C @@ -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; diff --git a/src/graphics/GraphicsParams.h b/src/graphics/GraphicsParams.h index d8a02610d6..8f90d82d3e 100644 --- a/src/graphics/GraphicsParams.h +++ b/src/graphics/GraphicsParams.h @@ -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