summaryrefslogtreecommitdiffstats
path: root/o3d/core
diff options
context:
space:
mode:
authorgspencer@google.com <gspencer@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-23 17:49:13 +0000
committergspencer@google.com <gspencer@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-23 17:49:13 +0000
commit00c8fcf95d515638a5779a082cff1f4b7fa33631 (patch)
tree50a00107712ff20e21121aab23f04a38a2b90bec /o3d/core
parenta150c7377d8ed3d3bfacdd09f24c6916ea98c01d (diff)
downloadchromium_src-00c8fcf95d515638a5779a082cff1f4b7fa33631.zip
chromium_src-00c8fcf95d515638a5779a082cff1f4b7fa33631.tar.gz
chromium_src-00c8fcf95d515638a5779a082cff1f4b7fa33631.tar.bz2
This fixes some float/double warnings and converts everything to floats.
Review URL: http://codereview.chromium.org/155953 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@21407 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'o3d/core')
-rw-r--r--o3d/core/cross/bitmap.cc22
1 files changed, 11 insertions, 11 deletions
diff --git a/o3d/core/cross/bitmap.cc b/o3d/core/cross/bitmap.cc
index 6487fbd..ecf00d6 100644
--- a/o3d/core/cross/bitmap.cc
+++ b/o3d/core/cross/bitmap.cc
@@ -53,16 +53,16 @@ using file_util::CloseFile;
using file_util::GetFileSize;
namespace {
-static const double kEpsilon = 0.0001;
-static const double kPi = 3.14159265358979;
+static const float kEpsilon = 0.0001f;
+static const float kPi = 3.14159265358979f;
static const int kFilterSize = 3;
-// utility function, round double numbers into 0 to 255 integers.
-uint8 Safe8Round(double f) {
- f += 0.5;
- if (f < 0.0) {
+// utility function, round float numbers into 0 to 255 integers.
+uint8 Safe8Round(float f) {
+ f += 0.5f;
+ if (f < 0.0f) {
return 0;
- } else if (!(f < 255.0)) {
+ } else if (!(f < 255.0f)) {
return 255;
}
return static_cast<uint8>(f);
@@ -404,7 +404,7 @@ void Bitmap::LanczosResize1D(const uint8* src, int src_x, int src_y,
// the same.
for (int i = 0; i < abs(nwidth); ++i) {
// center is the corresponding coordinate of i in original img.
- float center = (i + 0.5) * scale;
+ float center = (i + 0.5f) * scale;
// boundary of weight array in original img.
int xmin = static_cast<int>(floor(center - support));
if (xmin < 0) xmin = 0;
@@ -415,14 +415,14 @@ void Bitmap::LanczosResize1D(const uint8* src, int src_x, int src_y,
float wsum = 0.0;
for (int ox = xmin; ox <= xmax; ++ox) {
float wtemp;
- float dx = ox + 0.5 - center;
+ float dx = ox + 0.5f - center;
// lanczos filter
if (dx <= -kFilterSize || dx >= kFilterSize) {
wtemp = 0.0;
} else if (dx == 0.0) {
- wtemp = 1.0;
+ wtemp = 1.0f;
} else {
- wtemp = kFilterSize * sin(kPi * dx) * sin(kPi / kFilterSize * dx) /
+ wtemp = kFilterSize * sinf(kPi * dx) * sinf(kPi / kFilterSize * dx) /
(kPi * kPi * dx * dx);
}