Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Right approach to enable SWT hardware acceleration(Best coding approach to have SWT hardware accelerated as much as possible)
Right approach to enable SWT hardware acceleration [message #1696915] Fri, 29 May 2015 11:17 Go to next message
Leung Wang Hei is currently offline Leung Wang HeiFriend
Messages: 64
Registered: July 2010
Member
On Windows, I understand that SWT delegates rendering to the GDI and GDI+.

According to https://www.eclipse.org/forums/index.php?t=msg&th=152875&goto=481944&#msg_481944, operation done via GDI is accelerated while those on GDI+ is not.

Does that implies we should set GC advanced to false as soon as possible after the advanced drawing (e.g. setAlpha)? Does it implies drawing after turning off GC Advanced is done via GDI and hardward accelerated?

I found this code in StyledText. Is it the recommended approach for every call to the advanced function like setAlpha, setAntialias?

if (gc.getAdvanced()) {
			gc.setAlpha(100);
			gc.fillRectangle(rect);
			gc.setAdvanced(false);
		}
Re: Right approach to enable SWT hardware acceleration [message #1697463 is a reply to message #1696915] Thu, 04 June 2015 07:34 Go to previous messageGo to next message
Niraj Modi is currently offline Niraj ModiFriend
Messages: 48
Registered: November 2013
Member
Does that implies we should set GC advanced to false as soon as possible after the advanced drawing (e.g. setAlpha)? Does it implies drawing after turning off GC Advanced is done via GDI and hardward accelerated?
>> As soon you set GC#setAdvence(false), the advanced graphics subsystem is no longer used, advanced graphics state is cleared and the normal graphics subsystem "GDI" is used from now on, which is hardware accelerated.

I found this code in StyledText. Is it the recommended approach for every call to the advanced function like setAlpha, setAntialias?
>> Normally, the advanced graphics subsystem is invoked automatically when any one of the alpha, antialias, patterns, interpolation, paths, clipping or transformation operations in the receiver is requested.
>> When you don't need GDI+, it's better to turn Advance function 'off' as we do in StyledText.java
Re: Right approach to enable SWT hardware acceleration [message #1697565 is a reply to message #1697463] Fri, 05 June 2015 01:23 Go to previous message
Leung Wang Hei is currently offline Leung Wang HeiFriend
Messages: 64
Registered: July 2010
Member
Thanks for your reply Modi.

What would be the best approach to measure graphical performance to ensure the hardware acceleration is enabled?
Previous Topic:Browser.setUrl(String, String, String[]) not sending post data
Next Topic:drawImage directly to browser <image>
Goto Forum:
  


Current Time: Mon Jan 18 17:43:53 GMT 2021

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

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

Back to the top