mori0091 / libmsx

C library for MSX
https://mori0091.github.io/libmsx/
MIT License
31 stars 2 forks source link

Wrong parameters of vdp_cmd_execute_LINE() #82

Closed mori0091 closed 1 week ago

mori0091 commented 1 week ago

Describe the bug vdp_cmd_execute_LINE() seems draw a line shifted by 1 pixel.

To Reproduce (snip)

Expected behavior vdp_cmd_execute_LINE() shall draw a line as specified.

void vdp_cmd_execute_LINE(uint16_t x1, uint16_t y1,
                          uint16_t x2, uint16_t y2,
                          uint8_t color,
                          enum vdp_cmd_logop logop) {
  struct vdp_cmd cmd;

  vdp_cmd_set_DX(&cmd, x1);
  vdp_cmd_set_DY(&cmd, y1);

  const uint16_t w = diff(x1, x2) + 1; // Is this correct?
  const uint16_t h = diff(y1, y2) + 1; // Is this correct?
  ...snip...
}

Development environment (please complete the following information):

Target Platform

Additional context