Browse Source

Add explanation to remaining std::min calls

v1.x
Jesper Ek 9 years ago
parent
commit
ff23127e16
  1. 2
      src/CanvasRenderingContext2d.cc

2
src/CanvasRenderingContext2d.cc

@ -619,6 +619,8 @@ NAN_METHOD(Context2d::PutImageData) {
if (dx < 0) sw += dx, sx -= dx, dx = 0;
if (dy < 0) sh += dy, sy -= dy, dy = 0;
// clamp width at canvas size
// Need to wrap std::min calls using parens to prevent macro expansion on
// windows. See http://stackoverflow.com/questions/5004858/stdmin-gives-error
cols = (std::min)(sw, context->canvas()->width - dx);
rows = (std::min)(sh, context->canvas()->height - dy);
break;

Loading…
Cancel
Save