Skip to content

Commit a87dee2

Browse files
committed
Correct the BitmapTransform operations.
Correct argument order better argument naming fix copypaste bug on C and F arguments
1 parent 1f44029 commit a87dee2

File tree

3 files changed

+97
-44
lines changed

3 files changed

+97
-44
lines changed

shared-bindings/_eve/__init__.c

Lines changed: 32 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -268,13 +268,15 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(bitmapswizzle_obj, 5, 5, _bitmapswizz
268268
//| :param int p: precision control: 0 is 8.8, 1 is 1.15. Range 0-1. The initial value is 0
269269
//| :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
270270
//|
271+
//| The initial value is **p** = 0, **v** = 256. This represents the value 1.0.
272+
//|
271273
//| These values are part of the graphics context and are saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.
272274
//|
273275

274276
STATIC mp_obj_t _bitmaptransforma(mp_obj_t self, mp_obj_t a0, mp_obj_t a1) {
275-
uint32_t a = mp_obj_get_int_truncated(a0);
276-
uint32_t p = mp_obj_get_int_truncated(a1);
277-
common_hal__eve_BitmapTransformA(EVEHAL(self), a, p);
277+
uint32_t p = mp_obj_get_int_truncated(a0);
278+
uint32_t v = mp_obj_get_int_truncated(a1);
279+
common_hal__eve_BitmapTransformA(EVEHAL(self), p, v);
278280
return mp_const_none;
279281
}
280282
STATIC MP_DEFINE_CONST_FUN_OBJ_3(bitmaptransforma_obj, _bitmaptransforma);
@@ -286,33 +288,34 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_3(bitmaptransforma_obj, _bitmaptransforma);
286288
//| :param int p: precision control: 0 is 8.8, 1 is 1.15. Range 0-1. The initial value is 0
287289
//| :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
288290
//|
291+
//| The initial value is **p** = 0, **v** = 0. This represents the value 0.0.
292+
//|
289293
//| These values are part of the graphics context and are saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.
290294
//|
291295

292296
STATIC mp_obj_t _bitmaptransformb(mp_obj_t self, mp_obj_t a0, mp_obj_t a1) {
293-
uint32_t b = mp_obj_get_int_truncated(a0);
294-
uint32_t p = mp_obj_get_int_truncated(a1);
295-
common_hal__eve_BitmapTransformB(EVEHAL(self), b, p);
297+
uint32_t p = mp_obj_get_int_truncated(a0);
298+
uint32_t v = mp_obj_get_int_truncated(a1);
299+
common_hal__eve_BitmapTransformB(EVEHAL(self), p, v);
296300
return mp_const_none;
297301
}
298302
STATIC MP_DEFINE_CONST_FUN_OBJ_3(bitmaptransformb_obj, _bitmaptransformb);
299303

300-
//| .. method:: BitmapTransformC(c)
304+
//| .. method:: BitmapTransformC(v)
301305
//|
302306
//| Set the :math:`c` component of the bitmap transform matrix
303307
//|
304-
//| :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
308+
//| :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
305309
//|
306310
//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.
307311
//|
308312

309-
STATIC mp_obj_t _bitmaptransformc(mp_obj_t self, mp_obj_t a0, mp_obj_t a1) {
310-
uint32_t c = mp_obj_get_int_truncated(a0);
311-
uint32_t p = mp_obj_get_int_truncated(a1);
312-
common_hal__eve_BitmapTransformC(EVEHAL(self), c, p);
313+
STATIC mp_obj_t _bitmaptransformc(mp_obj_t self, mp_obj_t a0) {
314+
uint32_t v = mp_obj_get_int_truncated(a0);
315+
common_hal__eve_BitmapTransformC(EVEHAL(self), v);
313316
return mp_const_none;
314317
}
315-
STATIC MP_DEFINE_CONST_FUN_OBJ_3(bitmaptransformc_obj, _bitmaptransformc);
318+
STATIC MP_DEFINE_CONST_FUN_OBJ_2(bitmaptransformc_obj, _bitmaptransformc);
316319

317320
//| .. method:: BitmapTransformD(p, v)
318321
//|
@@ -321,13 +324,15 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_3(bitmaptransformc_obj, _bitmaptransformc);
321324
//| :param int p: precision control: 0 is 8.8, 1 is 1.15. Range 0-1. The initial value is 0
322325
//| :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
323326
//|
327+
//| The initial value is **p** = 0, **v** = 0. This represents the value 0.0.
328+
//|
324329
//| These values are part of the graphics context and are saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.
325330
//|
326331

327332
STATIC mp_obj_t _bitmaptransformd(mp_obj_t self, mp_obj_t a0, mp_obj_t a1) {
328-
uint32_t d = mp_obj_get_int_truncated(a0);
329-
uint32_t p = mp_obj_get_int_truncated(a1);
330-
common_hal__eve_BitmapTransformD(EVEHAL(self), d, p);
333+
uint32_t p = mp_obj_get_int_truncated(a0);
334+
uint32_t v = mp_obj_get_int_truncated(a1);
335+
common_hal__eve_BitmapTransformD(EVEHAL(self), p, v);
331336
return mp_const_none;
332337
}
333338
STATIC MP_DEFINE_CONST_FUN_OBJ_3(bitmaptransformd_obj, _bitmaptransformd);
@@ -339,33 +344,34 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_3(bitmaptransformd_obj, _bitmaptransformd);
339344
//| :param int p: precision control: 0 is 8.8, 1 is 1.15. Range 0-1. The initial value is 0
340345
//| :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
341346
//|
347+
//| The initial value is **p** = 0, **v** = 256. This represents the value 1.0.
348+
//|
342349
//| These values are part of the graphics context and are saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.
343350
//|
344351

345352
STATIC mp_obj_t _bitmaptransforme(mp_obj_t self, mp_obj_t a0, mp_obj_t a1) {
346-
uint32_t e = mp_obj_get_int_truncated(a0);
347-
uint32_t p = mp_obj_get_int_truncated(a1);
348-
common_hal__eve_BitmapTransformE(EVEHAL(self), e, p);
353+
uint32_t p = mp_obj_get_int_truncated(a0);
354+
uint32_t v = mp_obj_get_int_truncated(a1);
355+
common_hal__eve_BitmapTransformE(EVEHAL(self), p, v);
349356
return mp_const_none;
350357
}
351358
STATIC MP_DEFINE_CONST_FUN_OBJ_3(bitmaptransforme_obj, _bitmaptransforme);
352359

353-
//| .. method:: BitmapTransformF(f)
360+
//| .. method:: BitmapTransformF(v)
354361
//|
355362
//| Set the :math:`f` component of the bitmap transform matrix
356363
//|
357-
//| :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
364+
//| :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
358365
//|
359366
//| This value is part of the graphics context and is saved and restored by :meth:`SaveContext` and :meth:`RestoreContext`.
360367
//|
361368

362-
STATIC mp_obj_t _bitmaptransformf(mp_obj_t self, mp_obj_t a0, mp_obj_t a1) {
363-
uint32_t f = mp_obj_get_int_truncated(a0);
364-
uint32_t p = mp_obj_get_int_truncated(a1);
365-
common_hal__eve_BitmapTransformF(EVEHAL(self), f, p);
369+
STATIC mp_obj_t _bitmaptransformf(mp_obj_t self, mp_obj_t a0) {
370+
uint32_t v = mp_obj_get_int_truncated(a0);
371+
common_hal__eve_BitmapTransformF(EVEHAL(self), v);
366372
return mp_const_none;
367373
}
368-
STATIC MP_DEFINE_CONST_FUN_OBJ_3(bitmaptransformf_obj, _bitmaptransformf);
374+
STATIC MP_DEFINE_CONST_FUN_OBJ_2(bitmaptransformf_obj, _bitmaptransformf);
369375

370376
//| .. method:: BlendFunc(src, dst)
371377
//|

shared-bindings/_eve/__init__.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,12 @@ void common_hal__eve_BitmapSizeH(common_hal__eve_t *eve, uint32_t width, uint32_
4141
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);
4242
void common_hal__eve_BitmapSource(common_hal__eve_t *eve, uint32_t addr);
4343
void common_hal__eve_BitmapSwizzle(common_hal__eve_t *eve, uint32_t r, uint32_t g, uint32_t b, uint32_t a);
44-
void common_hal__eve_BitmapTransformA(common_hal__eve_t *eve, uint32_t a, uint32_t p);
45-
void common_hal__eve_BitmapTransformB(common_hal__eve_t *eve, uint32_t b, uint32_t p);
46-
void common_hal__eve_BitmapTransformC(common_hal__eve_t *eve, uint32_t c, uint32_t p);
47-
void common_hal__eve_BitmapTransformD(common_hal__eve_t *eve, uint32_t d, uint32_t p);
48-
void common_hal__eve_BitmapTransformE(common_hal__eve_t *eve, uint32_t e, uint32_t p);
49-
void common_hal__eve_BitmapTransformF(common_hal__eve_t *eve, uint32_t f, uint32_t p);
44+
void common_hal__eve_BitmapTransformA(common_hal__eve_t *eve, uint32_t p, uint32_t v);
45+
void common_hal__eve_BitmapTransformB(common_hal__eve_t *eve, uint32_t p, uint32_t v);
46+
void common_hal__eve_BitmapTransformC(common_hal__eve_t *eve, uint32_t v);
47+
void common_hal__eve_BitmapTransformD(common_hal__eve_t *eve, uint32_t p, uint32_t v);
48+
void common_hal__eve_BitmapTransformE(common_hal__eve_t *eve, uint32_t p, uint32_t v);
49+
void common_hal__eve_BitmapTransformF(common_hal__eve_t *eve, uint32_t v);
5050
void common_hal__eve_BlendFunc(common_hal__eve_t *eve, uint32_t src, uint32_t dst);
5151
void common_hal__eve_Call(common_hal__eve_t *eve, uint32_t dest);
5252
void common_hal__eve_Cell(common_hal__eve_t *eve, uint32_t cell);

shared-module/_eve/__init__.c

Lines changed: 59 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -80,190 +80,237 @@ void common_hal__eve_AlphaFunc(common_hal__eve_t *eve, uint32_t func, uint32_t r
8080
C4(eve, ((9 << 24) | ((func & 7) << 8) | ((ref & 255))));
8181
}
8282

83+
8384
void common_hal__eve_Begin(common_hal__eve_t *eve, uint32_t prim) {
8485
C4(eve, ((31 << 24) | ((prim & 15))));
8586
}
8687

88+
8789
void common_hal__eve_BitmapExtFormat(common_hal__eve_t *eve, uint32_t fmt) {
8890
C4(eve, ((46 << 24) | (fmt & 65535)));
8991
}
9092

93+
9194
void common_hal__eve_BitmapHandle(common_hal__eve_t *eve, uint32_t handle) {
9295
C4(eve, ((5 << 24) | ((handle & 31))));
9396
}
9497

98+
9599
void common_hal__eve_BitmapLayoutH(common_hal__eve_t *eve, uint32_t linestride, uint32_t height) {
96100
C4(eve, ((40 << 24) | (((linestride) & 3) << 2) | (((height) & 3))));
97101
}
98102

103+
99104
void common_hal__eve_BitmapLayout(common_hal__eve_t *eve, uint32_t format, uint32_t linestride, uint32_t height) {
100105
C4(eve, ((7 << 24) | ((format & 31) << 19) | ((linestride & 1023) << 9) | ((height & 511))));
101106
}
102107

108+
103109
void common_hal__eve_BitmapSizeH(common_hal__eve_t *eve, uint32_t width, uint32_t height) {
104110
C4(eve, ((41 << 24) | (((width) & 3) << 2) | (((height) & 3))));
105111
}
106112

113+
107114
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) {
108115
C4(eve, ((8 << 24) | ((filter & 1) << 20) | ((wrapx & 1) << 19) | ((wrapy & 1) << 18) | ((width & 511) << 9) | ((height & 511))));
109116
}
110117

118+
111119
void common_hal__eve_BitmapSource(common_hal__eve_t *eve, uint32_t addr) {
112120
C4(eve, ((1 << 24) | ((addr & 0xffffff))));
113121
}
114122

123+
115124
void common_hal__eve_BitmapSwizzle(common_hal__eve_t *eve, uint32_t r, uint32_t g, uint32_t b, uint32_t a) {
116125
C4(eve, ((47 << 24) | ((r & 7) << 9) | ((g & 7) << 6) | ((b & 7) << 3) | ((a & 7))));
117126
}
118127

119-
void common_hal__eve_BitmapTransformA(common_hal__eve_t *eve, uint32_t a, uint32_t p) {
120-
C4(eve, ((21 << 24) | ((p & 1) << 17) | ((a & 131071))));
128+
129+
void common_hal__eve_BitmapTransformA(common_hal__eve_t *eve, uint32_t p, uint32_t v) {
130+
C4(eve, ((21 << 24) | ((p & 1) << 17) | ((v & 131071))));
121131
}
122132

123-
void common_hal__eve_BitmapTransformB(common_hal__eve_t *eve, uint32_t b, uint32_t p) {
124-
C4(eve, ((22 << 24) | ((p & 1) << 17) | ((b & 131071))));
133+
134+
void common_hal__eve_BitmapTransformB(common_hal__eve_t *eve, uint32_t p, uint32_t v) {
135+
C4(eve, ((22 << 24) | ((p & 1) << 17) | ((v & 131071))));
125136
}
126137

127-
void common_hal__eve_BitmapTransformC(common_hal__eve_t *eve, uint32_t c, uint32_t p) {
128-
C4(eve, ((23 << 24) | ((p & 1) << 17) | ((c & 16777215))));
138+
139+
void common_hal__eve_BitmapTransformC(common_hal__eve_t *eve, uint32_t v) {
140+
C4(eve, ((23 << 24) | ((v & 16777215))));
129141
}
130142

131-
void common_hal__eve_BitmapTransformD(common_hal__eve_t *eve, uint32_t d, uint32_t p) {
132-
C4(eve, ((24 << 24) | ((p & 1) << 17) | ((d & 131071))));
143+
144+
void common_hal__eve_BitmapTransformD(common_hal__eve_t *eve, uint32_t p, uint32_t v) {
145+
C4(eve, ((24 << 24) | ((p & 1) << 17) | ((v & 131071))));
133146
}
134147

135-
void common_hal__eve_BitmapTransformE(common_hal__eve_t *eve, uint32_t e, uint32_t p) {
136-
C4(eve, ((25 << 24) | ((p & 1) << 17) | ((e & 131071))));
148+
149+
void common_hal__eve_BitmapTransformE(common_hal__eve_t *eve, uint32_t p, uint32_t v) {
150+
C4(eve, ((25 << 24) | ((p & 1) << 17) | ((v & 131071))));
137151
}
138152

139-
void common_hal__eve_BitmapTransformF(common_hal__eve_t *eve, uint32_t f, uint32_t p) {
140-
C4(eve, ((26 << 24) | ((p & 1) << 17) | ((f & 16777215))));
153+
154+
void common_hal__eve_BitmapTransformF(common_hal__eve_t *eve, uint32_t v) {
155+
C4(eve, ((26 << 24) | ((v & 16777215))));
141156
}
142157

158+
143159
void common_hal__eve_BlendFunc(common_hal__eve_t *eve, uint32_t src, uint32_t dst) {
144160
C4(eve, ((11 << 24) | ((src & 7) << 3) | ((dst & 7))));
145161
}
146162

163+
147164
void common_hal__eve_Call(common_hal__eve_t *eve, uint32_t dest) {
148165
C4(eve, ((29 << 24) | ((dest & 65535))));
149166
}
150167

168+
151169
void common_hal__eve_Cell(common_hal__eve_t *eve, uint32_t cell) {
152170
C4(eve, ((6 << 24) | ((cell & 127))));
153171
}
154172

173+
155174
void common_hal__eve_ClearColorA(common_hal__eve_t *eve, uint32_t alpha) {
156175
C4(eve, ((15 << 24) | ((alpha & 255))));
157176
}
158177

178+
159179
void common_hal__eve_ClearColorRGB(common_hal__eve_t *eve, uint32_t red, uint32_t green, uint32_t blue) {
160180
C4(eve, ((2 << 24) | ((red & 255) << 16) | ((green & 255) << 8) | ((blue & 255))));
161181
}
162182

183+
163184
void common_hal__eve_Clear(common_hal__eve_t *eve, uint32_t c, uint32_t s, uint32_t t) {
164185
C4(eve, ((38 << 24) | ((c & 1) << 2) | ((s & 1) << 1) | ((t & 1))));
165186
}
166187

188+
167189
void common_hal__eve_ClearStencil(common_hal__eve_t *eve, uint32_t s) {
168190
C4(eve, ((17 << 24) | ((s & 255))));
169191
}
170192

193+
171194
void common_hal__eve_ClearTag(common_hal__eve_t *eve, uint32_t s) {
172195
C4(eve, ((18 << 24) | ((s & 255))));
173196
}
174197

198+
175199
void common_hal__eve_ColorA(common_hal__eve_t *eve, uint32_t alpha) {
176200
C4(eve, ((16 << 24) | ((alpha & 255))));
177201
}
178202

203+
179204
void common_hal__eve_ColorMask(common_hal__eve_t *eve, uint32_t r, uint32_t g, uint32_t b, uint32_t a) {
180205
C4(eve, ((32 << 24) | ((r & 1) << 3) | ((g & 1) << 2) | ((b & 1) << 1) | ((a & 1))));
181206
}
182207

208+
183209
void common_hal__eve_ColorRGB(common_hal__eve_t *eve, uint32_t red, uint32_t green, uint32_t blue) {
184210
C4(eve, ((4 << 24) | ((red & 255) << 16) | ((green & 255) << 8) | ((blue & 255))));
185211
}
186212

213+
187214
void common_hal__eve_Display(common_hal__eve_t *eve) {
188215
C4(eve, ((0 << 24)));
189216
}
190217

218+
191219
void common_hal__eve_End(common_hal__eve_t *eve) {
192220
C4(eve, ((33 << 24)));
193221
}
194222

223+
195224
void common_hal__eve_Jump(common_hal__eve_t *eve, uint32_t dest) {
196225
C4(eve, ((30 << 24) | ((dest & 65535))));
197226
}
198227

228+
199229
void common_hal__eve_LineWidth(common_hal__eve_t *eve, uint32_t width) {
200230
C4(eve, ((14 << 24) | ((width & 4095))));
201231
}
202232

233+
203234
void common_hal__eve_Macro(common_hal__eve_t *eve, uint32_t m) {
204235
C4(eve, ((37 << 24) | ((m & 1))));
205236
}
206237

238+
207239
void common_hal__eve_Nop(common_hal__eve_t *eve) {
208240
C4(eve, ((45 << 24)));
209241
}
210242

243+
211244
void common_hal__eve_PaletteSource(common_hal__eve_t *eve, uint32_t addr) {
212245
C4(eve, ((42 << 24) | (((addr) & 4194303))));
213246
}
214247

248+
215249
void common_hal__eve_PointSize(common_hal__eve_t *eve, uint32_t size) {
216250
C4(eve, ((13 << 24) | ((size & 8191))));
217251
}
218252

253+
219254
void common_hal__eve_RestoreContext(common_hal__eve_t *eve) {
220255
C4(eve, ((35 << 24)));
221256
}
222257

258+
223259
void common_hal__eve_Return(common_hal__eve_t *eve) {
224260
C4(eve, ((36 << 24)));
225261
}
226262

263+
227264
void common_hal__eve_SaveContext(common_hal__eve_t *eve) {
228265
C4(eve, ((34 << 24)));
229266
}
230267

268+
231269
void common_hal__eve_ScissorSize(common_hal__eve_t *eve, uint32_t width, uint32_t height) {
232270
C4(eve, ((28 << 24) | ((width & 4095) << 12) | ((height & 4095))));
233271
}
234272

273+
235274
void common_hal__eve_ScissorXY(common_hal__eve_t *eve, uint32_t x, uint32_t y) {
236275
C4(eve, ((27 << 24) | ((x & 2047) << 11) | ((y & 2047))));
237276
}
238277

278+
239279
void common_hal__eve_StencilFunc(common_hal__eve_t *eve, uint32_t func, uint32_t ref, uint32_t mask) {
240280
C4(eve, ((10 << 24) | ((func & 7) << 16) | ((ref & 255) << 8) | ((mask & 255))));
241281
}
242282

283+
243284
void common_hal__eve_StencilMask(common_hal__eve_t *eve, uint32_t mask) {
244285
C4(eve, ((19 << 24) | ((mask & 255))));
245286
}
246287

288+
247289
void common_hal__eve_StencilOp(common_hal__eve_t *eve, uint32_t sfail, uint32_t spass) {
248290
C4(eve, ((12 << 24) | ((sfail & 7) << 3) | ((spass & 7))));
249291
}
250292

293+
251294
void common_hal__eve_TagMask(common_hal__eve_t *eve, uint32_t mask) {
252295
C4(eve, ((20 << 24) | ((mask & 1))));
253296
}
254297

298+
255299
void common_hal__eve_Tag(common_hal__eve_t *eve, uint32_t s) {
256300
C4(eve, ((3 << 24) | ((s & 255))));
257301
}
258302

303+
259304
void common_hal__eve_VertexTranslateX(common_hal__eve_t *eve, uint32_t x) {
260305
C4(eve, ((43 << 24) | (((x) & 131071))));
261306
}
262307

308+
263309
void common_hal__eve_VertexTranslateY(common_hal__eve_t *eve, uint32_t y) {
264310
C4(eve, ((44 << 24) | (((y) & 131071))));
265311
}
266312

313+
267314
void common_hal__eve_Vertex2ii(common_hal__eve_t *eve, uint32_t x, uint32_t y, uint32_t handle, uint32_t cell) {
268315
C4(eve, ((2 << 30) | (((x) & 511) << 21) | (((y) & 511) << 12) | (((handle) & 31) << 7) | (((cell) & 127) << 0)));
269316
}

0 commit comments

Comments
 (0)