Right approach to enable SWT hardware acceleration [message #1696915] |
Fri, 29 May 2015 07:17  |
Eclipse User |
|
|
|
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 03:34   |
Eclipse User |
|
|
|
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
|
|
|
|
Powered by
FUDForum. Page generated in 0.26854 seconds