Created
November 3, 2011 22:44
-
-
Save sfoster/1338146 to your computer and use it in GitHub Desktop.
Steppe rgba buffer data micro-optimization
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/js/Steppe/Renderer.js b/js/Steppe/Renderer.js | |
index 77bf78b..22f16bc 100644 | |
--- a/js/Steppe/Renderer.js | |
+++ b/js/Steppe/Renderer.js | |
@@ -361,20 +361,15 @@ var Steppe = (function(Steppe) { | |
(top * (framebufferImageData.width << 2)) + | |
(ray << 2); | |
- | |
- var bufferR = (color >> 24) & 0xff, | |
- bufferG = (color >> 16) & 0xff, | |
- bufferB = (color >> 8) & 0xff, | |
- bufferA = 0xff; | |
for (var j = 0; j < bottom - top + 1; ++j) { | |
for (var i = 0; i < _quality; ++i) { | |
framebufferData[index] = | |
- bufferR; | |
+ (color >> 24) & 0xff; | |
framebufferData[index + 1] = | |
- bufferG; | |
+ (color >> 16) & 0xff; | |
framebufferData[index + 2] = | |
- bufferB; | |
- framebufferData[index + 3] = bufferA; | |
+ (color >> 8) & 0xff; | |
+ framebufferData[index + 3] = 0xff; | |
index += 4; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment