Correct the BitmapTransform operations.

Correct argument order
better argument naming
fix copypaste bug on C and F arguments
crypto-aes
James Bowman 3 years ago
parent 1f44029c56
commit a87dee2f66
  1. 58
      shared-bindings/_eve/__init__.c
  2. 12
      shared-bindings/_eve/__init__.h
  3. 71
      shared-module/_eve/__init__.c

@ -268,13 +268,15 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(bitmapswizzle_obj, 5, 5, _bitmapswizz
//| :param int p: precision control: 0 is 8.8, 1 is 1.15. Range 0-1. The initial value is 0
//| :param int v: The :math:`a` component of the bitmap transform matrix, in signed 8.8 or 1.15 bit fixed-point form. Range 0-131071. The initial value is 256
//|
//| The initial value is **p** = 0, **v** = 256. This represents the value 1.0.
//|
//| These values are part of the graphics context and are saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.
//|
STATIC mp_obj_t _bitmaptransforma(mp_obj_t self, mp_obj_t a0, mp_obj_t a1) {
uint32_t a = mp_obj_get_int_truncated(a0);
uint32_t p = mp_obj_get_int_truncated(a1);
common_hal__eve_BitmapTransformA(EVEHAL(self), a, p);
uint32_t p = mp_obj_get_int_truncated(a0);
uint32_t v = mp_obj_get_int_truncated(a1);
common_hal__eve_BitmapTransformA(EVEHAL(self), p, v);
return mp_const_none;
}
STATIC MP_DEFINE_CONST_FUN_OBJ_3(bitmaptransforma_obj, _bitmaptransforma);
@ -286,33 +288,34 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_3(bitmaptransforma_obj, _bitmaptransforma);
//| :param int p: precision control: 0 is 8.8, 1 is 1.15. Range 0-1. The initial value is 0
//| :param int v: The :math:`b` component of the bitmap transform matrix, in signed 8.8 or 1.15 bit fixed-point form. Range 0-131071. The initial value is 0
//|
//| The initial value is **p** = 0, **v** = 0. This represents the value 0.0.
//|
//| These values are part of the graphics context and are saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.
//|
STATIC mp_obj_t _bitmaptransformb(mp_obj_t self, mp_obj_t a0, mp_obj_t a1) {
uint32_t b = mp_obj_get_int_truncated(a0);
uint32_t p = mp_obj_get_int_truncated(a1);
common_hal__eve_BitmapTransformB(EVEHAL(self), b, p);
uint32_t p = mp_obj_get_int_truncated(a0);
uint32_t v = mp_obj_get_int_truncated(a1);
common_hal__eve_BitmapTransformB(EVEHAL(self), p, v);
return mp_const_none;
}
STATIC MP_DEFINE_CONST_FUN_OBJ_3(bitmaptransformb_obj, _bitmaptransformb);
//| .. method:: BitmapTransformC(c)
//| .. method:: BitmapTransformC(v)
//|
//| Set the :math:`c` component of the bitmap transform matrix
//|
//| :param int c: The :math:`c` component of the bitmap transform matrix, in signed 15.8 bit fixed-point form. Range 0-16777215. The initial value is 0
//| :param int v: The :math:`c` component of the bitmap transform matrix, in signed 15.8 bit fixed-point form. Range 0-16777215. The initial value is 0
//|
//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.
//|
STATIC mp_obj_t _bitmaptransformc(mp_obj_t self, mp_obj_t a0, mp_obj_t a1) {
uint32_t c = mp_obj_get_int_truncated(a0);
uint32_t p = mp_obj_get_int_truncated(a1);
common_hal__eve_BitmapTransformC(EVEHAL(self), c, p);
STATIC mp_obj_t _bitmaptransformc(mp_obj_t self, mp_obj_t a0) {
uint32_t v = mp_obj_get_int_truncated(a0);
common_hal__eve_BitmapTransformC(EVEHAL(self), v);
return mp_const_none;
}
STATIC MP_DEFINE_CONST_FUN_OBJ_3(bitmaptransformc_obj, _bitmaptransformc);
STATIC MP_DEFINE_CONST_FUN_OBJ_2(bitmaptransformc_obj, _bitmaptransformc);
//| .. method:: BitmapTransformD(p, v)
//|
@ -321,13 +324,15 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_3(bitmaptransformc_obj, _bitmaptransformc);
//| :param int p: precision control: 0 is 8.8, 1 is 1.15. Range 0-1. The initial value is 0
//| :param int v: The :math:`d` component of the bitmap transform matrix, in signed 8.8 or 1.15 bit fixed-point form. Range 0-131071. The initial value is 0
//|
//| The initial value is **p** = 0, **v** = 0. This represents the value 0.0.
//|
//| These values are part of the graphics context and are saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.
//|
STATIC mp_obj_t _bitmaptransformd(mp_obj_t self, mp_obj_t a0, mp_obj_t a1) {
uint32_t d = mp_obj_get_int_truncated(a0);
uint32_t p = mp_obj_get_int_truncated(a1);
common_hal__eve_BitmapTransformD(EVEHAL(self), d, p);
uint32_t p = mp_obj_get_int_truncated(a0);
uint32_t v = mp_obj_get_int_truncated(a1);
common_hal__eve_BitmapTransformD(EVEHAL(self), p, v);
return mp_const_none;
}
STATIC MP_DEFINE_CONST_FUN_OBJ_3(bitmaptransformd_obj, _bitmaptransformd);
@ -339,33 +344,34 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_3(bitmaptransformd_obj, _bitmaptransformd);
//| :param int p: precision control: 0 is 8.8, 1 is 1.15. Range 0-1. The initial value is 0
//| :param int v: The :math:`e` component of the bitmap transform matrix, in signed 8.8 or 1.15 bit fixed-point form. Range 0-131071. The initial value is 256
//|
//| The initial value is **p** = 0, **v** = 256. This represents the value 1.0.
//|
//| These values are part of the graphics context and are saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.
//|
STATIC mp_obj_t _bitmaptransforme(mp_obj_t self, mp_obj_t a0, mp_obj_t a1) {
uint32_t e = mp_obj_get_int_truncated(a0);
uint32_t p = mp_obj_get_int_truncated(a1);
common_hal__eve_BitmapTransformE(EVEHAL(self), e, p);
uint32_t p = mp_obj_get_int_truncated(a0);
uint32_t v = mp_obj_get_int_truncated(a1);
common_hal__eve_BitmapTransformE(EVEHAL(self), p, v);
return mp_const_none;
}
STATIC MP_DEFINE_CONST_FUN_OBJ_3(bitmaptransforme_obj, _bitmaptransforme);
//| .. method:: BitmapTransformF(f)
//| .. method:: BitmapTransformF(v)
//|
//| Set the :math:`f` component of the bitmap transform matrix
//|
//| :param int f: The :math:`f` component of the bitmap transform matrix, in signed 15.8 bit fixed-point form. Range 0-16777215. The initial value is 0
//| :param int v: The :math:`f` component of the bitmap transform matrix, in signed 15.8 bit fixed-point form. Range 0-16777215. The initial value is 0
//|
//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.
//|
STATIC mp_obj_t _bitmaptransformf(mp_obj_t self, mp_obj_t a0, mp_obj_t a1) {
uint32_t f = mp_obj_get_int_truncated(a0);
uint32_t p = mp_obj_get_int_truncated(a1);
common_hal__eve_BitmapTransformF(EVEHAL(self), f, p);
STATIC mp_obj_t _bitmaptransformf(mp_obj_t self, mp_obj_t a0) {
uint32_t v = mp_obj_get_int_truncated(a0);
common_hal__eve_BitmapTransformF(EVEHAL(self), v);
return mp_const_none;
}
STATIC MP_DEFINE_CONST_FUN_OBJ_3(bitmaptransformf_obj, _bitmaptransformf);
STATIC MP_DEFINE_CONST_FUN_OBJ_2(bitmaptransformf_obj, _bitmaptransformf);
//| .. method:: BlendFunc(src, dst)
//|

@ -41,12 +41,12 @@ void common_hal__eve_BitmapSizeH(common_hal__eve_t *eve, uint32_t width, uint32_
void common_hal__eve_BitmapSize(common_hal__eve_t *eve, uint32_t filter, uint32_t wrapx, uint32_t wrapy, uint32_t width, uint32_t height);
void common_hal__eve_BitmapSource(common_hal__eve_t *eve, uint32_t addr);
void common_hal__eve_BitmapSwizzle(common_hal__eve_t *eve, uint32_t r, uint32_t g, uint32_t b, uint32_t a);
void common_hal__eve_BitmapTransformA(common_hal__eve_t *eve, uint32_t a, uint32_t p);
void common_hal__eve_BitmapTransformB(common_hal__eve_t *eve, uint32_t b, uint32_t p);
void common_hal__eve_BitmapTransformC(common_hal__eve_t *eve, uint32_t c, uint32_t p);
void common_hal__eve_BitmapTransformD(common_hal__eve_t *eve, uint32_t d, uint32_t p);
void common_hal__eve_BitmapTransformE(common_hal__eve_t *eve, uint32_t e, uint32_t p);
void common_hal__eve_BitmapTransformF(common_hal__eve_t *eve, uint32_t f, uint32_t p);
void common_hal__eve_BitmapTransformA(common_hal__eve_t *eve, uint32_t p, uint32_t v);
void common_hal__eve_BitmapTransformB(common_hal__eve_t *eve, uint32_t p, uint32_t v);
void common_hal__eve_BitmapTransformC(common_hal__eve_t *eve, uint32_t v);
void common_hal__eve_BitmapTransformD(common_hal__eve_t *eve, uint32_t p, uint32_t v);
void common_hal__eve_BitmapTransformE(common_hal__eve_t *eve, uint32_t p, uint32_t v);
void common_hal__eve_BitmapTransformF(common_hal__eve_t *eve, uint32_t v);
void common_hal__eve_BlendFunc(common_hal__eve_t *eve, uint32_t src, uint32_t dst);
void common_hal__eve_Call(common_hal__eve_t *eve, uint32_t dest);
void common_hal__eve_Cell(common_hal__eve_t *eve, uint32_t cell);

@ -80,190 +80,237 @@ void common_hal__eve_AlphaFunc(common_hal__eve_t *eve, uint32_t func, uint32_t r
C4(eve, ((9 << 24) | ((func & 7) << 8) | ((ref & 255))));
}
void common_hal__eve_Begin(common_hal__eve_t *eve, uint32_t prim) {
C4(eve, ((31 << 24) | ((prim & 15))));
}
void common_hal__eve_BitmapExtFormat(common_hal__eve_t *eve, uint32_t fmt) {
C4(eve, ((46 << 24) | (fmt & 65535)));
}
void common_hal__eve_BitmapHandle(common_hal__eve_t *eve, uint32_t handle) {
C4(eve, ((5 << 24) | ((handle & 31))));
}
void common_hal__eve_BitmapLayoutH(common_hal__eve_t *eve, uint32_t linestride, uint32_t height) {
C4(eve, ((40 << 24) | (((linestride) & 3) << 2) | (((height) & 3))));
}
void common_hal__eve_BitmapLayout(common_hal__eve_t *eve, uint32_t format, uint32_t linestride, uint32_t height) {
C4(eve, ((7 << 24) | ((format & 31) << 19) | ((linestride & 1023) << 9) | ((height & 511))));
}
void common_hal__eve_BitmapSizeH(common_hal__eve_t *eve, uint32_t width, uint32_t height) {
C4(eve, ((41 << 24) | (((width) & 3) << 2) | (((height) & 3))));
}
void common_hal__eve_BitmapSize(common_hal__eve_t *eve, uint32_t filter, uint32_t wrapx, uint32_t wrapy, uint32_t width, uint32_t height) {
C4(eve, ((8 << 24) | ((filter & 1) << 20) | ((wrapx & 1) << 19) | ((wrapy & 1) << 18) | ((width & 511) << 9) | ((height & 511))));
}
void common_hal__eve_BitmapSource(common_hal__eve_t *eve, uint32_t addr) {
C4(eve, ((1 << 24) | ((addr & 0xffffff))));
}
void common_hal__eve_BitmapSwizzle(common_hal__eve_t *eve, uint32_t r, uint32_t g, uint32_t b, uint32_t a) {
C4(eve, ((47 << 24) | ((r & 7) << 9) | ((g & 7) << 6) | ((b & 7) << 3) | ((a & 7))));
}
void common_hal__eve_BitmapTransformA(common_hal__eve_t *eve, uint32_t a, uint32_t p) {
C4(eve, ((21 << 24) | ((p & 1) << 17) | ((a & 131071))));
void common_hal__eve_BitmapTransformA(common_hal__eve_t *eve, uint32_t p, uint32_t v) {
C4(eve, ((21 << 24) | ((p & 1) << 17) | ((v & 131071))));
}
void common_hal__eve_BitmapTransformB(common_hal__eve_t *eve, uint32_t b, uint32_t p) {
C4(eve, ((22 << 24) | ((p & 1) << 17) | ((b & 131071))));
void common_hal__eve_BitmapTransformB(common_hal__eve_t *eve, uint32_t p, uint32_t v) {
C4(eve, ((22 << 24) | ((p & 1) << 17) | ((v & 131071))));
}
void common_hal__eve_BitmapTransformC(common_hal__eve_t *eve, uint32_t c, uint32_t p) {
C4(eve, ((23 << 24) | ((p & 1) << 17) | ((c & 16777215))));
void common_hal__eve_BitmapTransformC(common_hal__eve_t *eve, uint32_t v) {
C4(eve, ((23 << 24) | ((v & 16777215))));
}
void common_hal__eve_BitmapTransformD(common_hal__eve_t *eve, uint32_t d, uint32_t p) {
C4(eve, ((24 << 24) | ((p & 1) << 17) | ((d & 131071))));
void common_hal__eve_BitmapTransformD(common_hal__eve_t *eve, uint32_t p, uint32_t v) {
C4(eve, ((24 << 24) | ((p & 1) << 17) | ((v & 131071))));
}
void common_hal__eve_BitmapTransformE(common_hal__eve_t *eve, uint32_t e, uint32_t p) {
C4(eve, ((25 << 24) | ((p & 1) << 17) | ((e & 131071))));
void common_hal__eve_BitmapTransformE(common_hal__eve_t *eve, uint32_t p, uint32_t v) {
C4(eve, ((25 << 24) | ((p & 1) << 17) | ((v & 131071))));
}
void common_hal__eve_BitmapTransformF(common_hal__eve_t *eve, uint32_t f, uint32_t p) {
C4(eve, ((26 << 24) | ((p & 1) << 17) | ((f & 16777215))));
void common_hal__eve_BitmapTransformF(common_hal__eve_t *eve, uint32_t v) {
C4(eve, ((26 << 24) | ((v & 16777215))));
}
void common_hal__eve_BlendFunc(common_hal__eve_t *eve, uint32_t src, uint32_t dst) {
C4(eve, ((11 << 24) | ((src & 7) << 3) | ((dst & 7))));
}
void common_hal__eve_Call(common_hal__eve_t *eve, uint32_t dest) {
C4(eve, ((29 << 24) | ((dest & 65535))));
}
void common_hal__eve_Cell(common_hal__eve_t *eve, uint32_t cell) {
C4(eve, ((6 << 24) | ((cell & 127))));
}
void common_hal__eve_ClearColorA(common_hal__eve_t *eve, uint32_t alpha) {
C4(eve, ((15 << 24) | ((alpha & 255))));
}
void common_hal__eve_ClearColorRGB(common_hal__eve_t *eve, uint32_t red, uint32_t green, uint32_t blue) {
C4(eve, ((2 << 24) | ((red & 255) << 16) | ((green & 255) << 8) | ((blue & 255))));
}
void common_hal__eve_Clear(common_hal__eve_t *eve, uint32_t c, uint32_t s, uint32_t t) {
C4(eve, ((38 << 24) | ((c & 1) << 2) | ((s & 1) << 1) | ((t & 1))));
}
void common_hal__eve_ClearStencil(common_hal__eve_t *eve, uint32_t s) {
C4(eve, ((17 << 24) | ((s & 255))));
}
void common_hal__eve_ClearTag(common_hal__eve_t *eve, uint32_t s) {
C4(eve, ((18 << 24) | ((s & 255))));
}
void common_hal__eve_ColorA(common_hal__eve_t *eve, uint32_t alpha) {
C4(eve, ((16 << 24) | ((alpha & 255))));
}
void common_hal__eve_ColorMask(common_hal__eve_t *eve, uint32_t r, uint32_t g, uint32_t b, uint32_t a) {
C4(eve, ((32 << 24) | ((r & 1) << 3) | ((g & 1) << 2) | ((b & 1) << 1) | ((a & 1))));
}
void common_hal__eve_ColorRGB(common_hal__eve_t *eve, uint32_t red, uint32_t green, uint32_t blue) {
C4(eve, ((4 << 24) | ((red & 255) << 16) | ((green & 255) << 8) | ((blue & 255))));
}
void common_hal__eve_Display(common_hal__eve_t *eve) {
C4(eve, ((0 << 24)));
}
void common_hal__eve_End(common_hal__eve_t *eve) {
C4(eve, ((33 << 24)));
}
void common_hal__eve_Jump(common_hal__eve_t *eve, uint32_t dest) {
C4(eve, ((30 << 24) | ((dest & 65535))));
}
void common_hal__eve_LineWidth(common_hal__eve_t *eve, uint32_t width) {
C4(eve, ((14 << 24) | ((width & 4095))));
}
void common_hal__eve_Macro(common_hal__eve_t *eve, uint32_t m) {
C4(eve, ((37 << 24) | ((m & 1))));
}
void common_hal__eve_Nop(common_hal__eve_t *eve) {
C4(eve, ((45 << 24)));
}
void common_hal__eve_PaletteSource(common_hal__eve_t *eve, uint32_t addr) {
C4(eve, ((42 << 24) | (((addr) & 4194303))));
}
void common_hal__eve_PointSize(common_hal__eve_t *eve, uint32_t size) {
C4(eve, ((13 << 24) | ((size & 8191))));
}
void common_hal__eve_RestoreContext(common_hal__eve_t *eve) {
C4(eve, ((35 << 24)));
}
void common_hal__eve_Return(common_hal__eve_t *eve) {
C4(eve, ((36 << 24)));
}
void common_hal__eve_SaveContext(common_hal__eve_t *eve) {
C4(eve, ((34 << 24)));
}
void common_hal__eve_ScissorSize(common_hal__eve_t *eve, uint32_t width, uint32_t height) {
C4(eve, ((28 << 24) | ((width & 4095) << 12) | ((height & 4095))));
}
void common_hal__eve_ScissorXY(common_hal__eve_t *eve, uint32_t x, uint32_t y) {
C4(eve, ((27 << 24) | ((x & 2047) << 11) | ((y & 2047))));
}
void common_hal__eve_StencilFunc(common_hal__eve_t *eve, uint32_t func, uint32_t ref, uint32_t mask) {
C4(eve, ((10 << 24) | ((func & 7) << 16) | ((ref & 255) << 8) | ((mask & 255))));
}
void common_hal__eve_StencilMask(common_hal__eve_t *eve, uint32_t mask) {
C4(eve, ((19 << 24) | ((mask & 255))));
}
void common_hal__eve_StencilOp(common_hal__eve_t *eve, uint32_t sfail, uint32_t spass) {
C4(eve, ((12 << 24) | ((sfail & 7) << 3) | ((spass & 7))));
}
void common_hal__eve_TagMask(common_hal__eve_t *eve, uint32_t mask) {
C4(eve, ((20 << 24) | ((mask & 1))));
}
void common_hal__eve_Tag(common_hal__eve_t *eve, uint32_t s) {
C4(eve, ((3 << 24) | ((s & 255))));
}
void common_hal__eve_VertexTranslateX(common_hal__eve_t *eve, uint32_t x) {
C4(eve, ((43 << 24) | (((x) & 131071))));
}
void common_hal__eve_VertexTranslateY(common_hal__eve_t *eve, uint32_t y) {
C4(eve, ((44 << 24) | (((y) & 131071))));
}
void common_hal__eve_Vertex2ii(common_hal__eve_t *eve, uint32_t x, uint32_t y, uint32_t handle, uint32_t cell) {
C4(eve, ((2 << 30) | (((x) & 511) << 21) | (((y) & 511) << 12) | (((handle) & 31) << 7) | (((cell) & 127) << 0)));
}

Loading…
Cancel
Save