I am using a wxAutoBufferedPaintDC under wxWidgets 3.1.2 and am using dc.DrawBitmap to draw a 24bit bitmap with alpha to the DC. I am ensuring 24 bit because I have used wxDisplayDepth() to get the current display depth, based on the tip here: http://wxwidgets.10942.n7.nabble.com/Dr ... 90810.html
This drawing of this bitmap is very slow. I am drawing a bitmap as part of an animation, so speedy drawing is essential.
I have profiled it and got the following stack:
Code: Select all
6.56 s 56.3% 2.00 ms myThing::OnPaint(wxPaintEvent&)
5.83 s 50.0% 0 s wxGCDCImpl::DoDrawBitmap(wxBitmap const&, int, int, bool)
5.83 s 50.0% 0 s wxMacCoreGraphicsContext::DrawBitmap(wxBitmap const&, double, double, double, double)
5.83 s 50.0% 0 s wxOSXDrawNSImage(CGContext*, CGRect const*, NSImage*)
5.83 s 50.0% 0 s -[NSImage drawInRect:fromRect:operation:fraction:]
5.83 s 50.0% 0 s -[NSImage drawInRect:fromRect:operation:fraction:respectFlipped:hints:]
5.83 s 50.0% 0 s -[NSImage _usingBestRepresentationForRect:context:hints:body:]
5.83 s 50.0% 0 s __71-[NSImage drawInRect:fromRect:operation:fraction:respectFlipped:hints:]_block_invoke.1317
5.83 s 50.0% 0 s -[NSImageRep drawInRect:fromRect:operation:fraction:respectFlipped:hints:]
5.83 s 50.0% 0 s __74-[NSImageRep drawInRect:fromRect:operation:fraction:respectFlipped:hints:]_block_invoke
5.83 s 50.0% 0 s CGContextDrawImage
5.83 s 50.0% 0 s CGContextDrawImageWithOptions
5.83 s 50.0% 0 s CGContextDelegateDrawImage
5.83 s 50.0% 0 s backing_store_DrawImage.llvm.1028279097235270472
5.83 s 50.0% 0 s backing_store_delegate
5.83 s 49.9% 0 s __backing_store_DrawImage_block_invoke
5.83 s 49.9% 0 s CGContextDelegateDrawImage
5.83 s 49.9% 0 s ripc_DrawImage
5.82 s 49.9% 0 s ripc_RenderImage
5.82 s 49.9% 0 s RIPLayerBltImage
5.82 s 49.9% 0 s ripl_Mark
5.82 s 49.9% 0 s RGBAf16_image
5.82 s 49.9% 778.00 ms RGBAf16_image_mark(BltDepth const*, BltOp const*, _ImgOp*, MODE)
5.04 s 43.2% 5.04 s RGBAf16_sample_RGBAf_inner(_ImgOp const*, long, long, int)
Does anyone have any tips on how to improve the drawing speed for this? Or anything obvious I am missing about my bitmap construction?
All items I have found on the internet relating to this (eg. https://forums.developer.apple.com/thread/79474) seem to indicate pixel format of the bitmap but how do I control this in wxWidgets?