Browse Source

Merge pull request #518 from joefreeman/master

Fix for 'drawImage' scaling
v1.x
Juriy Zaytsev 10 years ago
parent
commit
e015514ec5
  1. 4
      Readme.md
  2. 2
      src/CanvasRenderingContext2d.cc
  3. 2
      test/public/tests.js

4
Readme.md

@ -286,6 +286,10 @@ If you have not previously, init git submodules:
$ git submodule update --init
Install the node modules:
$ npm install
Build node-canvas:
$ node-gyp rebuild

2
src/CanvasRenderingContext2d.cc

@ -739,6 +739,8 @@ NAN_METHOD(Context2d::DrawImage) {
cairo_scale(ctx, fx, fy);
dx /= fx;
dy /= fy;
dw /= fx;
dh /= fy;
}
if (context->hasShadow()) {

2
test/public/tests.js

@ -1656,7 +1656,7 @@ tests['drawImage(img,x,y,w,h) scale vertical'] = function(ctx, done){
tests['drawImage(img,sx,sy,sw,sh,x,y,w,h)'] = function(ctx, done){
var img = new Image;
img.onload = function(){
ctx.drawImage(img, 13, 13, 80, 80, 25, 25, img.width / 2, img.height / 2);
ctx.drawImage(img, 13, 13, 45, 45, 25, 25, img.width / 2, img.height / 2);
done();
};
img.onerror = function(){}

Loading…
Cancel
Save