Skip to content

Commit

Permalink
Silence Windows compiler warnings #19
Browse files Browse the repository at this point in the history
  • Loading branch information
lovell committed Apr 21, 2015
1 parent fb1c9cf commit d1fc059
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
5 changes: 5 additions & 0 deletions binding.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,11 @@
'-O3'
],
'MACOSX_DEPLOYMENT_TARGET': '10.7'
},
'msvs_settings': {
'VCCLCompilerTool': {
'ExceptionHandling': 1 # /EHsc
}
}
}]
}
16 changes: 8 additions & 8 deletions src/resize.cc
Original file line number Diff line number Diff line change
Expand Up @@ -283,19 +283,19 @@ class ResizeWorker : public NanAsyncWorker {
break;
case Canvas::MAX:
if (xfactor > yfactor) {
baton->height = round(static_cast<double>(inputHeight) / xfactor);
baton->height = static_cast<int>(round(static_cast<double>(inputHeight) / xfactor));
yfactor = xfactor;
} else {
baton->width = round(static_cast<double>(inputWidth) / yfactor);
baton->width = static_cast<int>(round(static_cast<double>(inputWidth) / yfactor));
xfactor = yfactor;
}
break;
case Canvas::MIN:
if (xfactor < yfactor) {
baton->height = round(static_cast<double>(inputHeight) / xfactor);
baton->height = static_cast<int>(round(static_cast<double>(inputHeight) / xfactor));
yfactor = xfactor;
} else {
baton->width = round(static_cast<double>(inputWidth) / yfactor);
baton->width = static_cast<int>(round(static_cast<double>(inputWidth) / yfactor));
xfactor = yfactor;
}
break;
Expand All @@ -311,7 +311,7 @@ class ResizeWorker : public NanAsyncWorker {
} else {
// Auto height
yfactor = xfactor;
baton->height = floor(static_cast<double>(inputHeight) / yfactor);
baton->height = static_cast<int>(floor(static_cast<double>(inputHeight) / yfactor));
}
} else if (baton->height > 0) {
// Fixed height
Expand All @@ -321,7 +321,7 @@ class ResizeWorker : public NanAsyncWorker {
} else {
// Auto width
xfactor = yfactor;
baton->width = floor(static_cast<double>(inputWidth) / xfactor);
baton->width = static_cast<int>(floor(static_cast<double>(inputWidth) / xfactor));
}
} else {
// Identity transform
Expand Down Expand Up @@ -1086,9 +1086,9 @@ class ResizeWorker : public NanAsyncWorker {
int shrink = 1;
if (factor >= 2 && interpolatorWindowSize > 3) {
// Shrink less, affine more with interpolators that use at least 4x4 pixel window, e.g. bicubic
shrink = floor(factor * 3.0 / interpolatorWindowSize);
shrink = static_cast<int>(floor(factor * 3.0 / interpolatorWindowSize));
} else {
shrink = floor(factor);
shrink = static_cast<int>(floor(factor));
}
if (shrink < 1) {
shrink = 1;
Expand Down

0 comments on commit d1fc059

Please sign in to comment.