aboutsummaryrefslogtreecommitdiff
path: root/lib/libvgl
diff options
context:
space:
mode:
authorBruce Evans <bde@FreeBSD.org>2019-03-27 18:03:34 +0000
committerBruce Evans <bde@FreeBSD.org>2019-03-27 18:03:34 +0000
commit014ddcbce49abf08744cb7af35ebc93c0cfe6aa7 (patch)
tree03ecba6c6c83e4c50718f36c8aa80b6f58c70953 /lib/libvgl
parent8ae9b1fe9647b71765ebec02200d1faee456e227 (diff)
Notes
Diffstat (limited to 'lib/libvgl')
-rw-r--r--lib/libvgl/bitmap.c8
-rw-r--r--lib/libvgl/mouse.c38
-rw-r--r--lib/libvgl/simple.c40
3 files changed, 62 insertions, 24 deletions
diff --git a/lib/libvgl/bitmap.c b/lib/libvgl/bitmap.c
index 79605bb5c33e..38c33102b57c 100644
--- a/lib/libvgl/bitmap.c
+++ b/lib/libvgl/bitmap.c
@@ -361,9 +361,13 @@ VGLBitmapCopy(VGLBitmap *src, int srcx, int srcy,
{
int error;
- VGLMouseFreeze(dstx, dsty, width, hight, 0);
+ if (src->Type != MEMBUF)
+ VGLMouseFreeze(srcx, srcy, width, hight, 0);
+ if (dst->Type != MEMBUF)
+ VGLMouseFreeze(dstx, dsty, width, hight, 0);
error = __VGLBitmapCopy(src, srcx, srcy, dst, dstx, dsty, width, hight);
- VGLMouseUnFreeze();
+ if (src->Type != MEMBUF || dst->Type != MEMBUF)
+ VGLMouseUnFreeze();
return error;
}
diff --git a/lib/libvgl/mouse.c b/lib/libvgl/mouse.c
index f9ae95760374..2e664ceb93f9 100644
--- a/lib/libvgl/mouse.c
+++ b/lib/libvgl/mouse.c
@@ -102,6 +102,7 @@ VGLMousePointerShow()
int i, pos, pos1;
if (!VGLMouseVisible) {
+ VGLMouseFrozen++;
VGLMouseVisible = 1;
crtcidx = inb(0x3c4);
crtcval = inb(0x3c5);
@@ -124,6 +125,7 @@ VGLMousePointerShow()
outb(0x3c5, crtcval);
outb(0x3ce, gdcidx);
outb(0x3cf, gdcval);
+ VGLMouseFrozen--;
}
}
@@ -133,6 +135,7 @@ VGLMousePointerHide()
byte crtcidx, crtcval, gdcidx, gdcval;
if (VGLMouseVisible) {
+ VGLMouseFrozen++;
VGLMouseVisible = 0;
crtcidx = inb(0x3c4);
crtcval = inb(0x3c5);
@@ -144,6 +147,7 @@ VGLMousePointerHide()
outb(0x3c5, crtcval);
outb(0x3ce, gdcidx);
outb(0x3cf, gdcval);
+ VGLMouseFrozen--;
}
}
@@ -170,7 +174,7 @@ VGLMouseAction(int dummy)
struct mouse_info mouseinfo;
if (VGLMouseFrozen) {
- VGLMouseFrozen++;
+ VGLMouseFrozen += 8;
return;
}
mouseinfo.operation = MOUSE_GETINFO;
@@ -257,9 +261,8 @@ VGLMouseFreeze(int x, int y, int width, int hight, u_long color)
{
int i, xstride, ystride;
- if (!VGLMouseFrozen) {
- VGLMouseFrozen = 1;
- if (width > 1 || hight > 1) { /* bitmap */
+ VGLMouseFrozen++;
+ if (width > 1 || hight > 1 || (color & 0xc0000000) == 0) { /* bitmap */
if (VGLMouseShown == 1) {
int overlap;
@@ -283,29 +286,38 @@ VGLMouseFreeze(int x, int y, int width, int hight, u_long color)
y >= VGLMouseYpos && y < VGLMouseYpos + MOUSE_IMG_SIZE) {
xstride = VGLDisplay->PixelBytes;
ystride = MOUSE_IMG_SIZE * xstride;
- for (i = 0; i < xstride; i++, color >>= 8)
- VGLMouseSave.Bitmap[(y-VGLMouseYpos)*ystride+
- (x-VGLMouseXpos)*xstride+i] = color;
- if (VGLMouseAndMask->Bitmap
- [(y-VGLMouseYpos)*MOUSE_IMG_SIZE+(x-VGLMouseXpos)]) {
- return 1;
+ if (color & 0x40000000) { /* Get */
+ color = 0;
+ for (i = xstride - 1; i >= 0; i--)
+ color = (color << 8) |
+ VGLMouseSave.Bitmap[(y-VGLMouseYpos)*ystride+
+ (x-VGLMouseXpos)*xstride+i];
+ return 0x40000000 | (color & 0xffffff);
+ } else { /* Set */
+ color &= 0xffffff; /* discard flag and other garbage */
+ for (i = 0; i < xstride; i++, color >>= 8)
+ VGLMouseSave.Bitmap[(y-VGLMouseYpos)*ystride+
+ (x-VGLMouseXpos)*xstride+i] = color;
+ if (VGLMouseAndMask->Bitmap
+ [(y-VGLMouseYpos)*MOUSE_IMG_SIZE+(x-VGLMouseXpos)]) {
+ return 1;
+ }
}
}
}
- }
return 0;
}
void
VGLMouseUnFreeze()
{
- if (VGLMouseFrozen > 1) {
+ if (VGLMouseFrozen > 8) {
VGLMouseFrozen = 0;
VGLMouseAction(0);
}
else {
- VGLMouseFrozen = 0;
if (VGLMouseShown == VGL_MOUSESHOW && !VGLMouseVisible)
VGLMousePointerShow();
+ VGLMouseFrozen = 0;
}
}
diff --git a/lib/libvgl/simple.c b/lib/libvgl/simple.c
index 070dad590edf..6910dd2599d0 100644
--- a/lib/libvgl/simple.c
+++ b/lib/libvgl/simple.c
@@ -98,7 +98,8 @@ VGLSetXY(VGLBitmap *object, int x, int y, u_long color)
VGLCheckSwitch();
if (x>=0 && x<object->VXsize && y>=0 && y<object->VYsize) {
- if (!VGLMouseFreeze(x, y, 1, 1, color)) {
+ if (object->Type == MEMBUF ||
+ !VGLMouseFreeze(x, y, 1, 1, 0x80000000 | color)) {
switch (object->Type) {
case MEMBUF:
case VIDBUF8:
@@ -139,12 +140,13 @@ set_planar:
object->Bitmap[offset] |= (byte)color;
}
}
- VGLMouseUnFreeze();
+ if (object->Type != MEMBUF)
+ VGLMouseUnFreeze();
}
}
-u_long
-VGLGetXY(VGLBitmap *object, int x, int y)
+static u_long
+__VGLGetXY(VGLBitmap *object, int x, int y)
{
int offset;
byte b[4];
@@ -152,9 +154,6 @@ VGLGetXY(VGLBitmap *object, int x, int y)
u_long color;
byte mask;
- VGLCheckSwitch();
- if (x<0 || x>=object->VXsize || y<0 || y>=object->VYsize)
- return 0;
switch (object->Type) {
case MEMBUF:
case VIDBUF8:
@@ -195,6 +194,27 @@ get_planar:
return 0; /* XXX black? */
}
+u_long
+VGLGetXY(VGLBitmap *object, int x, int y)
+{
+ u_long color;
+
+ VGLCheckSwitch();
+ if (x<0 || x>=object->VXsize || y<0 || y>=object->VYsize)
+ return 0;
+ if (object->Type != MEMBUF) {
+ color = VGLMouseFreeze(x, y, 1, 1, 0x40000000);
+ if (color & 0x40000000) {
+ VGLMouseUnFreeze();
+ return color & 0xffffff;
+ }
+ }
+ color = __VGLGetXY(object, x, y);
+ if (object->Type != MEMBUF)
+ VGLMouseUnFreeze();
+ return color;
+}
+
/*
* Symmetric Double Step Line Algorithm by Brian Wyvill from
* "Graphics Gems", Academic Press, 1990.
@@ -501,7 +521,8 @@ VGLClear(VGLBitmap *object, u_long color)
byte b[4];
VGLCheckSwitch();
- VGLMouseFreeze(0, 0, object->Xsize, object->Ysize, color); /* XXX */
+ if (object->Type != MEMBUF)
+ VGLMouseFreeze(0, 0, object->Xsize, object->Ysize, color);
switch (object->Type) {
case MEMBUF:
case VIDBUF8:
@@ -565,7 +586,8 @@ VGLClear(VGLBitmap *object, u_long color)
outb(0x3ce, 0x05); outb(0x3cf, 0x00);
break;
}
- VGLMouseUnFreeze();
+ if (object->Type != MEMBUF)
+ VGLMouseUnFreeze();
}
void