mirror of
https://github.com/espruino/Espruino.git
synced 2025-12-08 19:06:15 +00:00
Squashing some warnings
This commit is contained in:
parent
1764905c4a
commit
62c95c4ed5
@ -161,7 +161,7 @@ const unsigned short LCD_FONT_4X6[] IN_FLASH_MEMORY = { // from 33 up to 127
|
||||
PACK_5_TO_16( ___ , ___ , ___ , ___ , XXX )
|
||||
};
|
||||
|
||||
void graphicsDrawChar4x6(JsGraphics *gfx, short x1, short y1, char ch, unsigned short size, bool solidBackground) {
|
||||
void graphicsDrawChar4x6(JsGraphics *gfx, int x1, int y1, char ch, unsigned short size, bool solidBackground) {
|
||||
int idx = ((unsigned char)ch) - 33;
|
||||
if (idx<0 || idx>=LCD_FONT_4X6_CHARS) {
|
||||
// no char for this
|
||||
@ -172,13 +172,13 @@ void graphicsDrawChar4x6(JsGraphics *gfx, short x1, short y1, char ch, unsigned
|
||||
int cidx = idx % 5;
|
||||
idx = (idx/5)*6;
|
||||
int y;
|
||||
short s = size-1;
|
||||
int s = size-1;
|
||||
for (y=0;y<6;y++) {
|
||||
unsigned int line = READ_FLASH_UINT16(&LCD_FONT_4X6[idx + y]) >> (cidx*3);
|
||||
short ly = y*size + y1;
|
||||
if (line&4) graphicsFillRect(gfx, (short)(x1+0*size), ly, (short)(x1+s+0*size), ly+s, (line&4) ? gfx->data.fgColor : gfx->data.bgColor);
|
||||
if (line&2) graphicsFillRect(gfx, (short)(x1+1*size), ly, (short)(x1+s+1*size), ly+s, (line&2) ? gfx->data.fgColor : gfx->data.bgColor);
|
||||
if (line&1) graphicsFillRect(gfx, (short)(x1+2*size), ly, (short)(x1+s+2*size), ly+s, (line&1) ? gfx->data.fgColor : gfx->data.bgColor);
|
||||
int line = READ_FLASH_UINT16(&LCD_FONT_4X6[idx + y]) >> (cidx*3);
|
||||
int ly = y*size + y1;
|
||||
if (line&4) graphicsFillRect(gfx, x1+0*size, ly, x1+s+0*size, ly+s, (line&4) ? gfx->data.fgColor : gfx->data.bgColor);
|
||||
if (line&2) graphicsFillRect(gfx, x1+1*size, ly, x1+s+1*size, ly+s, (line&2) ? gfx->data.fgColor : gfx->data.bgColor);
|
||||
if (line&1) graphicsFillRect(gfx, x1+2*size, ly, x1+s+2*size, ly+s, (line&1) ? gfx->data.fgColor : gfx->data.bgColor);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -14,4 +14,4 @@
|
||||
|
||||
#include "graphics.h"
|
||||
|
||||
void graphicsDrawChar4x6(JsGraphics *gfx, short x1, short y1, char ch, unsigned short size, bool solidBackground);
|
||||
void graphicsDrawChar4x6(JsGraphics *gfx, int x1, int y1, char ch, unsigned short size, bool solidBackground);
|
||||
|
||||
@ -259,7 +259,7 @@ const uint32_t LCD_FONT_6X8[] IN_FLASH_MEMORY = { // from 33 up to 128
|
||||
};
|
||||
|
||||
|
||||
void graphicsDrawChar6x8(JsGraphics *gfx, short x1, short y1, char ch, unsigned short size, bool solidBackground) {
|
||||
void graphicsDrawChar6x8(JsGraphics *gfx, int x1, int y1, char ch, unsigned short size, bool solidBackground) {
|
||||
int idx = ((unsigned char)ch) - 33;
|
||||
if (idx<0 || idx>=LCD_FONT_6X8_CHARS) {
|
||||
// no char for this
|
||||
@ -271,16 +271,16 @@ void graphicsDrawChar6x8(JsGraphics *gfx, short x1, short y1, char ch, unsigned
|
||||
int cidx = idx % 5;
|
||||
idx = (idx/5)*8;
|
||||
int y;
|
||||
short s = size-1;
|
||||
int s = size-1;
|
||||
for (y=0;y<8;y++) {
|
||||
unsigned int line = LCD_FONT_6X8[idx + y] >> (cidx*6);
|
||||
short ly = y*size + y1;
|
||||
if (solidBackground || (line&32)) graphicsFillRect(gfx, (short)(x1+0*size), ly, (short)(x1+s+0*size), ly+s, (line&32) ? gfx->data.fgColor : gfx->data.bgColor);
|
||||
if (solidBackground || (line&16)) graphicsFillRect(gfx, (short)(x1+1*size), ly, (short)(x1+s+1*size), ly+s, (line&16) ? gfx->data.fgColor : gfx->data.bgColor);
|
||||
if (solidBackground || (line&8)) graphicsFillRect(gfx, (short)(x1+2*size), ly, (short)(x1+s+2*size), ly+s, (line&8) ? gfx->data.fgColor : gfx->data.bgColor);
|
||||
if (solidBackground || (line&4)) graphicsFillRect(gfx, (short)(x1+3*size), ly, (short)(x1+s+3*size), ly+s, (line&4) ? gfx->data.fgColor : gfx->data.bgColor);
|
||||
if (solidBackground || (line&2)) graphicsFillRect(gfx, (short)(x1+4*size), ly, (short)(x1+s+4*size), ly+s, (line&2) ? gfx->data.fgColor : gfx->data.bgColor);
|
||||
if (solidBackground || (line&1)) graphicsFillRect(gfx, (short)(x1+5*size), ly, (short)(x1+s+5*size), ly+s, (line&1) ? gfx->data.fgColor : gfx->data.bgColor);
|
||||
int ly = y*size + y1;
|
||||
if (solidBackground || (line&32)) graphicsFillRect(gfx, x1+0*size, ly, x1+s+0*size, ly+s, (line&32) ? gfx->data.fgColor : gfx->data.bgColor);
|
||||
if (solidBackground || (line&16)) graphicsFillRect(gfx, x1+1*size, ly, x1+s+1*size, ly+s, (line&16) ? gfx->data.fgColor : gfx->data.bgColor);
|
||||
if (solidBackground || (line&8)) graphicsFillRect(gfx, x1+2*size, ly, x1+s+2*size, ly+s, (line&8) ? gfx->data.fgColor : gfx->data.bgColor);
|
||||
if (solidBackground || (line&4)) graphicsFillRect(gfx, x1+3*size, ly, x1+s+3*size, ly+s, (line&4) ? gfx->data.fgColor : gfx->data.bgColor);
|
||||
if (solidBackground || (line&2)) graphicsFillRect(gfx, x1+4*size, ly, x1+s+4*size, ly+s, (line&2) ? gfx->data.fgColor : gfx->data.bgColor);
|
||||
if (solidBackground || (line&1)) graphicsFillRect(gfx, x1+5*size, ly, x1+s+5*size, ly+s, (line&1) ? gfx->data.fgColor : gfx->data.bgColor);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -15,5 +15,5 @@
|
||||
#include "graphics.h"
|
||||
|
||||
#ifdef USE_FONT_6X8
|
||||
void graphicsDrawChar6x8(JsGraphics *gfx, short x1, short y1, char ch, unsigned short size, bool solidBackground);
|
||||
void graphicsDrawChar6x8(JsGraphics *gfx, int x1, int y1, char ch, unsigned short size, bool solidBackground);
|
||||
#endif
|
||||
|
||||
@ -91,8 +91,8 @@ void graphicsFallbackScroll(JsGraphics *gfx, int xdir, int ydir) {
|
||||
#ifndef SAVE_ON_FLASH
|
||||
gfx->data.modMinX=0;
|
||||
gfx->data.modMinY=0;
|
||||
gfx->data.modMaxX=(unsigned short)(gfx->data.width-1);
|
||||
gfx->data.modMaxY=(unsigned short)(gfx->data.height-1);
|
||||
gfx->data.modMaxX=(short)(gfx->data.width-1);
|
||||
gfx->data.modMaxY=(short)(gfx->data.height-1);
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -108,8 +108,8 @@ void graphicsStructResetState(JsGraphics *gfx) {
|
||||
gfx->data.fontRotate = 0;
|
||||
gfx->data.clipRect.x1 = 0;
|
||||
gfx->data.clipRect.y1 = 0;
|
||||
gfx->data.clipRect.x2 = gfx->data.width-1;
|
||||
gfx->data.clipRect.y2 = gfx->data.height-1;
|
||||
gfx->data.clipRect.x2 = (unsigned short)(gfx->data.width-1);
|
||||
gfx->data.clipRect.y2 = (unsigned short)(gfx->data.height-1);
|
||||
#endif
|
||||
gfx->data.cursorX = 0;
|
||||
gfx->data.cursorY = 0;
|
||||
@ -191,7 +191,7 @@ void graphicsSetVar(JsGraphics *gfx) {
|
||||
|
||||
/// Get the memory requires for this graphics's pixels if everything was packed as densely as possible
|
||||
size_t graphicsGetMemoryRequired(const JsGraphics *gfx) {
|
||||
return (gfx->data.width * gfx->data.height * gfx->data.bpp + 7) >> 3;
|
||||
return (size_t)(gfx->data.width * gfx->data.height * gfx->data.bpp + 7) >> 3;
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------------------------
|
||||
@ -518,7 +518,6 @@ unsigned int graphicsFillVectorChar(JsGraphics *gfx, int x1, int y1, int size, c
|
||||
// returns the width of a character
|
||||
unsigned int graphicsVectorCharWidth(JsGraphics *gfx, unsigned int size, char ch) {
|
||||
NOT_USED(gfx);
|
||||
if (size<0) return 0;
|
||||
if (ch<vectorFontOffset || ch-vectorFontOffset>=vectorFontCount) return 0;
|
||||
unsigned char width = READ_FLASH_UINT8(&vectorFonts[ch-vectorFontOffset].width);
|
||||
return (width * (unsigned int)size)/(VECTOR_FONT_POLY_SIZE*2);
|
||||
|
||||
@ -1188,7 +1188,7 @@ void jsiCheckErrors() {
|
||||
// don't report an issue - we get unreported errors is process.on('unhandledException',)/etc is used
|
||||
//if (!reportedError) jsiConsolePrint("Error.\n");
|
||||
// remove any error flags
|
||||
execInfo.execute &= ~EXEC_ERROR_MASK;
|
||||
execInfo.execute &= (JsExecFlags)~EXEC_ERROR_MASK;
|
||||
}
|
||||
if (lastJsErrorFlags != jsErrorFlags) {
|
||||
JsErrorFlags newErrors = jsErrorFlags & ~lastJsErrorFlags;
|
||||
|
||||
@ -112,7 +112,7 @@ static void jsvStringIteratorLoadFlashString(JsvStringIterator *it) {
|
||||
it->charsInVar = l - it->varIndex;
|
||||
if (it->charsInVar > sizeof(it->flashStringBuffer))
|
||||
it->charsInVar = sizeof(it->flashStringBuffer);
|
||||
jshFlashRead(it->flashStringBuffer, it->varIndex+(uint32_t)it->var->varData.nativeStr.ptr, it->charsInVar);
|
||||
jshFlashRead(it->flashStringBuffer, (uint32_t)it->varIndex+(uint32_t)(size_t)it->var->varData.nativeStr.ptr, (uint32_t)it->charsInVar);
|
||||
it->ptr = (char*)it->flashStringBuffer;
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user