Repaint performance issue on iOS (iPad3)


#1

Hi,

I have a performance problem on iPad3 with the user interface refresh (but also if I do not use only one image, only FilledRectangle and so on...)

I just like to paint a component with repaint(0,0,width,height) methode of the component and every time the parents/owner paint(Graphics&) methode will be also called and paint all the other stuff.

Is there a way to just call the paint methode of the component in iOS?

Or do I something wrong?

Thanks.


#2

The only idea that I have to solve that problem is to split the interface in smaller parts with child components and control manually if a paint is required or not. But this is a lot of work.

What is your opinion? Is there a easyer way?


#3

have you tried setOpaque(true) on your child component ?

Unless your component is opaque, you need to repaint your parent as well for transparency to work. This is the default in Juce.


#4

Thanks.

Yes, I've tried setOpaque(true). But looks very ugly.

If also setBufferedToImage(true) setted, the components looks like the top view on the attached picture. If only setOpaque(true) is setted it looks like the bottom on the pic.


#5

It's only "ugly" because you're not using it appropriately. Read the docs for setOpaque!


#6

Ok, now I understand the opaque thing.

My solution to only repaint slider and the slider bg (a little bit crazy but it works):

class SliderWrapper : public Component
{
protected:
  Slider* slider;

  SliderWrapper()
  {
    setOpaque(true);
    // init slider and other stuff
  }

private:
  void paint( Graphics& g ) override
  {
    // paint only the bg for the size of the slider
  }

  // other wrapper stuff
}

Is there a more easy solution?

Thanks.


#7

Or just make sure you set an opaque colour for Slider::backgroundColourId?


#8

Good idea but does not work. Looks like the black version at the pictures.