Performance issue drawing on Canvas

Performance issue drawing on Canvas

BY 23 Nov 2013 Native Application Development

I have a native game, in which I draw several bitmaps on form’s canvas.
The problem is that if I draw background bitmap on whole canvas it slows down drawing process a lot.

I do it in onDraw method of my game form:

result GameForm::OnDraw() {
    result r = E_SUCCESS;
    pCanvas->SetBackgroundColor(*backgroundColor);
    pCanvas->Clear(*rect);

    //this increases time of drawing from about 25ms to 50ms
    //  r = pCanvas->DrawBitmap(Rectangle(0, 0, this->GetWidth(), this->GetHeight()), *pBackgroundBitmap);

    //drawing some (up to 60-80) small bitmaps on pCanvas
    pLevel->draw(pCanvas);

    return r;
}

I decode Images with BITMAP_PIXEL_FORMAT_ARGB8888 option.

I also tried to add a screen-size Label with background Bitmap, but it only got worse.

Is there any way to draw background bitmap more efficiently without using openGL?

Written by