2

I'm trying to draw a small part of a huge offscreen canvas (a buffer) into my canvas but I have an issue on chrome (works great of Firefox and IE).

The drawImage method doesn't work unless I reduce the size of my buffer by ~ 10%. My buffer is 12000x7500px, and it doesn't work unless I reduce it to 10000x6000px.

Is it a bug or am I doing something wrong ?

I'm not providing a test case for now as it it not an easy one to create but I will if this issue isn't familiar to anyone here.

ctx.drawImage(game.bufferBackground,-eventManager.decalX,-eventManager.decalY,game.canvas.width, game.canvas.height, 0, 0, game.canvas.width, game.canvas.height);

ctx.canvas is 750px per 530px. game.bufferBackground is 12000px per 7500px

Thanks for your help !

JiDW
  • 51
  • 5

1 Answers1

-1

Just ran into an issue with using drawImage in Chrome myself--make sure you size the canvas in the tag, not with CSS. When I size with CSS, only part of the image is drawn, but when I size using HEIGHT/WIDTH in the actual tag, it renders fine.

Example:

<canvas height="400" width="400">

not

<canvas style="height:400;width:400;">