Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » SWT.DOUBLE_BUFFERED and SWT.NO_BACKGROUND
SWT.DOUBLE_BUFFERED and SWT.NO_BACKGROUND [message #461111] Fri, 16 September 2005 11:26 Go to next message
Chris Gross is currently offline Chris GrossFriend
Messages: 471
Registered: July 2009
Senior Member
Does SWT.DOUBLE_BUFFERED essentially obsolete SWT.NO_BACKGROUND? The
benefit of SWT.NO_BACKGROUND was to reduce flicker. If
SWT.DOUBLE_BUFFERED handles that, then is there no reason to continue to
use SWT.NO_BACKGROUND?

Also, is there any reason why I wouldn't want to use SWT.DOUBLE_BUFFERED
on pretty much any custom widget/canvas? It works great and seems
like its 'free-of-charge' but I want to verify that.

-Chris
Re: SWT.DOUBLE_BUFFERED and SWT.NO_BACKGROUND [message #461284 is a reply to message #461111] Tue, 20 September 2005 11:24 Go to previous messageGo to next message
No real name is currently offline No real nameFriend
Messages: 97
Registered: July 2009
Member
Although I didn't tried SWT.DOUBLE_BUFFERED, two are different.
SWT.NO_BACKGROUND does not draw background and thus reduce
flickering. Double buffering is useful when you have complex drawing that
may take significant time to draw. In this situation, you can notice that
things
being drawn. Double buffering removes this effect. Draw on invisible images
slowly and draw the images on the screen as images very quickly so you
don't notice things are being drawn.

Cheers.

"Chris Gross" <schtoo@schtoo.com> wrote in message
news:dgea4p$686$1@news.eclipse.org...
> Does SWT.DOUBLE_BUFFERED essentially obsolete SWT.NO_BACKGROUND? The
> benefit of SWT.NO_BACKGROUND was to reduce flicker. If
> SWT.DOUBLE_BUFFERED handles that, then is there no reason to continue to
> use SWT.NO_BACKGROUND?
>
> Also, is there any reason why I wouldn't want to use SWT.DOUBLE_BUFFERED
> on pretty much any custom widget/canvas? It works great and seems like
> its 'free-of-charge' but I want to verify that.
>
> -Chris
Re: SWT.DOUBLE_BUFFERED and SWT.NO_BACKGROUND [message #461311 is a reply to message #461284] Tue, 20 September 2005 17:57 Go to previous messageGo to next message
Chris Gross is currently offline Chris GrossFriend
Messages: 471
Registered: July 2009
Senior Member
Thanks, I am aware of how things work. I'm asking for a little deeper
knowledge, if SWT.NO_BACKGROUND is still useful and if
SWT.DOUBLE_BUFFERED has a cost associated with it.

-Chris

Joe Smith wrote:
> Although I didn't tried SWT.DOUBLE_BUFFERED, two are different.
> SWT.NO_BACKGROUND does not draw background and thus reduce
> flickering. Double buffering is useful when you have complex drawing that
> may take significant time to draw. In this situation, you can notice that
> things
> being drawn. Double buffering removes this effect. Draw on invisible images
> slowly and draw the images on the screen as images very quickly so you
> don't notice things are being drawn.
>
> Cheers.
>
> "Chris Gross" <schtoo@schtoo.com> wrote in message
> news:dgea4p$686$1@news.eclipse.org...
>> Does SWT.DOUBLE_BUFFERED essentially obsolete SWT.NO_BACKGROUND? The
>> benefit of SWT.NO_BACKGROUND was to reduce flicker. If
>> SWT.DOUBLE_BUFFERED handles that, then is there no reason to continue to
>> use SWT.NO_BACKGROUND?
>>
>> Also, is there any reason why I wouldn't want to use SWT.DOUBLE_BUFFERED
>> on pretty much any custom widget/canvas? It works great and seems like
>> its 'free-of-charge' but I want to verify that.
>>
>> -Chris
>
>
Re: SWT.DOUBLE_BUFFERED and SWT.NO_BACKGROUND [message #461325 is a reply to message #461311] Tue, 20 September 2005 20:07 Go to previous messageGo to next message
Bob Marinier is currently offline Bob MarinierFriend
Messages: 3
Registered: July 2009
Junior Member
I don't know the actual answer to your question, but in my lab we were
just experimenting with these two flags (alone and in combination) to
see what effect they had on our application on Windows, OS X, and Linux.
Our findings were that on Windows and OS X, there didn't seem to be
any difference between using either of these flags separately or
together (except maybe it's a little slower if you use both). However,
on Linux (Motif; we haven't tried GTK), SWT.NO_BACKGROUND caused a huge
slowdown (by itself and in combination), and also there was a noticeable
tearing effect when used by itself. SWT.DOUBLE_BUFFERED did not seem to
suffer from tearing or performance problems. So in the end we decided
to use SWT.DOUBLE_BUFFERED for all platforms.

Bob

Chris Gross wrote:
> Thanks, I am aware of how things work. I'm asking for a little deeper
> knowledge, if SWT.NO_BACKGROUND is still useful and if
> SWT.DOUBLE_BUFFERED has a cost associated with it.
>
> -Chris
>
> Joe Smith wrote:
>
>> Although I didn't tried SWT.DOUBLE_BUFFERED, two are different.
>> SWT.NO_BACKGROUND does not draw background and thus reduce
>> flickering. Double buffering is useful when you have complex drawing that
>> may take significant time to draw. In this situation, you can notice
>> that things
>> being drawn. Double buffering removes this effect. Draw on invisible
>> images
>> slowly and draw the images on the screen as images very quickly so you
>> don't notice things are being drawn.
>>
>> Cheers.
>>
>> "Chris Gross" <schtoo@schtoo.com> wrote in message
>> news:dgea4p$686$1@news.eclipse.org...
>>
>>> Does SWT.DOUBLE_BUFFERED essentially obsolete SWT.NO_BACKGROUND? The
>>> benefit of SWT.NO_BACKGROUND was to reduce flicker. If
>>> SWT.DOUBLE_BUFFERED handles that, then is there no reason to continue
>>> to use SWT.NO_BACKGROUND?
>>>
>>> Also, is there any reason why I wouldn't want to use
>>> SWT.DOUBLE_BUFFERED on pretty much any custom widget/canvas? It
>>> works great and seems like its 'free-of-charge' but I want to verify
>>> that.
>>>
>>> -Chris
>>
>>
>>
Re: SWT.DOUBLE_BUFFERED and SWT.NO_BACKGROUND [message #461339 is a reply to message #461311] Wed, 21 September 2005 04:27 Go to previous messageGo to next message
No real name is currently offline No real nameFriend
Messages: 97
Registered: July 2009
Member
Generally speaking, you need to use both of them to
eliminate flickering. If SWT supports double buffered
write, it will be great. But I have not tried yet. Note
that there should be extra APIs. You can do it manually by;
(1) Create an image of the same canvas size.
(2) Draw everything on it.
(3) Draw that image to canvas with a single drawImage().

Hope this will help.


"Chris Gross" <schtoo@schtoo.com> wrote in message
news:dgpij3$let$1@news.eclipse.org...
> Thanks, I am aware of how things work. I'm asking for a little deeper
> knowledge, if SWT.NO_BACKGROUND is still useful and if SWT.DOUBLE_BUFFERED
> has a cost associated with it.
>
> -Chris
>
> Joe Smith wrote:
>> Although I didn't tried SWT.DOUBLE_BUFFERED, two are different.
>> SWT.NO_BACKGROUND does not draw background and thus reduce
>> flickering. Double buffering is useful when you have complex drawing that
>> may take significant time to draw. In this situation, you can notice that
>> things
>> being drawn. Double buffering removes this effect. Draw on invisible
>> images
>> slowly and draw the images on the screen as images very quickly so you
>> don't notice things are being drawn.
>>
>> Cheers.
>>
>> "Chris Gross" <schtoo@schtoo.com> wrote in message
>> news:dgea4p$686$1@news.eclipse.org...
>>> Does SWT.DOUBLE_BUFFERED essentially obsolete SWT.NO_BACKGROUND? The
>>> benefit of SWT.NO_BACKGROUND was to reduce flicker. If
>>> SWT.DOUBLE_BUFFERED handles that, then is there no reason to continue to
>>> use SWT.NO_BACKGROUND?
>>>
>>> Also, is there any reason why I wouldn't want to use SWT.DOUBLE_BUFFERED
>>> on pretty much any custom widget/canvas? It works great and seems like
>>> its 'free-of-charge' but I want to verify that.
>>>
>>> -Chris
>>
Re: SWT.DOUBLE_BUFFERED and SWT.NO_BACKGROUND [message #461343 is a reply to message #461339] Wed, 21 September 2005 04:50 Go to previous messageGo to next message
No real name is currently offline No real nameFriend
Messages: 97
Registered: July 2009
Member
PS

Generally, SWT.NO_BACKGROUND alone will eliminate most
flickering problem! Consider double buffering only if you have to
draw things that may involve lots of computation or take time
to fetech required information, etc. That is , if it takes time
to draw contents, then consider to use double buffering.
In addition, if your canvas large, then also consider,
cliping techniques as well.

Regards.


"Joe Smith" <ohcho@tpg.com.au> wrote in message
news:dgqnfq$3f6$1@news.eclipse.org...
> Generally speaking, you need to use both of them to
> eliminate flickering. If SWT supports double buffered
> write, it will be great. But I have not tried yet. Note
> that there should be extra APIs. You can do it manually by;
> (1) Create an image of the same canvas size.
> (2) Draw everything on it.
> (3) Draw that image to canvas with a single drawImage().
>
> Hope this will help.
>
>
> "Chris Gross" <schtoo@schtoo.com> wrote in message
> news:dgpij3$let$1@news.eclipse.org...
>> Thanks, I am aware of how things work. I'm asking for a little deeper
>> knowledge, if SWT.NO_BACKGROUND is still useful and if
>> SWT.DOUBLE_BUFFERED has a cost associated with it.
>>
>> -Chris
>>
>> Joe Smith wrote:
>>> Although I didn't tried SWT.DOUBLE_BUFFERED, two are different.
>>> SWT.NO_BACKGROUND does not draw background and thus reduce
>>> flickering. Double buffering is useful when you have complex drawing
>>> that
>>> may take significant time to draw. In this situation, you can notice
>>> that things
>>> being drawn. Double buffering removes this effect. Draw on invisible
>>> images
>>> slowly and draw the images on the screen as images very quickly so you
>>> don't notice things are being drawn.
>>>
>>> Cheers.
>>>
>>> "Chris Gross" <schtoo@schtoo.com> wrote in message
>>> news:dgea4p$686$1@news.eclipse.org...
>>>> Does SWT.DOUBLE_BUFFERED essentially obsolete SWT.NO_BACKGROUND? The
>>>> benefit of SWT.NO_BACKGROUND was to reduce flicker. If
>>>> SWT.DOUBLE_BUFFERED handles that, then is there no reason to continue
>>>> to use SWT.NO_BACKGROUND?
>>>>
>>>> Also, is there any reason why I wouldn't want to use
>>>> SWT.DOUBLE_BUFFERED on pretty much any custom widget/canvas? It works
>>>> great and seems like its 'free-of-charge' but I want to verify that.
>>>>
>>>> -Chris
>>>
>
Re: SWT.DOUBLE_BUFFERED and SWT.NO_BACKGROUND [message #461727 is a reply to message #461111] Wed, 28 September 2005 15:36 Go to previous message
Veronika Irvine is currently offline Veronika IrvineFriend
Messages: 1272
Registered: July 2009
Senior Member
SWT.DOUBLE_BUFFERED is not supported on all platforms. After you create a
widget with style SWT.DOUBLE_BUFFERED, you can query the style back with
getStyle(). If double buffering is not supported on the platform, the style
will have been removed. In these cases, you may wish to create the widget
with both SWT.NO_BACKGROUND and SWT.DOUBLE_BUFFERED and use the
NO_BACKGROUND approach for platforms without double buffering.

Another thing to note is that some OSs (e.g. Mac OS X) always double buffer
and this can not be turned off. In these cases, doing your own double
buffering is a performance hit.

If you wish to have a widget that displays the default background
texture/gradient, then you should not use SWT.NO_BACKGROUND. For example,
the mac has a pin stripe default background. Currently the only way to draw
this is to let the OS draw it by default. SWT.DOUBLE_BUFFERED will draw the
default background.

When developing your widget, you may wish to turn off SWT.DOUBLE_BUFFERED
because as Joe said, double buffering hides the fact that you are doing
unnecessary work . Damaging only the affected area and drawing only what
the clipRect indicates makes complex widgets perform faster. On some
systems copying an image to the display is not very fast and the bigger the
image, the slower it is.

Cheers,
Veronika

"Chris Gross" <schtoo@schtoo.com> wrote in message
news:dgea4p$686$1@news.eclipse.org...
> Does SWT.DOUBLE_BUFFERED essentially obsolete SWT.NO_BACKGROUND? The
> benefit of SWT.NO_BACKGROUND was to reduce flicker. If
> SWT.DOUBLE_BUFFERED handles that, then is there no reason to continue to
> use SWT.NO_BACKGROUND?
>
> Also, is there any reason why I wouldn't want to use SWT.DOUBLE_BUFFERED
> on pretty much any custom widget/canvas? It works great and seems like
> its 'free-of-charge' but I want to verify that.
>
> -Chris
Previous Topic:D&D DragDetect without mouse move distance on Canvas
Next Topic:Text: highlight selected text
Goto Forum:
  


Current Time: Sat Oct 21 01:32:48 GMT 2017

Powered by FUDForum. Page generated in 0.06828 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software