Skip to content

Commit 2dc5c9c

Browse files
committed
scale by pixel density to coordinates are consistent
1 parent 76f2205 commit 2dc5c9c

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
@@ -6153,25 +6153,25 @@ public void copy(PImage src,
61536153
int scrX0, scrX1;
61546154
int scrY0, scrY1;
61556155
if (invX) {
6156-
scrX0 = dx + dw;
6157-
scrX1 = dx;
6156+
scrX0 = (dx + dw) / pixelDensity;
6157+
scrX1 = dx / pixelDensity;
61586158
} else {
6159-
scrX0 = dx;
6160-
scrX1 = dx + dw;
6159+
scrX0 = dx / pixelDensity;
6160+
scrX1 = (dx + dw) / pixelDensity;
61616161
}
61626162

61636163
int texX0 = sx;
61646164
int texX1 = sx + sw;
61656165
int texY0, texY1;
61666166
if (invY) {
6167-
scrY0 = height - (dy + dh);
6168-
scrY1 = height - dy;
6167+
scrY0 = height - (dy + dh) / pixelDensity;
6168+
scrY1 = height - dy / pixelDensity;
61696169
texY0 = tex.height - (sy + sh);
61706170
texY1 = tex.height - sy;
61716171
} else {
61726172
// Because drawTexture uses bottom-to-top orientation of Y axis.
6173-
scrY0 = height - dy;
6174-
scrY1 = height - (dy + dh);
6173+
scrY0 = height - dy / pixelDensity;
6174+
scrY1 = height - (dy + dh) / pixelDensity;
61756175
texY0 = sy;
61766176
texY1 = sy + sh;
61776177
}

0 commit comments

Comments
 (0)