diff mbox

[SLOF,2/2] fbuffer: Use a smaller cursor

Message ID 1438078795-14360-3-git-send-email-thuth@redhat.com (mailing list archive)
State Not Applicable
Headers show

Commit Message

Thomas Huth July 28, 2015, 10:19 a.m. UTC
Drawing the cursor in the frame buffer memory is a very, very
slow operation. So let's simply switch to a "underscore" cursor
instead of the full block cursor to save some precious cycles.

Signed-off-by: Thomas Huth <thuth@redhat.com>
---
 slof/fs/fbuffer.fs | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Alexey Kardashevskiy July 29, 2015, 3:05 a.m. UTC | #1
On 07/28/2015 08:19 PM, Thomas Huth wrote:
> Drawing the cursor in the frame buffer memory is a very, very
> slow operation. So let's simply switch to a "underscore" cursor
> instead of the full block cursor to save some precious cycles.
>
> Signed-off-by: Thomas Huth <thuth@redhat.com>
> ---
>   slof/fs/fbuffer.fs | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/slof/fs/fbuffer.fs b/slof/fs/fbuffer.fs
> index 0128c07..542c431 100644
> --- a/slof/fs/fbuffer.fs
> +++ b/slof/fs/fbuffer.fs
> @@ -98,7 +98,8 @@ CREATE bitmap-buffer 400 4 * allot
>
>   : fb8-toggle-cursor ( -- )
>   	line# fb8-line2addr column# fb8-columns2bytes +
> -	char-height 0 ?DO
> +	char-height 3 - screen-width screen-depth * * +
> +	3 0 ?DO


Why not just:

-	char-height 0 ?DO
+	1 0 ?DO

? What is this magic with screen-width about?


>   		dup char-width screen-depth * invert-region
>   		screen-width screen-depth * +
>   	LOOP drop
>
Segher Boessenkool July 29, 2015, 3:42 a.m. UTC | #2
On Wed, Jul 29, 2015 at 01:05:48PM +1000, Alexey Kardashevskiy wrote:
> >  : fb8-toggle-cursor ( -- )
> >  	line# fb8-line2addr column# fb8-columns2bytes +
> >-	char-height 0 ?DO
> >+	char-height 3 - screen-width screen-depth * * +
> >+	3 0 ?DO
> 
> Why not just:
> 
> -	char-height 0 ?DO
> +	1 0 ?DO
> 
> ? What is this magic with screen-width about?

Thomas' patch draws the cursor as the bottom three lines of a
character cell; your suggestion would draw it as the top one line.
But indeed it could be

  char-height dup 3 - ?DO ...


Segher
Thomas Huth July 29, 2015, 6:03 a.m. UTC | #3
On 29/07/15 05:42, Segher Boessenkool wrote:
> On Wed, Jul 29, 2015 at 01:05:48PM +1000, Alexey Kardashevskiy wrote:
>>>  : fb8-toggle-cursor ( -- )
>>>  	line# fb8-line2addr column# fb8-columns2bytes +
>>> -	char-height 0 ?DO
>>> +	char-height 3 - screen-width screen-depth * * +
>>> +	3 0 ?DO
>>
>> Why not just:
>>
>> -	char-height 0 ?DO
>> +	1 0 ?DO
>>
>> ? What is this magic with screen-width about?
> 
> Thomas' patch draws the cursor as the bottom three lines of a
> character cell; your suggestion would draw it as the top one line.

Right.

> But indeed it could be
> 
>   char-height dup 3 - ?DO ...

Since the loop body expects the framebuffer address on the stack, the
loop boundaries are just used to count the iterations ... so "3 0"
sounds like the easiest and most readable way to specify this IMHO.

 Thomas
diff mbox

Patch

diff --git a/slof/fs/fbuffer.fs b/slof/fs/fbuffer.fs
index 0128c07..542c431 100644
--- a/slof/fs/fbuffer.fs
+++ b/slof/fs/fbuffer.fs
@@ -98,7 +98,8 @@  CREATE bitmap-buffer 400 4 * allot
 
 : fb8-toggle-cursor ( -- )
 	line# fb8-line2addr column# fb8-columns2bytes +
-	char-height 0 ?DO
+	char-height 3 - screen-width screen-depth * * +
+	3 0 ?DO
 		dup char-width screen-depth * invert-region
 		screen-width screen-depth * +
 	LOOP drop