Skip to content

Commit e180f15

Browse files
committed
Use MODDEF_ECMA419_DISPLAY for display behaviors
1 parent e4efc33 commit e180f15

File tree

4 files changed

+32
-25
lines changed

4 files changed

+32
-25
lines changed

modules/commodetto/commodettoPocoBlit.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ struct PocoRecord {
125125

126126
// native pixel output dispatch
127127
void *outputRefcon;
128-
#if MODDEF_ECMA419_ENABLED
128+
#if MODDEF_ECMA419_DISPLAY
129129
void *displayHooks;
130130
void *the;
131131
#endif

modules/commodetto/commodettoPocoCore.c

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,16 @@
2828
#if !XSTOOLS
2929
#include "mc.defines.h"
3030
#endif
31-
#if MODDEF_ECMA419_ENABLED
31+
#if MODDEF_ECMA419_DISPLAY
3232
#include "display419.h"
3333
#endif
3434

3535
#include "commodettoPoco.h"
3636
#include "commodettoPixelsOut.h"
3737
#include "commodettoFontEngine.h"
3838

39+
#undef MODDEF_ECMA419_DISPLAY
40+
3941
#include "stddef.h" // for offsetof macro
4042
#include "stdint.h"
4143
#include "stdlib.h"
@@ -134,7 +136,7 @@ void xs_poco_build(xsMachine *the)
134136
if (xsmcTest(xsArg(7)))
135137
poco->flags |= kPocoFlagAdaptInvalid;
136138

137-
#if MODDEF_ECMA419_ENABLED
139+
#if MODDEF_ECMA419_DISPLAY
138140
poco->displayHooks = C_NULL;
139141
poco->the = the;
140142

@@ -165,7 +167,7 @@ void xs_poco_build(xsMachine *the)
165167
else
166168
poco->outputRefcon = NULL;
167169

168-
#if MODDEF_ECMA419_ENABLED && kPocoFrameBuffer
170+
#if MODDEF_ECMA419_DISPLAY && kPocoFrameBuffer
169171
if (poco->displayHooks) {
170172
uint8_t frameBuffer;
171173
if ((0 == ((xsDisplayHostHooks)poco->displayHooks)->doGet(poco->outputRefcon, 1, &frameBuffer) && frameBuffer))
@@ -256,7 +258,7 @@ void xs_poco_begin(xsMachine *the)
256258
PocoPixel *pixels;
257259
int16_t rowBytes;
258260
PixelsOutDispatch pixelsOutDispatch = poco->outputRefcon ? *(PixelsOutDispatch *)poco->outputRefcon : NULL;
259-
#if MODDEF_ECMA419_ENABLED
261+
#if MODDEF_ECMA419_DISPLAY
260262
if (poco->displayHooks) {
261263
int rowBytesInt;
262264
(((xsDisplayHostHooks)poco->displayHooks)->doBegin)(poco->outputRefcon, poco->x, poco->y, poco->w, poco->h, (void **)&pixels, &rowBytesInt, 0);
@@ -269,7 +271,7 @@ void xs_poco_begin(xsMachine *the)
269271
else {
270272
xsUnsignedValue dataSize;
271273

272-
#if MODDEF_ECMA419_ENABLED
274+
#if MODDEF_ECMA419_DISPLAY
273275
xsmcVars(3);
274276
xsmcGet(xsVar(0), xsThis, xsID_pixelsOut);
275277
xsmcSetNewObject(xsVar(1));
@@ -320,7 +322,7 @@ static void pixelReceiver(PocoPixel *pixels, int byteLength, void *refCon)
320322
xsCall3(xsVar(0), xsID_send, xsVar(3), xsVar(1), xsVar(2));
321323
}
322324

323-
#if MODDEF_ECMA419_ENABLED
325+
#if MODDEF_ECMA419_DISPLAY
324326
static void displayPixelReceiver(PocoPixel *pixels, int byteLength, void *refCon)
325327
{
326328
Poco poco = refCon;
@@ -342,7 +344,7 @@ void xs_poco_end(xsMachine *the)
342344
{
343345
Poco poco = xsmcGetHostDataPoco(xsThis);
344346
PixelsOutDispatch pixelsOutDispatch =
345-
#if MODDEF_ECMA419_ENABLED
347+
#if MODDEF_ECMA419_DISPLAY
346348
(!poco->displayHooks && poco->outputRefcon) ? *(PixelsOutDispatch *)poco->outputRefcon : NULL;
347349
#else
348350
poco->outputRefcon ? *(PixelsOutDispatch *)poco->outputRefcon : NULL;
@@ -355,7 +357,7 @@ void xs_poco_end(xsMachine *the)
355357
if (!(poco->flags & kPocoFlagFrameBuffer)) {
356358
xsmcVars(5);
357359

358-
#if MODDEF_ECMA419_ENABLED
360+
#if MODDEF_ECMA419_DISPLAY
359361
if (poco->displayHooks) {
360362
(((xsDisplayHostHooks)poco->displayHooks)->doBegin(poco->outputRefcon, poco->x, poco->y, poco->w, poco->h, C_NULL, C_NULL, (poco->flags & kPocoFlagContinue) ? 1 : 0));
361363
}
@@ -366,7 +368,7 @@ void xs_poco_end(xsMachine *the)
366368
}
367369
else {
368370
xsmcGet(xsVar(0), xsThis, xsID_pixelsOut);
369-
#if MODDEF_ECMA419_ENABLED
371+
#if MODDEF_ECMA419_DISPLAY
370372
xsmcSetNewObject(xsVar(1));
371373
xsmcSetInteger(xsVar(2), poco->x);
372374
xsmcSet(xsVar(1), xsID_x, xsVar(2));
@@ -389,7 +391,7 @@ void xs_poco_end(xsMachine *the)
389391
xsCall4(xsVar(0), xsID_begin, xsVar(1), xsVar(2), xsVar(3), xsVar(4));
390392
#endif
391393
}
392-
#if MODDEF_ECMA419_ENABLED
394+
#if MODDEF_ECMA419_DISPLAY
393395
if (poco->displayHooks) {
394396
result = PocoDrawingEnd(poco, poco->pixels, poco->pixelsLength, displayPixelReceiver, poco);
395397
}
@@ -433,7 +435,7 @@ void xs_poco_end(xsMachine *the)
433435
poco->flags &= ~kPocoFlagGCDisabled;
434436
}
435437

436-
#if MODDEF_ECMA419_ENABLED
438+
#if MODDEF_ECMA419_DISPLAY
437439
if (poco->displayHooks) {
438440
(((xsDisplayHostHooks)poco->displayHooks)->doEnd)(poco->outputRefcon);
439441

@@ -442,7 +444,7 @@ void xs_poco_end(xsMachine *the)
442444
else
443445
#endif
444446
if ((xsmcArgc > 0) && xsmcTest(xsArg(0))) {
445-
#if MODDEF_ECMA419_ENABLED
447+
#if MODDEF_ECMA419_DISPLAY
446448
poco->flags |= kPocoFlagContinue;
447449
#else
448450
if (pixelsOutDispatch)
@@ -452,7 +454,7 @@ void xs_poco_end(xsMachine *the)
452454
#endif
453455
}
454456
else {
455-
#if MODDEF_ECMA419_ENABLED
457+
#if MODDEF_ECMA419_DISPLAY
456458
poco->flags &= ~kPocoFlagContinue;
457459

458460
if (poco->displayHooks) {
@@ -1079,7 +1081,7 @@ void xs_poco_adaptInvalid(xsMachine *the)
10791081
if (!(kPocoFlagAdaptInvalid & poco->flags))
10801082
return;
10811083

1082-
#if MODDEF_ECMA419_ENABLED
1084+
#if MODDEF_ECMA419_DISPLAY
10831085
if (poco->displayHooks) {
10841086
CommodettoRectangle cr = xsmcGetHostChunk(xsArg(0));
10851087
#if 0 != kPocoRotation

modules/io/display/manifest.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,10 @@
66
"zephyr": {
77
"include": "./zephyr/manifest.json"
88
}
9+
},
10+
"defines": {
11+
"ECMA419": {
12+
"display": 1
13+
}
914
}
1015
}

modules/piu/MC/piuView.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
*/
2020

2121
#include "piuMC.h"
22-
#if MODDEF_ECMA419_ENABLED
22+
#if MODDEF_ECMA419_DISPLAY
2323
#include "display419.h"
2424
#endif
2525

@@ -246,7 +246,7 @@ void PiuViewCombine(PiuView* self, PiuRectangle area, PiuCoordinate op)
246246
cr->y = y;
247247
cr->w = w;
248248
cr->h = h;
249-
#if MODDEF_ECMA419_ENABLED
249+
#if MODDEF_ECMA419_DISPLAY
250250
if (poco->displayHooks) {
251251
(((xsDisplayHostHooks)poco->displayHooks)->doAdaptInvalid)(poco->outputRefcon, cr);
252252
}
@@ -317,7 +317,7 @@ void PiuViewCombineRegion(PiuView* self, PiuRegion* region, PiuCoordinate op)
317317
cr->y = y;
318318
cr->w = w;
319319
cr->h = h;
320-
#if MODDEF_ECMA419_ENABLED
320+
#if MODDEF_ECMA419_DISPLAY
321321
if (poco->displayHooks) {
322322
(((xsDisplayHostHooks)poco->displayHooks)->doAdaptInvalid)(poco->outputRefcon, cr);
323323
}
@@ -929,7 +929,7 @@ void PiuViewReceiver(PocoPixel *pixels, int byteLength, void *refCon)
929929
xsCallFunction3((*self)->_send, xsReference((*self)->screen), xsReference((*self)->pixels), xsInteger((char *)pixels - (char *)poco->pixels), xsInteger(byteLength));
930930
}
931931

932-
#if MODDEF_ECMA419_ENABLED
932+
#if MODDEF_ECMA419_DISPLAY
933933
static void PiuViewDisplayReceiver(PocoPixel *pixels, int byteLength, void *refCon)
934934
{
935935
PiuView* self = refCon;
@@ -1047,7 +1047,7 @@ void PiuViewUpdateStep(PiuView* self, PocoCoordinate x, PocoCoordinate y, PocoDi
10471047
PocoPixel *pixels;
10481048
int16_t rowBytes;
10491049

1050-
#if MODDEF_ECMA419_ENABLED
1050+
#if MODDEF_ECMA419_DISPLAY
10511051
if (poco->displayHooks) {
10521052
int rowBytesInt;
10531053
(((xsDisplayHostHooks)poco->displayHooks)->doBegin)(poco->outputRefcon, poco->x, poco->y, poco->w, poco->h, (void **)&pixels, &rowBytesInt, 0);
@@ -1058,7 +1058,7 @@ void PiuViewUpdateStep(PiuView* self, PocoCoordinate x, PocoCoordinate y, PocoDi
10581058
if (pixelsOutDispatch)
10591059
(pixelsOutDispatch->doBeginFrameBuffer)(poco->outputRefcon, &pixels, &rowBytes);
10601060
else {
1061-
#if MODDEF_ECMA419_ENABLED
1061+
#if MODDEF_ECMA419_DISPLAY
10621062
if (poco->flags & kPocoFlag419PixelOut) {
10631063
xsResult = xsNewObject();
10641064
xsSet(xsResult, xsID_x, xsInteger(poco->x));
@@ -1142,7 +1142,7 @@ void PiuViewUpdateStep(PiuView* self, PocoCoordinate x, PocoCoordinate y, PocoDi
11421142
if (!(poco->flags & kPocoFlagFrameBuffer))
11431143
#endif
11441144
{
1145-
#if MODDEF_ECMA419_ENABLED
1145+
#if MODDEF_ECMA419_DISPLAY
11461146
if (poco->displayHooks) {
11471147
(((xsDisplayHostHooks)poco->displayHooks)->doBegin)(poco->outputRefcon, poco->x, poco->y, poco->w, poco->h, C_NULL, C_NULL, 0);
11481148
result = PocoDrawingEnd(poco, poco->pixels, poco->pixelsLength, PiuViewDisplayReceiver, self);
@@ -1154,7 +1154,7 @@ void PiuViewUpdateStep(PiuView* self, PocoCoordinate x, PocoCoordinate y, PocoDi
11541154
result = PocoDrawingEnd(poco, poco->pixels, poco->pixelsLength, pixelsOutDispatch->doSend, poco->outputRefcon);
11551155
}
11561156
else {
1157-
#if MODDEF_ECMA419_ENABLED
1157+
#if MODDEF_ECMA419_DISPLAY
11581158
xsResult = xsNewObject();
11591159
xsSet(xsResult, xsID_x, xsInteger(poco->x));
11601160
xsSet(xsResult, xsID_y, xsInteger(poco->y));
@@ -1169,7 +1169,7 @@ void PiuViewUpdateStep(PiuView* self, PocoCoordinate x, PocoCoordinate y, PocoDi
11691169
}
11701170
if (result) goto fail;
11711171

1172-
#if MODDEF_ECMA419_ENABLED
1172+
#if MODDEF_ECMA419_DISPLAY
11731173
if (poco->displayHooks) {
11741174
(((xsDisplayHostHooks)poco->displayHooks)->doEnd)(poco->outputRefcon);
11751175

@@ -1200,7 +1200,7 @@ void PiuViewUpdateStep(PiuView* self, PocoCoordinate x, PocoCoordinate y, PocoDi
12001200
result = PocoDrawingEndFrameBuffer(poco);
12011201
if (result) goto fail;
12021202

1203-
#if MODDEF_ECMA419_ENABLED
1203+
#if MODDEF_ECMA419_DISPLAY
12041204
if (poco->displayHooks)
12051205
(((xsDisplayHostHooks)poco->displayHooks)->doEnd)(poco->outputRefcon);
12061206
else

0 commit comments

Comments
 (0)