diff options
| author | James Bowman <jamesb@excamera.com> | 2021-01-22 15:52:46 -0800 |
|---|---|---|
| committer | James Bowman <jamesb@excamera.com> | 2021-01-22 15:52:46 -0800 |
| commit | dff3423c231c07751175ded39a18beef28aecd4f (patch) | |
| tree | d214b4d02c03adf556a950f627e4f3e6d512db79 /shared-module/_eve | |
| parent | 0dfa9fb7c1cf4a2b93275229b699d87490ee6390 (diff) | |
Change from fixed-point integer arguments to floating point in EVE API functions
Changed calls: PointSize(), LineWidth(), VertexTranslateX() and VertexTranslateY()
Units for all the above are now pixels, not fixed-point integers. This matches OpenGL.
Docstrings updated accordingly
Diffstat (limited to 'shared-module/_eve')
| -rw-r--r-- | shared-module/_eve/__init__.c | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/shared-module/_eve/__init__.c b/shared-module/_eve/__init__.c index d95c777dc..579729d42 100644 --- a/shared-module/_eve/__init__.c +++ b/shared-module/_eve/__init__.c @@ -226,8 +226,9 @@ void common_hal__eve_Jump(common_hal__eve_t *eve, uint32_t dest) { } -void common_hal__eve_LineWidth(common_hal__eve_t *eve, uint32_t width) { - C4(eve, ((14 << 24) | ((width & 4095)))); +void common_hal__eve_LineWidth(common_hal__eve_t *eve, mp_float_t width) { + int16_t iw = (int)(8 * width); + C4(eve, ((14 << 24) | ((iw & 4095)))); } @@ -246,8 +247,9 @@ void common_hal__eve_PaletteSource(common_hal__eve_t *eve, uint32_t addr) { } -void common_hal__eve_PointSize(common_hal__eve_t *eve, uint32_t size) { - C4(eve, ((13 << 24) | ((size & 8191)))); +void common_hal__eve_PointSize(common_hal__eve_t *eve, mp_float_t size) { + int16_t is = (int)(8 * size); + C4(eve, ((13 << 24) | ((is & 8191)))); } @@ -301,13 +303,15 @@ void common_hal__eve_Tag(common_hal__eve_t *eve, uint32_t s) { } -void common_hal__eve_VertexTranslateX(common_hal__eve_t *eve, uint32_t x) { - C4(eve, ((43 << 24) | (((x) & 131071)))); +void common_hal__eve_VertexTranslateX(common_hal__eve_t *eve, mp_float_t x) { + int16_t ix = (int)(16 * x); + C4(eve, ((43 << 24) | (ix & 131071))); } -void common_hal__eve_VertexTranslateY(common_hal__eve_t *eve, uint32_t y) { - C4(eve, ((44 << 24) | (((y) & 131071)))); +void common_hal__eve_VertexTranslateY(common_hal__eve_t *eve, mp_float_t y) { + int16_t iy = (int)(16 * y); + C4(eve, ((44 << 24) | (iy & 131071))); } |
