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
e881ce5a
Commit
e881ce5a
authored
Oct 18, 2012
by
Joel Martin
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote branch 'Medical-Insight/non-square-cursor-fix'
parents
8e2d7496
6f4cbb3f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
18 deletions
+31
-18
display.js
include/display.js
+31
-18
No files found.
include/display.js
View file @
e881ce5a
...
...
@@ -657,11 +657,18 @@ return constructor(); // Return the public API interface
/* Set CSS cursor property using data URI encoded cursor file */
function
changeCursor
(
target
,
pixels
,
mask
,
hotx
,
hoty
,
w
,
h
,
cmap
)
{
function
changeCursor
(
target
,
pixels
,
mask
,
hotx
,
hoty
,
w
0
,
h0
,
cmap
)
{
"use strict"
;
var
cur
=
[],
rgb
,
IHDRsz
,
RGBsz
,
ANDsz
,
XORsz
,
url
,
idx
,
alpha
,
x
,
y
;
//Util.Debug(">> changeCursor, x: " + hotx + ", y: " + hoty + ", w: " + w + ", h: " + h);
//Util.Debug(">> changeCursor, x: " + hotx + ", y: " + hoty + ", w0: " + w0 + ", h0: " + h0);
var
w
=
w0
;
var
h
=
h0
;
if
(
h
<
w
)
h
=
w
;
// increase h to make it square
else
w
=
h
;
// increace w to make it square
// Push multi-byte little-endian values
cur
.
push16le
=
function
(
num
)
{
this
.
push
((
num
)
&
0xFF
,
...
...
@@ -715,22 +722,28 @@ function changeCursor(target, pixels, mask, hotx, hoty, w, h, cmap) {
// 62: color data (RGBQUAD icColors[])
for
(
y
=
h
-
1
;
y
>=
0
;
y
-=
1
)
{
for
(
x
=
0
;
x
<
w
;
x
+=
1
)
{
idx
=
y
*
Math
.
ceil
(
w
/
8
)
+
Math
.
floor
(
x
/
8
);
alpha
=
(
mask
[
idx
]
<<
(
x
%
8
))
&
0x80
?
255
:
0
;
if
(
cmap
)
{
idx
=
(
w
*
y
)
+
x
;
rgb
=
cmap
[
pixels
[
idx
]];
cur
.
push
(
rgb
[
2
]);
// blue
cur
.
push
(
rgb
[
1
]);
// green
cur
.
push
(
rgb
[
0
]);
// red
cur
.
push
(
alpha
);
// alpha
if
(
x
>=
w0
||
y
>=
h0
)
{
cur
.
push
(
0
);
// blue
cur
.
push
(
0
);
// green
cur
.
push
(
0
);
// red
cur
.
push
(
0
);
// alpha
}
else
{
idx
=
((
w
*
y
)
+
x
)
*
4
;
cur
.
push
(
pixels
[
idx
+
2
]);
// blue
cur
.
push
(
pixels
[
idx
+
1
]);
// green
cur
.
push
(
pixels
[
idx
]);
// red
cur
.
push
(
alpha
);
// alpha
idx
=
y
*
Math
.
ceil
(
w0
/
8
)
+
Math
.
floor
(
x
/
8
);
alpha
=
(
mask
[
idx
]
<<
(
x
%
8
))
&
0x80
?
255
:
0
;
if
(
cmap
)
{
idx
=
(
w0
*
y
)
+
x
;
rgb
=
cmap
[
pixels
[
idx
]];
cur
.
push
(
rgb
[
2
]);
// blue
cur
.
push
(
rgb
[
1
]);
// green
cur
.
push
(
rgb
[
0
]);
// red
cur
.
push
(
alpha
);
// alpha
}
else
{
idx
=
((
w0
*
y
)
+
x
)
*
4
;
cur
.
push
(
pixels
[
idx
+
2
]);
// blue
cur
.
push
(
pixels
[
idx
+
1
]);
// green
cur
.
push
(
pixels
[
idx
]);
// red
cur
.
push
(
alpha
);
// alpha
}
}
}
}
...
...
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