Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[platform-swt-dev] Canvas Scrolling

Hi all,

Sorry for posting this question here, but i posted it on the newsgroup without success ...

I am trying to understand the scrolling mechanism for Canvas. I played a lot with the Snippet48 allowing to scroll into a browsed image. I understand the code of this snippet but still have a question concerning the scrolling is done.

In this sample the scrolling is realized in two stages:

- First the image is scrolled, for a scrolling to the right the current visible part of the image is translated to the left, an area on the right need to be repaint

- Next, resulting from this scroll, the area that need repainting is repainted. This is done inside the Paint listener added to the canvas

My question is the following : why the canvas is scrolled since inside the paint listener the full image is redrawn ?? (the area needed repaint is represented by e.x, e.y, e.width, e.height that are unused). Modifying the scroll bar listener to just compute new image origin and then telling the canvas to redraw results in the same way. Is there any performances issues underneath that i missed ?

Regards,

Manuel Selva


Back to the top