OSDev.org

The Place to Start for Operating System Developers
It is currently Thu Mar 28, 2024 5:48 pm

All times are UTC - 6 hours




Post new topic Reply to topic  [ 8 posts ] 
Author Message
 Post subject: GUI View scrolling
PostPosted: Thu Oct 21, 2021 8:23 am 
Offline
Member
Member

Joined: Fri Nov 01, 2019 1:17 am
Posts: 95
Hi,
I am confused, how graphical views are scrolled (up, down, right, left)? Does the view contains a back buffer for storing the off screen contents ? Or something else? I am seeking for good explanations.

Thanks in advance


Top
 Profile  
 
 Post subject: Re: GUI View scrolling
PostPosted: Thu Oct 21, 2021 8:56 am 
Offline
Member
Member
User avatar

Joined: Sun Oct 22, 2006 7:01 am
Posts: 2646
Location: Devon, UK
Hi,

I think in this case, when you mention a "back buffer", what you are actually referring to is a viewport.

For any kind of good explanation, more details are needed. What hardware? What video mode (LFB / VGA Text / other)?

For example, my console uses any hardware supported resolution with a LFB and I simply use memcpy's to scroll text - inefficient but good enough for a debug kernel. I expect that when implementing something for user mode, I'll want proper buffering and so on. Perhaps your post is referring more to graphics than text though?

More details please.

Cheers,
Adam

EDIT: I've just seen in your title that you're looking for explanations on a GUI. It sounds more than ever like we're talking about viewports, then. In which case I imagine you are wanting information on per-application buffers and viewports. Is that correct?


Top
 Profile  
 
 Post subject: Re: GUI View scrolling
PostPosted: Thu Oct 21, 2021 9:01 am 
Offline
Member
Member

Joined: Fri Nov 01, 2019 1:17 am
Posts: 95
AJ wrote:
Hi,

I think in this case, when you mention a "back buffer", what you are actually referring to is a viewport.

For any kind of good explanation, more details are needed. What hardware? What video mode (LFB / VGA Text / other)?

For example, my console uses any hardware supported resolution with a LFB and I simply use memcpy's to scroll text - inefficient but good enough for a debug kernel. I expect that when implementing something for user mode, I'll want proper buffering and so on. Perhaps your post is referring more to graphics than text though?

More details please.

Cheers,
Adam


Hi,

I am referring to graphics, like list view scrolling, rich text editor scrolling. How can I implement scrolling? Do viewport contains back buffer for storing off-screen contents? How scrolling works in graphics? Not in text!!

I am using GOP & VMware SVGA for graphics rendering.


Top
 Profile  
 
 Post subject: Re: GUI View scrolling
PostPosted: Thu Oct 21, 2021 9:26 am 
Offline
Member
Member

Joined: Mon Mar 25, 2013 7:01 pm
Posts: 5100
You could draw the contents clipped to the view boundaries. When the view scrolls, draw contents to fill the uncovered area.

Or, you could draw the contents to a back buffer. When the view scrolls, display different parts of the back buffer.

Or, you could combine both options. Use a back buffer that's bigger than the view but smaller than the contents. Draw the contents clipped to the buffer boundaries. When the view scrolls, discard the buffer contents that go further away and reuse that part of the buffer to draw contents that are closer to the view. (I think web browsers do this.)


Top
 Profile  
 
 Post subject: Re: GUI View scrolling
PostPosted: Thu Oct 21, 2021 11:32 pm 
Offline
Member
Member

Joined: Fri Nov 01, 2019 1:17 am
Posts: 95
Octocontrabass wrote:
You could draw the contents clipped to the view boundaries. When the view scrolls, draw contents to fill the uncovered area.

Or, you could draw the contents to a back buffer. When the view scrolls, display different parts of the back buffer.

Or, you could combine both options. Use a back buffer that's bigger than the view but smaller than the contents. Draw the contents clipped to the buffer boundaries. When the view scrolls, discard the buffer contents that go further away and reuse that part of the buffer to draw contents that are closer to the view. (I think web browsers do this.)



Ok I'll try to implement this, thank you!!


Top
 Profile  
 
 Post subject: Re: GUI View scrolling
PostPosted: Fri Oct 22, 2021 9:55 am 
Offline
Member
Member

Joined: Wed Aug 21, 2013 7:08 am
Posts: 240
For item lists i first compute the total item height and viewport height to get the scroll buttons height, and start drawing the first item based on the scroll button position. So you always have full items displayed and scroll on per item bases.

For more complex content you might want to either draw everything in a back buffer and scroll / clip on the viewport. For static content its ok. For dynamic content it can be more wasteful.

Or determine which item rect intersect with the viewable part and draw only this with a small offset from the top of viewable items to the top of the viewport, for scrolling at pixel granulosity.

_________________
https://gitlab.com/h0bby1/micro-kernel


Top
 Profile  
 
 Post subject: Re: GUI View scrolling
PostPosted: Sun Oct 24, 2021 6:19 am 
Offline
Member
Member

Joined: Fri Nov 01, 2019 1:17 am
Posts: 95
h0bby1 wrote:
For item lists i first compute the total item height and viewport height to get the scroll buttons height, and start drawing the first item based on the scroll button position. So you always have full items displayed and scroll on per item bases.

For more complex content you might want to either draw everything in a back buffer and scroll / clip on the viewport. For static content its ok. For dynamic content it can be more wasteful.

Or determine which item rect intersect with the viewable part and draw only this with a small offset from the top of viewable items to the top of the viewport, for scrolling at pixel granulosity.



Hi, thank you so much for your reply. What do you do for text items like rich text edit or any gui control that contains text ? Do you draw it to back buffer? And what should be the size of back buffer ? I think the size should be equal to screen size! Am I right?

Thanks in advance


Top
 Profile  
 
 Post subject: Re: GUI View scrolling
PostPosted: Sat Oct 30, 2021 7:22 am 
Offline
Member
Member

Joined: Wed Aug 21, 2013 7:08 am
Posts: 240
Kamal123 wrote:
h0bby1 wrote:
For item lists i first compute the total item height and viewport height to get the scroll buttons height, and start drawing the first item based on the scroll button position. So you always have full items displayed and scroll on per item bases.

For more complex content you might want to either draw everything in a back buffer and scroll / clip on the viewport. For static content its ok. For dynamic content it can be more wasteful.

Or determine which item rect intersect with the viewable part and draw only this with a small offset from the top of viewable items to the top of the viewport, for scrolling at pixel granulosity.



Hi, thank you so much for your reply. What do you do for text items like rich text edit or any gui control that contains text ? Do you draw it to back buffer? And what should be the size of back buffer ? I think the size should be equal to screen size! Am I right?

Thanks in advance


For the moment my system is made with containers that are like windows that contain an object graph, application add controls to the object graph, and the rendering thread loops through containers and deal with clipping/ scrolling to know which controls needs to be rendered where.

Its made to be recursive to have child containers or controls that control the clipping and position at each steps.

In theory it can have a container inside of a scrolled view that contain another scroller etc.

But its completely work in progess im not sure its the best model :)

_________________
https://gitlab.com/h0bby1/micro-kernel


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 8 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: Google [Bot] and 83 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group