debugOnPaintImage top-level property

PaintImageCallback debugOnPaintImage
read / write

If not null, called when the framework is about to paint an Image to a Canvas with an ImageSizeInfo that contains the decoded size of the image as well as its output size.

A test can use this callback to detect if images under test are being rendered with the appropriate cache dimensions.

For example, if a 100x100 image is decoded it takes roughly 53kb in memory (including mipmapping overhead). If it is only ever displayed at 50x50, it would take only 13kb if the cacheHeight/cacheWidth parameters had been specified at that size. This problem becomes more serious for larger images, such as a high resolution image from a 12MP camera, which would be 64mb when decoded.

When using this callback, developers should consider whether the image will be panned or scaled up in the application, how many images are being displayed, and whether the application will run on multiple devices with different resolutions and memory capacities. For example, it should be fine to have an image that animates from thumbnail size to full screen be at a higher resolution while animating, but it would be problematic to have a grid or list of such thumbnails all be at the full resolution at the same time.

Implementation

PaintImageCallback debugOnPaintImage