I think there are two points that may affect the gfx performance:
1. drawPolygon(Point[] p)
When drawing I need convert my model to Point[], then be converted to SWT expected model. So, drawPolygon(Int[] coord), drawPolygon(Int[] xs, Int[] ys), drawPolygon(Buf buf) will be more efficient.
2. Image makePainted(Size size, |Graphics| f)
Consider the double buffer animation, each frame we need call makePainted(). This means that frequently delete old images and create a new image.
brianMon 16 May 2011
So, drawPolygon(Int[] coord), drawPolygon(Int[] xs, Int[] ys), drawPolygon(Buf buf) will be more efficient.
I don't actually think that will be anymore efficient because instead of allocating one Point object per point, it will require boxing two Ints.
Consider the double buffer animation, each frame we need call makePainted(). This means that frequently delete old images and create a new image.
Yes we considered this, but decided for simplicity sake to keep it a simple static factory. The problem is that otherwise we have to figure out how to make Image mutable which is a really big addition in complexity. I think a simpler way to handle the double buffered issue is to just make it a flag on Canvas.
go4 Sat 14 May 2011
I think there are two points that may affect the gfx performance:
1. drawPolygon(Point[] p)
When drawing I need convert my model to Point[], then be converted to SWT expected model. So,
drawPolygon(Int[] coord)
,drawPolygon(Int[] xs, Int[] ys)
,drawPolygon(Buf buf)
will be more efficient.2. Image makePainted(Size size, |Graphics| f)
Consider the double buffer animation, each frame we need call
makePainted()
. This means that frequently delete old images and create a new image.brian Mon 16 May 2011
I don't actually think that will be anymore efficient because instead of allocating one Point object per point, it will require boxing two Ints.
Yes we considered this, but decided for simplicity sake to keep it a simple static factory. The problem is that otherwise we have to figure out how to make Image mutable which is a really big addition in complexity. I think a simpler way to handle the double buffered issue is to just make it a flag on Canvas.
go4 Wed 18 May 2011
Thanks. Built-in buffer is OK for me.