浏览代码

Change to RGB ordering.

Joel Martin 15 年之前
父节点
当前提交
cf67217cbf
共有 2 个文件被更改,包括 5 次插入5 次删除
  1. 3 3
      canvas.js
  2. 2 2
      vnc.js

+ 3 - 3
canvas.js

@@ -139,9 +139,9 @@ draw: function () {
 rfbImage: function(x, y, width, height, arr) {
 rfbImage: function(x, y, width, height, arr) {
     var img = Canvas.ctx.createImageData(width, height);
     var img = Canvas.ctx.createImageData(width, height);
     for (var i=0; i < (width * height); i++) {
     for (var i=0; i < (width * height); i++) {
-        img.data[i*4 + 0] = arr[i*4 + 2];
+        img.data[i*4 + 0] = arr[i*4 + 0];
         img.data[i*4 + 1] = arr[i*4 + 1];
         img.data[i*4 + 1] = arr[i*4 + 1];
-        img.data[i*4 + 2] = arr[i*4 + 0];
+        img.data[i*4 + 2] = arr[i*4 + 2];
         img.data[i*4 + 3] = 255; // Set Alpha
         img.data[i*4 + 3] = 255; // Set Alpha
     }
     }
     Canvas.ctx.putImageData(img, x, y);
     Canvas.ctx.putImageData(img, x, y);
@@ -149,7 +149,7 @@ rfbImage: function(x, y, width, height, arr) {
 },
 },
 
 
 rfbRect: function(x, y, width, height, color) {
 rfbRect: function(x, y, width, height, color) {
-    Canvas.ctx.fillStyle = "rgb(" + color[2] + "," + color[1] + "," + color[0] + ")";  
+    Canvas.ctx.fillStyle = "rgb(" + color[0] + "," + color[1] + "," + color[2] + ")";  
     Canvas.ctx.fillRect(x, y, width, height);
     Canvas.ctx.fillRect(x, y, width, height);
 },
 },
 
 

+ 2 - 2
vnc.js

@@ -346,9 +346,9 @@ setPixelFormat: function () {
     arr.push16(255);  // red-max
     arr.push16(255);  // red-max
     arr.push16(255);  // green-max
     arr.push16(255);  // green-max
     arr.push16(255);  // blue-max
     arr.push16(255);  // blue-max
-    arr.push8(16);    // red-shift
+    arr.push8(0);    // red-shift
     arr.push8(8);     // green-shift
     arr.push8(8);     // green-shift
-    arr.push8(0);     // blue-shift
+    arr.push8(16);     // blue-shift
 
 
     arr.push8(0);  // padding
     arr.push8(0);  // padding
     arr.push8(0);  // padding
     arr.push8(0);  // padding