mirror of
https://github.com/espruino/Espruino.git
synced 2025-12-08 19:06:15 +00:00
Set Graphics type before graphicsStructInit, or graphicsStructResetState can't decide whether to use themes or not.
This commit is contained in:
parent
cd25f64b05
commit
561becda6b
@ -156,7 +156,7 @@ extern JsGraphicsTheme graphicsTheme;
|
||||
// ---------------------------------- these are in graphics.c
|
||||
/// Reset graphics structure state (eg font size, color, etc)
|
||||
void graphicsStructResetState(JsGraphics *gfx);
|
||||
/// Completely reset graphics structure including flags
|
||||
/// Completely reset graphics structure including flags. gfx->type should be set beforehand
|
||||
void graphicsStructInit(JsGraphics *gfx, int width, int height, int bpp);
|
||||
/// Access the Graphics Instance JsVar and get the relevant info in a JsGraphics structure. True on success
|
||||
bool graphicsGetFromVar(JsGraphics *gfx, JsVar *parent);
|
||||
|
||||
@ -174,8 +174,8 @@ void jswrap_graphics_init() {
|
||||
JsVar *parentObj = jsvSkipName(parent);
|
||||
jsvObjectSetChild(execInfo.hiddenRoot, JS_GRAPHICS_VAR, parentObj);
|
||||
JsGraphics gfx;
|
||||
graphicsStructInit(&gfx,320,240,16);
|
||||
gfx.data.type = JSGRAPHICSTYPE_FSMC;
|
||||
graphicsStructInit(&gfx,320,240,16);
|
||||
gfx.graphicsVar = parentObj;
|
||||
lcdInit_FSMC(&gfx);
|
||||
lcdSetCallbacks_FSMC(&gfx);
|
||||
@ -254,8 +254,8 @@ JsVar *jswrap_graphics_createArrayBuffer(int width, int height, int bpp, JsVar *
|
||||
if (!parent) return 0; // low memory
|
||||
|
||||
JsGraphics gfx;
|
||||
graphicsStructInit(&gfx,width,height,bpp);
|
||||
gfx.data.type = JSGRAPHICSTYPE_ARRAYBUFFER;
|
||||
graphicsStructInit(&gfx,width,height,bpp);
|
||||
gfx.data.flags = JSGRAPHICSFLAGS_NONE;
|
||||
gfx.graphicsVar = parent;
|
||||
|
||||
@ -351,8 +351,8 @@ JsVar *jswrap_graphics_createCallback(int width, int height, int bpp, JsVar *cal
|
||||
if (!parent) return 0; // low memory
|
||||
|
||||
JsGraphics gfx;
|
||||
graphicsStructInit(&gfx,width,height,bpp);
|
||||
gfx.data.type = JSGRAPHICSTYPE_JS;
|
||||
graphicsStructInit(&gfx,width,height,bpp);
|
||||
gfx.graphicsVar = parent;
|
||||
lcdInit_JS(&gfx, callbackSetPixel, callbackFillRect);
|
||||
graphicsSetVar(&gfx);
|
||||
@ -386,8 +386,8 @@ JsVar *jswrap_graphics_createSDL(int width, int height, int bpp) {
|
||||
JsVar *parent = jspNewObject(0, "Graphics");
|
||||
if (!parent) return 0; // low memory
|
||||
JsGraphics gfx;
|
||||
graphicsStructInit(&gfx,width,height,bpp);
|
||||
gfx.data.type = JSGRAPHICSTYPE_SDL;
|
||||
graphicsStructInit(&gfx,width,height,bpp);
|
||||
gfx.graphicsVar = parent;
|
||||
lcdInit_SDL(&gfx);
|
||||
graphicsSetVar(&gfx);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user