Painting components in background/invisible?


#1

Hi,

is it possible to paint a component in the background if it is invisible?

I have a lot of "tabs" with hundreds of components and try to load all components on startup and just show it if it is needed to tweak the slow paintings on iOS (iPad3 Retina) or Rapberry.

Or an other idea/workaround to solve this?

Thanks


#2

I don't understand the question.. If components aren't visible then they never get painted at all (?)


#3

Sorry for the bad spelling. I found CachedComponentImage and use an Image as cache now and paint all the components in images at startup.

Thanks


#4

I'm still unclear about exactly what you're doing, but caching images is usually a bad idea because of the huge amount of memory you can waste. Better to optimise whatever you're drawing so that it's quicker.


#5

Ok, I'll try to explain my problem.

I have 7 tabs with about about 100 components (Buttons, Sliders). This components I create at app startup (invisible), but only the visible ones will be painted on startup and all the others I have to paint on it's first visible time (tab switch) - this takes about a second (on iPad3) and this is to much.

Now I render all that components in a image at startup and if the component comes visible I use that image to paint it. This takes about 0.25 secs on a tab switch (not measured, but considerably faster :-) ). All the images cost me about 5mb and thats is ok for me (app size ~15mb in ram now).

I think my painting routines are simple (e.g I use. a simplified drawRotarySlider() of your L&Fv2 implementation) and it's really not a problem on Linux, Windows or Mac - just the iPad3 with the retina display is very very slow.

Do you not think this is a solution in this case?


#6

Seems crazy that it could take 1 sec to draw a few sliders. You probably want to do some profiling and figure out exactly what's taking all the time.


#7

Did you ever use a iPad3 Retina? This device needs ~5 seconds to preview the image that you may be like to set as background  - iPad two does this in ~1sec with the same OS installed.

But I'll make a profiling to check the details.


#8

On the retina devices having an image in the optimized RGB format PNG can make a staggering difference in rendering speed. I kind of doubt that it is plain JUCE sliders, I've drawn a crapload on a retina iPad and never noticed a serious penalty. But you may find that scaling and rendering specific things is costing you dearly and a few iOS specific tweaks could make a big difference.

Good Luck!