mirror of
https://github.com/processing/processing4.git
synced 2026-06-16 04:26:26 +02:00
fixes loadPixels() regression in opengl renderer
This commit is contained in:
@@ -6250,11 +6250,15 @@ public class PGraphicsOpenGL extends PGraphics {
|
||||
|
||||
protected void updateTexture(PImage img, Texture tex) {
|
||||
if (tex != null) {
|
||||
int x = img.getModifiedX1();
|
||||
int y = img.getModifiedY1();
|
||||
int w = img.getModifiedX2() - x;
|
||||
int h = img.getModifiedY2() - y;
|
||||
tex.set(img.pixels, x, y, w, h, img.format);
|
||||
if (img.isModified()) {
|
||||
int x = img.getModifiedX1();
|
||||
int y = img.getModifiedY1();
|
||||
int w = img.getModifiedX2() - x;
|
||||
int h = img.getModifiedY2() - y;
|
||||
tex.set(img.pixels, x, y, w, h, img.format);
|
||||
} else if (img.isLoaded()) {
|
||||
tex.set(img.pixels, 0, 0, img.width, img.height, img.format);
|
||||
}
|
||||
}
|
||||
img.setModified(false);
|
||||
img.setLoaded(false);
|
||||
|
||||
@@ -329,8 +329,7 @@ public class Texture implements PConstants {
|
||||
return;
|
||||
}
|
||||
|
||||
if (pixels.length == 0) {
|
||||
// Nothing to do (means that w == h == 0) but not an erroneous situation
|
||||
if (pixels.length == 0 || w == 0 || h == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user