Fix resizing targets for async save

Got burned by not setting pixelWidth and pixelHeight properly.

Fixes #4578
This commit is contained in:
Jakub Valtar
2016-08-06 15:23:08 +02:00
parent a223822949
commit 2ea9758dc2
+3 -5
View File
@@ -8364,12 +8364,10 @@ public class PGraphics extends PImage implements PConstants {
targetsCreated++;
} else {
target = targetPool.take();
if (target.width != requestedWidth ||
target.height != requestedHeight) {
target.width = requestedWidth;
target.height = requestedHeight;
if (target.pixelWidth != requestedWidth ||
target.pixelHeight != requestedHeight) {
// TODO: this kills performance when saving different sizes
target.pixels = new int[requestedWidth * requestedHeight];
target = new PImage(requestedWidth, requestedHeight);
}
}
target.format = format;