Skip to content
Permalink
Browse files

8251167: Drawing polyline twice in XOR mode leaves out some traces on…

… screen (only with uiScale=1.0)
  • Loading branch information
aghaisas committed Aug 5, 2020
1 parent 108d174 commit 47f6e1bd6b5d8c5fbb1b3e3eb3c9a7d5cf3d54b6
Showing with 21 additions and 7 deletions.
  1. +21 −7 src/java.desktop/macosx/native/libawt_lwawt/java2d/metal/MTLRenderQueue.m
@@ -414,19 +414,33 @@ void MTLRenderQueue_CheckPreviousOp(jint op) {
case sun_java2d_pipe_BufferedOpCodes_DRAW_POLY:
{
CHECK_PREVIOUS_OP(MTL_OP_OTHER);

if ([mtlc useXORComposite]) {
commitEncodedCommands();
J2dTraceLn(J2D_TRACE_VERBOSE, "DRAW_POLY in XOR mode - Force commit earlier draw calls before DRAW_POLY.");
}

jint nPoints = NEXT_INT(b);
jboolean isClosed = NEXT_BOOLEAN(b);
jint transX = NEXT_INT(b);
jint transY = NEXT_INT(b);
jint *xPoints = (jint *)b;
jint *yPoints = ((jint *)b) + nPoints;
MTLRenderer_DrawPoly(mtlc, dstOps, nPoints, isClosed, transX, transY, xPoints, yPoints);

if ([mtlc useXORComposite]) {
commitEncodedCommands();
J2dTraceLn(J2D_TRACE_VERBOSE, "DRAW_POLY in XOR mode - Force commit earlier draw calls before DRAW_POLY.");

// draw separate (N-1) lines using N points
for(int point = 0; point < nPoints-1; point++) {
jint x1 = xPoints[point] + transX;
jint y1 = yPoints[point] + transY;
jint x2 = xPoints[point + 1] + transX;
jint y2 = yPoints[point + 1] + transY;
MTLRenderer_DrawLine(mtlc, dstOps, x1, y1, x2, y2);
}

if (isClosed) {
MTLRenderer_DrawLine(mtlc, dstOps, xPoints[0] + transX, yPoints[0] + transY, xPoints[nPoints-1] + transX, yPoints[nPoints-1] + transY);
}
} else {
MTLRenderer_DrawPoly(mtlc, dstOps, nPoints, isClosed, transX, transY, xPoints, yPoints);
}

SKIP_BYTES(b, nPoints * BYTES_PER_POLY_POINT);
}
break;

0 comments on commit 47f6e1b

Please sign in to comment.