Skip to content

Commit e071bb1

Browse files
authored
Merge pull request #433 from codeanticode/filter-density
2 parents f6e32da + 938fbda commit e071bb1

1 file changed

Lines changed: 8 additions & 9 deletions

File tree

core/src/processing/opengl/PGraphicsOpenGL.java

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6154,25 +6154,25 @@ public void copy(PImage src,
61546154
int scrX0, scrX1;
61556155
int scrY0, scrY1;
61566156
if (invX) {
6157-
scrX0 = dx + dw;
6158-
scrX1 = dx;
6157+
scrX0 = (dx + dw) / src.pixelDensity;
6158+
scrX1 = dx / src.pixelDensity;
61596159
} else {
6160-
scrX0 = dx;
6161-
scrX1 = dx + dw;
6160+
scrX0 = dx / src.pixelDensity;
6161+
scrX1 = (dx + dw) / src.pixelDensity;
61626162
}
61636163

61646164
int texX0 = sx;
61656165
int texX1 = sx + sw;
61666166
int texY0, texY1;
61676167
if (invY) {
6168-
scrY0 = height - (dy + dh);
6169-
scrY1 = height - dy;
6168+
scrY0 = height - (dy + dh) / src.pixelDensity;
6169+
scrY1 = height - dy / src.pixelDensity;
61706170
texY0 = tex.height - (sy + sh);
61716171
texY1 = tex.height - sy;
61726172
} else {
61736173
// Because drawTexture uses bottom-to-top orientation of Y axis.
6174-
scrY0 = height - dy;
6175-
scrY1 = height - (dy + dh);
6174+
scrY0 = height - dy / src.pixelDensity;
6175+
scrY1 = height - (dy + dh) / src.pixelDensity;
61766176
texY0 = sy;
61776177
texY1 = sy + sh;
61786178
}
@@ -6182,7 +6182,6 @@ public void copy(PImage src,
61826182
texX0, texY0, texX1, texY1,
61836183
scrX0, scrY0, scrX1, scrY1);
61846184

6185-
61866185
if (needEndDraw) {
61876186
endDraw();
61886187
}

0 commit comments

Comments
 (0)