Skip to content

Commit a591e0d

Browse files
committed
fixed inverted pixel error
First reported on desktop processing/processing#5013
1 parent 4bfde2d commit a591e0d

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

core/src/processing/opengl/PGraphicsOpenGL.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5668,7 +5668,7 @@ protected void drawPixels(int x, int y, int w, int h) {
56685668
endPixelsOp();
56695669
} else {
56705670
// We only need to copy the pixels to the back texture where we are
5671-
// currently drawing to. Because the texture is invertex along Y, we
5671+
// currently drawing to. Because the texture is inverted along Y, we
56725672
// need to reflect that in the vertical arguments.
56735673
pgl.copyToTexture(texture.glTarget, texture.glFormat, texture.glName,
56745674
f * x, f * (height - (y + h)), f * w, f * h, nativePixelBuffer);

core/src/processing/opengl/Texture.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -340,6 +340,8 @@ public void set(int[] pixels, int x, int y, int w, int h, int format) {
340340

341341
loadPixels(w * h);
342342
convertToRGBA(pixels, format, w, h);
343+
if (invertedX) flipArrayOnX(rgbaPixels, 1);
344+
if (invertedY) flipArrayOnY(rgbaPixels, 1);
343345
updatePixelBuffer(rgbaPixels);
344346
pgl.texSubImage2D(glTarget, 0, x, y, w, h, PGL.RGBA, PGL.UNSIGNED_BYTE,
345347
pixelBuffer);

0 commit comments

Comments
 (0)