Skip to content

Gerbview: fix negative objects and implement differential mode

Mike Williams requested to merge mikebwilliams/kicad:gerbview_xor into master

Various issues have requested XOR differential mode: #4495 (closed) #8428 (closed)

There were numerous fundamental issues with the patch from 8428, so I abandoned it and started with a new method.

The way this works is the XOR'd layers are drawn normally one at a time onto a separate rendering layer. After each layer is done, the layer is XOR'd to the main buffer, the separate layer is cleared, and the next layer is drawn. If we didn't use a separate layer, the graphics items overdraw themselves to weird effect.

Known Bugs:

  • Switching graphics modes might require you to re-toggle differential mode
  • OpenGL is dimmer than Cairo. Also kind of flickery when the frame resizes.
  • DCodes are busted
  • Sometimes have to double-click on the layer item to get it to appear, esp. in OpenGL mode

Maybe Bugs:

  • It's quite slow on Cairo when XOR mode is enabled
  • Cairo's XOR mode is not a bitwise XOR, I used _ADD as the compositing operator, it looks correct.
  • There are some general rendering bugs in Gerbview, e.g. #1863 (closed), these may interact in strange ways with the XORing

Questions:

  • Is this approach the right way? I'm not a graphics person at all. I drew a triangle in OpenGL, once.
Edited by Mike Williams

Merge request reports