Scrolling problem with background using View/Scene
Hi,
I am using view/Scene architecture to show rectangels and lines with background picture.
I have drawn background in GraphicsScene::drawBackground(..) function.
To speed up rendering I have set cache background
But using this when I zoom and then scroll the content there is artifacts comes. After scrolling scene doesnt refresh property.Background image doesnt refresh.
I have tried using
Code:
GraphicsView::scrollContentsBy(int dx, int dy)
{
}
But this also doesnt refersh the screen.
I want to refresh only portion which is visible because of scrolling.
Can anybody have solution for this.
Re: Scrolling problem with background using View/Scene
How did you implement drawBackground()? What happens if you disable the cache?
Re: Scrolling problem with background using View/Scene
I have drawn background using svg render class.
If I disable the cache, and select the rectangle & move them, it becomes very slow.
So i m tring to use cache background. But with cache background it doesnt refershe the screen after zooming and then scrolling.
I want to refersh the portion of screen which is visible due to scrolling after zooming the screen.
Re: Scrolling problem with background using View/Scene
So without caching the background the output is correct? From what I understand the caching will cause a degrade in quality while zooming, because it converts the vector-based svg to a bitmap based pixmap. But I don't know if that's the effect you are experiencing.
Re: Scrolling problem with background using View/Scene
Without cache background output is correct but it slows down rendering,Also if we select rects and move them it also slows down.
Can you tell me which is faster svg rendering Or bitmap ?
Re: Scrolling problem with background using View/Scene
bitmap is definitely faster. I suggest you do your own caching - render the svg to a pixmap after each zoom using the needed pixmap size and then just draw the pixmap from within drawBackground(). Just make sure you invalidate and rerender the pixmap after each change to the zoom level. An alternative is to get rid of svg and just render to pixmap once and then use it as a background brush for your scene.