diff options
author | Ehsan Akhgari <ehsan.akhgari@gmail.com> | 2013-02-19 12:11:20 -0500 |
---|---|---|
committer | Ehsan Akhgari <ehsan.akhgari@gmail.com> | 2013-02-19 12:11:20 -0500 |
commit | 1fc1c855ebd5b76c26f369f59e5876110e515e7e (patch) | |
tree | 1e19f9acc38d092197da17f9531268c833047b1f | |
parent | 044edf0a64be1880ad4f681909cd82475a3ab133 (diff) |
Use the copy composite operation when calling drawImage
This optimizes IMG_Load so that it just does a memcpy as opposed to try
to composite. The resulting buffer will be the same, it just happens
that we don't need to do all of the work involved in compositing in the
first place.
-rw-r--r-- | src/library_sdl.js | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/library_sdl.js b/src/library_sdl.js index 4ad7a9a9..66e9e901 100644 --- a/src/library_sdl.js +++ b/src/library_sdl.js @@ -1079,7 +1079,9 @@ var LibrarySDL = { } var surf = SDL.makeSurface(raw.width, raw.height, 0, false, 'load:' + filename); var surfData = SDL.surfaces[surf]; + surfData.ctx.globalCompositeOperation = "copy"; surfData.ctx.drawImage(raw, 0, 0, raw.width, raw.height, 0, 0, raw.width, raw.height); + surfData.ctx.globalCompositeOperation = "source-over"; // XXX SDL does not specify that loaded images must have available pixel data, in fact // there are cases where you just want to blit them, so you just need the hardware // accelerated version. However, code everywhere seems to assume that the pixels |