How to improve VirtualSurfaceImageSource performance for large images RRS feed

  • Question

  • Hello!

    I have project where i need to render large(for example 6000*9000) images with different effects(for example color inversion). Also user can zoom out images to view more than 1 image, for example 10.

    I tried to use VirtualSurfaceImageSource for rendering but it always wants to render full image(6000*9000) even if it really have size 100*300 (in zoom out mode). For zooming i use ScaleTransform. If i can render only small images it can help to improve performance because my app can load low res images much faster than hi res versions.

    Also I tried to do rendering on another thread but got an exception in IVirtualSurfaceImageSourceNative::BeginDraw.

    Maybe I need to use SwapChainBackgroundPanel to get much more flexibility and implement my own class with logic similar to VirtualSurfaceImageSource?

    Tuesday, March 11, 2014 1:27 PM

All replies

  • Hi,

    what's scenario do you want to achieve?In zoomOut view you can use other small image instead of it. I do not know why you use SwapChainBackgroundPanel instead of VirtualSurfaceImageSource. But there is a blog on describe and compare the SurfaceImageSource, SwapChainBackgroundPanel ,VirtualSurfaceImageSource you can refer to:


    Hope that can help you!

    Best Wishes!

    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey. Thanks<br/> MSDN Community Support<br/> <br/> Please remember to &quot;Mark as Answer&quot; the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    • Edited by Anne Jing Wednesday, March 12, 2014 4:04 AM edit
    Wednesday, March 12, 2014 4:03 AM
  • I continued to work with VirtualSurfaceImageSource but i have problems with it. VirtualSurfaceImageSource tries to update rects which overplap already updated area. If IVirtualSurfaceUpdatesCallbackNative can respond also to changes in visible area it will give much more flexibility.

    Now I have current logic:

    - On UpdatesNeeded get rectangles with imageSourceNative->GetUpdateRects.

    - For each rectangle check if it already start to load in another thread if not then add to queue(thich is processed by other thread which is loads parts of image because loading image parts in real time is time consuming)

    - Since on UpdatesNeeded in most cases I don't have loaded image part I fill each rectangle with white color and don't Invalidate it

    - When image is loaded it calls Invalidate on ui thread

    - Region is updated but only if it visible if it is not visible it can cause memory leaks becuse VirtualSurfaceImageSource can submit other rectangle which overlaps with that rectangle.

    So I think I need some logic for determining is new rectangle overlaps already loaded and clip out part which is not loaded and load it.

    Also it will very helpfull if I have sample with using VirtualSurfaceImageSource for app like Google Earth.

    Thursday, March 13, 2014 8:55 AM