Skip to content

Commit 47c0050

Browse files
committed
Use pixelDensity from src image
1 parent 2f5380f commit 47c0050

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

core/src/processing/opengl/PGraphicsOpenGL.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6774,25 +6774,25 @@ public void copy(PImage src,
67746774
int scrX0, scrX1;
67756775
int scrY0, scrY1;
67766776
if (invX) {
6777-
scrX0 = dx + dw;
6778-
scrX1 = dx;
6777+
scrX0 = (dx + dw) / src.pixelDensity;
6778+
scrX1 = dx / src.pixelDensity;
67796779
} else {
6780-
scrX0 = dx;
6781-
scrX1 = dx + dw;
6780+
scrX0 = dx / src.pixelDensity;
6781+
scrX1 = (dx + dw) / src.pixelDensity;
67826782
}
67836783

67846784
int texX0 = sx;
67856785
int texX1 = sx + sw;
67866786
int texY0, texY1;
67876787
if (invY) {
6788-
scrY0 = height - (dy + dh);
6789-
scrY1 = height - dy;
6788+
scrY0 = height - (dy + dh) / src.pixelDensity;
6789+
scrY1 = height - dy / src.pixelDensity;
67906790
texY0 = tex.height - (sy + sh);
67916791
texY1 = tex.height - sy;
67926792
} else {
67936793
// Because drawTexture uses bottom-to-top orientation of Y axis.
6794-
scrY0 = height - dy;
6795-
scrY1 = height - (dy + dh);
6794+
scrY0 = height - dy / src.pixelDensity;
6795+
scrY1 = height - (dy + dh) / src.pixelDensity;
67966796
texY0 = sy;
67976797
texY1 = sy + sh;
67986798
}

0 commit comments

Comments
 (0)