Skip to content

Commit

Permalink
Corrected optimized calculation of texture coordinates
Browse files Browse the repository at this point in the history
Signed-off-by: Heikki Pora <heikki.pora@fusemail.com>
  • Loading branch information
heikkipora committed May 8, 2010
1 parent 797aef0 commit 572d8c2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions benchmark/index.html
Expand Up @@ -19,8 +19,8 @@
"(((Math.floor(_benchmarkVar) + 1024 * textureHeight) % textureHeight) * textureWidth + ((Math.floor(_benchmarkVar) + 1024 * textureWidth) % textureWidth )) << 2;",
"(((Math.floor(_benchmarkVar) + 1024 * 256) % textureHeight) * 256 + ((Math.floor(_benchmarkVar) + 1024 * 256) % textureWidth )) << 2;",
"(((Math.floor(_benchmarkVar) + 1024 * 256) % 256) * 256 + ((Math.floor(_benchmarkVar) + 1024 * 256) % 256 )) << 2;",
"(((Math.floor(_benchmarkVar) + 1024 << 8) % 256) << 8 + ((Math.floor(_benchmarkVar) + 1024 << 8 ) % 256 )) << 2;",
"(((Math.floor(_benchmarkVar) + 262144) & 0xff) << 8 + ((Math.floor(_benchmarkVar) + 262144) & 0xff )) << 2;"
"((((Math.floor(_benchmarkVar) + 1024 << 8) % 256) << 8) + ((Math.floor(_benchmarkVar) + 1024 << 8 ) % 256 )) << 2;",
"((((Math.floor(_benchmarkVar) + 262144) & 0xff) << 8) + ((Math.floor(_benchmarkVar) + 262144) & 0xff )) << 2;"
];

var benchmark = new Benchmark(200000);
Expand Down
2 changes: 1 addition & 1 deletion rotozoom/rotozoom.js
Expand Up @@ -72,7 +72,7 @@ var Rotozoom = {
var y = startY;
var w = width;
while (w--) {
pos = (((Math.floor(y) + 262144) & 0xff) << 8 + ((Math.floor(y) + 262144) & 0xff )) << 2;
pos = ((((Math.floor(y) + 262144) & 0xff) << 8) + ((Math.floor(x) + 262144) & 0xff )) << 2;
frame[i++] = texture[pos++];
frame[i++] = texture[pos++];
frame[i++] = texture[pos];
Expand Down

0 comments on commit 572d8c2

Please sign in to comment.