Hy all,
i've a simple code to draw a rotating ship on a background image. Every second a receive a message with the new parameters to update the draw,
and in my main method i
call

...
QWidget::update();
drawShip(); }


Problem is that after 2 hours of activity all the system become very slow and i noticed that X process is at 99%
Is there any bug in my code ?


This is my simple code :

void Board::drawShip()
{
int X_Background_PPI;
int Y_Background_PPI;


int PPI_SIZE = 220; // is a square
int CIRCLE_OFFSET = 6; // starting point for Circle PPI

X_Background_PPI = 10 +7;
Y_Background_PPI = 358 +7;


X_Nave_PPI = X_Background_PPI + PPI_SIZE/2;
Y_Nave_PPI = Y_Background_PPI + PPI_SIZE/2 ;


QPen Pen (Qt::yellow, 4, Qt::SolidLine);
QBrush Brush (Qt::black, Qt::SolidPattern);

QPainter painter(this);
QPainter painter1(this);
QPainter painter2(this);
QPainter painter3(this);

painter.setRenderHint(QPainter::Antialiasing, true);
painter1.setRenderHint(QPainter::Antialiasing, true);

painter.drawPixmap(X_Background_PPI,Y_Background_P PI, Background_PPI); // draw the bacground


// draw the ship shape
painter1.save(); // save the current printer settings before changing them
painter1.translate(X_Nave_PPI,Y_Nave_PPI); // // the point about which the image rotates
painter1.rotate(New_Heading); //degrees;
painter1.drawPixmap(-Nave_PPI.width()/2, - Nave_PPI.height()/2, Nave_PPI );
painter1.restore(); // // restore the previous painter settings

int diameter = PPI_SIZE - 2 * CIRCLE_OFFSET ;
int diameter1 = diameter - 80 ;
int diameter3 = diameter - 180 ;

int Wx, Wy = 0;
int Wx1, Wy1 = 0;

float New_Wind_rad;

New_Wind_rad = New_Wind * grad2rad;

Wx = X_Nave_PPI + (diameter/2 * sin(New_Wind_rad) ); // in radiants !!! warning int and float
Wy = Y_Nave_PPI - (diameter/2 * cos(New_Wind_rad) ); // in radiants !!! warning int and float

Wx1 = X_Nave_PPI + (diameter1/2 * sin(New_Wind_rad) ); // in radiants !!! warning int and float
Wy1 = Y_Nave_PPI - (diameter1/2 * cos(New_Wind_rad) ); // in radiants !!! warning int and float


// draw the wind vector
painter1.save(); // save the current printer settings before changing them
painter1.translate(Wx,Wy); // // the point about which the image rotates
painter1.rotate(New_Wind); //degrees;
painter1.drawPixmap(- Wind_Arrow.width()/2,0, Wind_Arrow );
painter1.restore(); // // restore the previous painter settings
}