Draw a VSIS bitmap on an invisible area

I am trying to create a windowsRT application based on flipview, where each flipview element (page in my application terminology) is a VSIS image. According to VSIS design, whenever any image falls into the visible area, the updateseded VSIS function is called and draws a bitmap for me.

As an improvement, I want to cache the image / bitmap of the next page, which will be displayed if the user clicks on the next button. To do this, I call the invalidate function of the corresponding VSIS in another thread, hoping that this will make the bitmap in the background (by calling UpdatesNeeded), and when the user clicks the next button, the image will be ready to be displayed.

But it seems that the invalidate function does not call the updateneeded callback when VSIS is not in the visible area, and therefore my caching scheme does not work. Is there a way / workaround for the same? I know the page / image sizes in advance, so getting fixes for vsis is not a problem. Moreover, my updateneeded function will return if the bitmap is already displayed, that when the image enters the visible area and is called updateneeded, VSIS will not need to redraw the entire image again.

+4
source share
1 answer

I have found a solution. In fact, it was wrong on my side to assume that the UpdatesNeeded function UpdatesNeeded be called even when my image was not in the visible area. So instead, I executed my own PreCacheImage function. When called, this function creates an ID2D1Bitmap image and saves it. And when the UpdatesNeeded function is UpdatesNeeded (when the image becomes visible), I check if my bitmap is valid, and if so, I just paste it onto the screen.

0
source

Source: https://habr.com/ru/post/1484508/


All Articles