Unfortunately there is no straightforward way to construct an Image of type RGB whose pixelStride matches the pixelStride of backbuffers used to draw the ComponentPeer. This would be a useful function because it would improve the performance of Graphics::drawImageAt
The good news is that this is quite a straightforward change, and I’ve outlined the details here:
Add a function static Image::getNativeRGBPixelStride which returns 3 or 4 depending on the video card. This would be platform specific. On Windows we would move the code out of WindowsBitmapImage and into this function.
Add or modify SoftwarePixelData constructor to take a pixelStride parameter.
Change all instances NativeImageType::create to create the SoftwarePixelData with a pixelStride from the return value of getNativeRGBPixelStride.
Optionally add a new function static Image::createNativeRGBImage which returns an empty RGB image using NativeImageType and the specified width, height, and clearContents flag.
#4 is needed because there is no handy Image constructor that takes a pixelStride parameter, and also for convenience - anyone who wants to optimize their image drawing just needs to switch over to calling this new function instead of using operator new directly.