The width/height check in MultiResolutionRenderer.checkResize compares the width/height of the image scaled by the screen scale to the component width/height
As a result, when screenScales[0] != 1.0, new images are created with every paint request.
To re-produce, modify MultiResolutionRenderer.checkResize to:
final double screenToViewerScale = screenScales[ i ];
final int w = ( int ) ( screenToViewerScale * componentW );
final int h = ( int ) ( screenToViewerScale * componentH );
System.out.println(String.format("Resizing images: w=%d (%d), h=%d (%d) for scale %f", w, componentW, h, componentH, screenToViewerScale));
and run this main method:
public static void main(String[] args) {
ArrayImg<UnsignedByteType, ByteArray> rai = ArrayImgs.unsignedBytes(100, 200, 300);
new Random(100).nextBytes(rai.update(null).getCurrentStorageArray());
BdvFunctions.show(rai, "noise", BdvOptions.options().screenScales(new double[] {0.5, 0.25, 0.125}));
}
The width/height check in
MultiResolutionRenderer.checkResize
compares the width/height of the image scaled by the screen scale to the component width/heightwhen instead, it should compare the width/height of the image compared to the scaled component width height:
As a result, when
screenScales[0] != 1.0
, new images are created with every paint request. To re-produce, modifyMultiResolutionRenderer.checkResize
to:and run this main method: