C API: `drawRect` draws two overlapping pixels

In both the simulator and on hardware running 1.12.3, the C API drawRect appears to draw two of the same pixels multiple times. This is generally not a problem; but produces unexpected results when rendering using kColorXOR.

I am reproducing this on macOS; and haven't tried on other OS'es nor have tried this with a Lua implementation.

Steps to reproduce:

  1. Draw a rect using drawRect, with kColorXOR

Expected result:

  • The rect is fully drawn, no pixels are missing

Observed result:

  • The rect is missing the bottom left and bottom right pixels

It appears that the drawRect implementation may be drawing the same pixels multiple times; when using the XOR color, the overdraw causes these pixels to flip and be "missing" in the rendered output.


Here is display output from a sample project that does the following:

  • Draw a rect using drawRect + kColorXOR
    • Do the same, but scaled to make it easier to see the problem
  • Draw a rect "manually" using 4 drawLine calls and ensuring there is no overlapping drawing
    • Do the same, but scaled to make it easier to see the problem is resolved

2_drawRectWithXOR_image


Also, for convenience in reproducing:

  • A pre-build pdx that should run in the simulator or hardware:

  • A complete project bundle with additional comments. NOTE: This is a single source project; if the SDK is on your path you should be able to make to build it and use the produced pdx.