Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
N
noVNC
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
rasky
noVNC
Commits
48ebcdb1
Commit
48ebcdb1
authored
Apr 14, 2010
by
Joel Martin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename canvas.js routines to not have "rfb" prefix.
- Also, try making set fillStyle called less often.
parent
31af85b9
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
10 deletions
+18
-10
canvas.js
canvas.js
+11
-3
vnc.js
vnc.js
+7
-7
No files found.
canvas.js
View file @
48ebcdb1
...
@@ -6,6 +6,8 @@ c_wx : 0,
...
@@ -6,6 +6,8 @@ c_wx : 0,
c_wy
:
0
,
c_wy
:
0
,
ctx
:
null
,
ctx
:
null
,
prevStyle
:
""
,
mouseDown
:
function
(
e
)
{
mouseDown
:
function
(
e
)
{
var
evt
=
e
.
event
||
window
.
event
;
var
evt
=
e
.
event
||
window
.
event
;
e
.
stop
();
e
.
stop
();
...
@@ -71,6 +73,8 @@ init: function (id, width, height, keyDown, keyUp, mouseDown, mouseUp) {
...
@@ -71,6 +73,8 @@ init: function (id, width, height, keyDown, keyUp, mouseDown, mouseUp) {
if
(
!
c
.
getContext
)
return
;
if
(
!
c
.
getContext
)
return
;
Canvas
.
ctx
=
c
.
getContext
(
'2d'
);
Canvas
.
ctx
=
c
.
getContext
(
'2d'
);
Canvas
.
prevStyle
=
""
;
console
.
log
(
"<< init_canvas"
);
console
.
log
(
"<< init_canvas"
);
},
},
...
@@ -119,7 +123,7 @@ draw: function () {
...
@@ -119,7 +123,7 @@ draw: function () {
Canvas
.
ctx
.
putImageData
(
img
,
100
,
100
);
Canvas
.
ctx
.
putImageData
(
img
,
100
,
100
);
},
},
r
fb
Image
:
function
(
x
,
y
,
width
,
height
,
arr
)
{
r
gbx
Image
:
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
+
0
];
img
.
data
[
i
*
4
+
0
]
=
arr
[
i
*
4
+
0
];
...
@@ -131,8 +135,12 @@ rfbImage: function(x, y, width, height, arr) {
...
@@ -131,8 +135,12 @@ rfbImage: function(x, y, width, height, arr) {
},
},
rfbRect
:
function
(
x
,
y
,
width
,
height
,
color
)
{
fillRect
:
function
(
x
,
y
,
width
,
height
,
color
)
{
Canvas
.
ctx
.
fillStyle
=
"rgb("
+
color
[
0
]
+
","
+
color
[
1
]
+
","
+
color
[
2
]
+
")"
;
var
newStyle
=
"rgb("
+
color
[
0
]
+
","
+
color
[
1
]
+
","
+
color
[
2
]
+
")"
;
if
(
newStyle
!=
Canvas
.
prevStyle
)
{
Canvas
.
ctx
.
fillStyle
=
newStyle
;
prevStyle
=
newStyle
;
}
Canvas
.
ctx
.
fillRect
(
x
,
y
,
width
,
height
);
Canvas
.
ctx
.
fillRect
(
x
,
y
,
width
,
height
);
},
},
...
...
vnc.js
View file @
48ebcdb1
...
@@ -338,7 +338,7 @@ normal_msg: function () {
...
@@ -338,7 +338,7 @@ normal_msg: function () {
display_raw
:
function
()
{
display_raw
:
function
()
{
console
.
log
(
">> display_raw"
);
console
.
log
(
">> display_raw"
);
Canvas
.
r
fb
Image
(
FBU
.
x
,
FBU
.
y
,
FBU
.
width
,
FBU
.
height
,
RFB
.
d
);
Canvas
.
r
gbx
Image
(
FBU
.
x
,
FBU
.
y
,
FBU
.
width
,
FBU
.
height
,
RFB
.
d
);
RFB
.
d
.
shiftBytes
(
FBU
.
width
*
FBU
.
height
*
RFB
.
fb_Bpp
);
RFB
.
d
.
shiftBytes
(
FBU
.
width
*
FBU
.
height
*
RFB
.
fb_Bpp
);
FBU
.
rects
--
;
FBU
.
rects
--
;
},
},
...
@@ -357,7 +357,7 @@ display_rre: function () {
...
@@ -357,7 +357,7 @@ display_rre: function () {
FBU
.
subrects
=
RFB
.
d
.
shift32
();
FBU
.
subrects
=
RFB
.
d
.
shift32
();
console
.
log
(
">> display_rre "
+
"("
+
FBU
.
subrects
+
" subrects)"
);
console
.
log
(
">> display_rre "
+
"("
+
FBU
.
subrects
+
" subrects)"
);
var
color
=
RFB
.
d
.
shiftBytes
(
RFB
.
fb_Bpp
);
// Background
var
color
=
RFB
.
d
.
shiftBytes
(
RFB
.
fb_Bpp
);
// Background
Canvas
.
rfb
Rect
(
FBU
.
x
,
FBU
.
y
,
FBU
.
width
,
FBU
.
height
,
color
);
Canvas
.
fill
Rect
(
FBU
.
x
,
FBU
.
y
,
FBU
.
width
,
FBU
.
height
,
color
);
}
}
while
((
FBU
.
subrects
>
0
)
&&
(
RFB
.
d
.
length
>=
(
RFB
.
fb_Bpp
+
8
)))
{
while
((
FBU
.
subrects
>
0
)
&&
(
RFB
.
d
.
length
>=
(
RFB
.
fb_Bpp
+
8
)))
{
FBU
.
subrects
--
;
FBU
.
subrects
--
;
...
@@ -366,7 +366,7 @@ display_rre: function () {
...
@@ -366,7 +366,7 @@ display_rre: function () {
var
y
=
RFB
.
d
.
shift16
();
var
y
=
RFB
.
d
.
shift16
();
var
width
=
RFB
.
d
.
shift16
();
var
width
=
RFB
.
d
.
shift16
();
var
height
=
RFB
.
d
.
shift16
();
var
height
=
RFB
.
d
.
shift16
();
Canvas
.
rfb
Rect
(
FBU
.
x
+
x
,
FBU
.
y
+
y
,
width
,
height
,
color
);
Canvas
.
fill
Rect
(
FBU
.
x
+
x
,
FBU
.
y
+
y
,
width
,
height
,
color
);
}
}
//console.log(" display_rre: rects: " + FBU.rects + ", FBU.subrects: " + FBU.subrects);
//console.log(" display_rre: rects: " + FBU.rects + ", FBU.subrects: " + FBU.subrects);
...
@@ -452,10 +452,10 @@ display_hextile: function() {
...
@@ -452,10 +452,10 @@ display_hextile: function() {
//FBU.lastsubencoding = 0;
//FBU.lastsubencoding = 0;
continue
;
continue
;
}
else
{
}
else
{
Canvas
.
rfb
Rect
(
x
,
y
,
w
,
h
,
FBU
.
background
);
Canvas
.
fill
Rect
(
x
,
y
,
w
,
h
,
FBU
.
background
);
}
}
}
else
if
(
FBU
.
subencoding
&
0x01
)
{
// Raw
}
else
if
(
FBU
.
subencoding
&
0x01
)
{
// Raw
Canvas
.
r
fb
Image
(
x
,
y
,
w
,
h
,
RFB
.
d
);
Canvas
.
r
gbx
Image
(
x
,
y
,
w
,
h
,
RFB
.
d
);
}
else
{
}
else
{
var
idx
=
0
;
var
idx
=
0
;
if
(
FBU
.
subencoding
&
0x02
)
{
// Background
if
(
FBU
.
subencoding
&
0x02
)
{
// Background
...
@@ -468,7 +468,7 @@ display_hextile: function() {
...
@@ -468,7 +468,7 @@ display_hextile: function() {
idx
+=
RFB
.
fb_Bpp
;
idx
+=
RFB
.
fb_Bpp
;
//console.log(" foreground: " + FBU.foreground);
//console.log(" foreground: " + FBU.foreground);
}
}
Canvas
.
rfb
Rect
(
x
,
y
,
w
,
h
,
FBU
.
background
);
Canvas
.
fill
Rect
(
x
,
y
,
w
,
h
,
FBU
.
background
);
if
(
FBU
.
subencoding
&
0x08
)
{
// AnySubrects
if
(
FBU
.
subencoding
&
0x08
)
{
// AnySubrects
subrects
=
RFB
.
d
[
idx
];
subrects
=
RFB
.
d
[
idx
];
idx
++
;
idx
++
;
...
@@ -490,7 +490,7 @@ display_hextile: function() {
...
@@ -490,7 +490,7 @@ display_hextile: function() {
sw
=
(
wh
>>
4
)
+
1
;
sw
=
(
wh
>>
4
)
+
1
;
sh
=
(
wh
&
0x0f
)
+
1
;
sh
=
(
wh
&
0x0f
)
+
1
;
Canvas
.
rfb
Rect
(
sx
,
sy
,
sw
,
sh
,
color
);
Canvas
.
fill
Rect
(
sx
,
sy
,
sw
,
sh
,
color
);
}
}
}
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment