From owner-svn-src-all@freebsd.org Tue Sep 3 14:08:22 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AB4CBDDB8E; Tue, 3 Sep 2019 14:07:28 +0000 (UTC) (envelope-from yuripv@freebsd.org) Received: from freefall.freebsd.org (freefall.freebsd.org [96.47.72.132]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "freefall.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46N80b6YnWz4QdG; Tue, 3 Sep 2019 14:07:27 +0000 (UTC) (envelope-from yuripv@freebsd.org) Received: by freefall.freebsd.org (Postfix, from userid 1452) id 1513B1B695; Tue, 3 Sep 2019 14:06:41 +0000 (UTC) X-Original-To: yuripv@localmail.freebsd.org Delivered-To: yuripv@localmail.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [96.47.72.80]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (Client CN "mx1.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by freefall.freebsd.org (Postfix) with ESMTPS id 057AA1A879; Wed, 24 Apr 2019 16:03:39 +0000 (UTC) (envelope-from owner-src-committers@freebsd.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2610:1c1:1:6074::16:84]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "freefall.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 5B1776C2A6; Wed, 24 Apr 2019 16:03:39 +0000 (UTC) (envelope-from owner-src-committers@freebsd.org) Received: by freefall.freebsd.org (Postfix, from userid 538) id 1A39A1A841; Wed, 24 Apr 2019 16:03:39 +0000 (UTC) Delivered-To: src-committers@localmail.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [96.47.72.80]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (Client CN "mx1.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by freefall.freebsd.org (Postfix) with ESMTPS id 4DE021A83F for ; Wed, 24 Apr 2019 16:03:36 +0000 (UTC) (envelope-from bde@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 0CD636C2A3; Wed, 24 Apr 2019 16:03:36 +0000 (UTC) (envelope-from bde@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CEA2BE862; Wed, 24 Apr 2019 16:03:35 +0000 (UTC) (envelope-from bde@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x3OG3ZaK029764; Wed, 24 Apr 2019 16:03:35 GMT (envelope-from bde@FreeBSD.org) Received: (from bde@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x3OG3ZeG029761; Wed, 24 Apr 2019 16:03:35 GMT (envelope-from bde@FreeBSD.org) Message-Id: <201904241603.x3OG3ZeG029761@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bde set sender to bde@FreeBSD.org using -f From: Bruce Evans To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r346641 - head/lib/libvgl X-SVN-Group: head X-SVN-Commit-Author: bde X-SVN-Commit-Paths: head/lib/libvgl X-SVN-Commit-Revision: 346641 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk X-Loop: FreeBSD.org Sender: owner-src-committers@freebsd.org X-Rspamd-Queue-Id: 5B1776C2A6 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[freebsd.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.98)[-0.976,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] Status: O X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Date: Tue, 03 Sep 2019 14:08:22 -0000 X-Original-Date: Wed, 24 Apr 2019 16:03:35 +0000 (UTC) X-List-Received-Date: Tue, 03 Sep 2019 14:08:22 -0000 Author: bde Date: Wed Apr 24 16:03:35 2019 New Revision: 346641 URL: https://svnweb.freebsd.org/changeset/base/346641 Log: Avoid hiding and unhiding the mouse cursor when copying bitmaps to the screen. Instead, copy a merged bitmap 1 line at a time. This fixes flashing of the cursor and is faster in all modes (especially in planar modes). Modified: head/lib/libvgl/bitmap.c head/lib/libvgl/mouse.c head/lib/libvgl/vgl.h Modified: head/lib/libvgl/bitmap.c ============================================================================== --- head/lib/libvgl/bitmap.c Wed Apr 24 15:54:18 2019 (r346640) +++ head/lib/libvgl/bitmap.c Wed Apr 24 16:03:35 2019 (r346641) @@ -167,8 +167,17 @@ int __VGLBitmapCopy(VGLBitmap *src, int srcx, int srcy, VGLBitmap *dst, int dstx, int dsty, int width, int hight) { - int srcline, dstline, yend, yextra, ystep; - + byte *buffer, *p; + int mousemerge, srcline, dstline, yend, yextra, ystep; + + mousemerge = 0; + if (hight < 0) { + hight = -hight; + mousemerge = (dst == VGLDisplay && + VGLMouseOverlap(dstx, dsty, width, hight)); + if (mousemerge) + buffer = alloca(width*src->PixelBytes); + } if (srcx>src->VXsize || srcy>src->VYsize || dstx>dst->VXsize || dsty>dst->VYsize) return -1; @@ -204,8 +213,13 @@ __VGLBitmapCopy(VGLBitmap *src, int srcx, int srcy, } for (srcline = srcy + yextra, dstline = dsty + yextra; srcline != yend; srcline += ystep, dstline += ystep) { - WriteVerticalLine(dst, dstx, dstline, width, - src->Bitmap+(srcline*src->VXsize+srcx)*dst->PixelBytes); + p = src->Bitmap+(srcline*src->VXsize+srcx)*dst->PixelBytes; + if (mousemerge && VGLMouseOverlap(dstx, dstline, width, 1)) { + bcopy(p, buffer, width*src->PixelBytes); + p = buffer; + VGLMouseMerge(dstx, dstline, width, p); + } + WriteVerticalLine(dst, dstx, dstline, width, p); } return 0; } @@ -214,36 +228,29 @@ int VGLBitmapCopy(VGLBitmap *src, int srcx, int srcy, VGLBitmap *dst, int dstx, int dsty, int width, int hight) { - int error, mouseoverlap; + int error; + if (hight < 0) + return -1; if (src == VGLDisplay) src = &VGLVDisplay; if (src->Type != MEMBUF) return -1; /* invalid */ if (dst == VGLDisplay) { VGLMouseFreeze(); - mouseoverlap = VGLMouseOverlap(dstx, dsty, width, hight); - if (mouseoverlap) - VGLMousePointerHide(); + __VGLBitmapCopy(src, srcx, srcy, &VGLVDisplay, dstx, dsty, width, hight); error = __VGLBitmapCopy(src, srcx, srcy, &VGLVDisplay, dstx, dsty, width, hight); - if (error != 0) { - if (mouseoverlap) - VGLMousePointerShow(); - VGLMouseUnFreeze(); + if (error != 0) return error; - } src = &VGLVDisplay; srcx = dstx; srcy = dsty; } else if (dst->Type != MEMBUF) return -1; /* invalid */ - error = __VGLBitmapCopy(src, srcx, srcy, dst, dstx, dsty, width, hight); - if (dst == VGLDisplay) { - if (mouseoverlap) - VGLMousePointerShow(); + error = __VGLBitmapCopy(src, srcx, srcy, dst, dstx, dsty, width, -hight); + if (dst == VGLDisplay) VGLMouseUnFreeze(); - } return error; } Modified: head/lib/libvgl/mouse.c ============================================================================== --- head/lib/libvgl/mouse.c Wed Apr 24 15:54:18 2019 (r346640) +++ head/lib/libvgl/mouse.c Wed Apr 24 16:03:35 2019 (r346641) @@ -356,6 +356,25 @@ VGLMouseOverlap(int x, int y, int width, int hight) } void +VGLMouseMerge(int x, int y, int width, byte *line) +{ + int pos, x1, xend, xstart; + + xstart = x; + if (xstart < VGLMouseXpos) + xstart = VGLMouseXpos; + xend = x + width; + if (xend > VGLMouseXpos + MOUSE_IMG_SIZE) + xend = VGLMouseXpos + MOUSE_IMG_SIZE; + for (x1 = xstart; x1 < xend; x1++) { + pos = (y - VGLMouseYpos) * MOUSE_IMG_SIZE + x1 - VGLMouseXpos; + if (VGLMouseAndMask->Bitmap[pos]) + bcopy(&VGLMouseOrMask->Bitmap[pos * VGLDisplay->PixelBytes], + &line[(x1 - x) * VGLDisplay->PixelBytes], VGLDisplay->PixelBytes); + } +} + +void VGLMouseUnFreeze() { INTON(); Modified: head/lib/libvgl/vgl.h ============================================================================== --- head/lib/libvgl/vgl.h Wed Apr 24 15:54:18 2019 (r346640) +++ head/lib/libvgl/vgl.h Wed Apr 24 16:03:35 2019 (r346641) @@ -136,6 +136,7 @@ void VGLMouseRestore(void); int VGLMouseStatus(int *x, int *y, char *buttons); void VGLMouseFreeze(void); int VGLMouseFreezeXY(int x, int y); +void VGLMouseMerge(int x, int y, int width, byte *line); int VGLMouseOverlap(int x, int y, int width, int hight); void VGLMouseUnFreeze(void); /* simple.c */