mirror of
https://github.com/lora-aprs/LoRa_APRS_iGate.git
synced 2026-04-05 22:47:00 +00:00
more cppcheck fixes
This commit is contained in:
parent
b5acc47728
commit
2cea42bad1
4 changed files with 40 additions and 9 deletions
|
|
@ -3,18 +3,21 @@
|
|||
#include "FontConfig.h"
|
||||
//#include "OLEDDisplayFonts.h"
|
||||
|
||||
// cppcheck-suppress unusedFunction
|
||||
Bitmap::Bitmap(uint width, uint height)
|
||||
: _width(width), _height(height), _buffer(0)
|
||||
{
|
||||
allocateBuffer();
|
||||
}
|
||||
|
||||
// cppcheck-suppress unusedFunction
|
||||
Bitmap::Bitmap(OLEDDisplay * display)
|
||||
: _width(display->getWidth()), _height(display->getHeight()), _buffer(0)
|
||||
{
|
||||
allocateBuffer();
|
||||
}
|
||||
|
||||
// cppcheck-suppress unusedFunction
|
||||
Bitmap::~Bitmap()
|
||||
{
|
||||
if(_buffer != 0)
|
||||
|
|
@ -23,16 +26,19 @@ Bitmap::~Bitmap()
|
|||
}
|
||||
}
|
||||
|
||||
// cppcheck-suppress unusedFunction
|
||||
uint Bitmap::getWidth() const
|
||||
{
|
||||
return _width;
|
||||
}
|
||||
|
||||
// cppcheck-suppress unusedFunction
|
||||
uint Bitmap::getHeight() const
|
||||
{
|
||||
return _height;
|
||||
}
|
||||
|
||||
// cppcheck-suppress unusedFunction
|
||||
void Bitmap::setPixel(int x, int y)
|
||||
{
|
||||
if(x >= 0 && x < _width && y >= 0 && y < _height)
|
||||
|
|
@ -41,6 +47,7 @@ void Bitmap::setPixel(int x, int y)
|
|||
}
|
||||
}
|
||||
|
||||
// cppcheck-suppress unusedFunction
|
||||
void Bitmap::clearPixel(int x, int y)
|
||||
{
|
||||
if(x >= 0 && x < _width && y >= 0 && y < _height)
|
||||
|
|
@ -49,6 +56,7 @@ void Bitmap::clearPixel(int x, int y)
|
|||
}
|
||||
}
|
||||
|
||||
// cppcheck-suppress unusedFunction
|
||||
bool Bitmap::getPixel(int x, int y) const
|
||||
{
|
||||
if(x >= 0 && x < _width && y >= 0 && y < _height)
|
||||
|
|
@ -58,11 +66,13 @@ bool Bitmap::getPixel(int x, int y) const
|
|||
return false;
|
||||
}
|
||||
|
||||
// cppcheck-suppress unusedFunction
|
||||
void Bitmap::clear()
|
||||
{
|
||||
memset(_buffer, 0, _width * _height / 8);
|
||||
}
|
||||
|
||||
// cppcheck-suppress unusedFunction
|
||||
void Bitmap::drawLine(int x0, int y0, int x1, int y1)
|
||||
{
|
||||
int dx = abs(x1 - x0);
|
||||
|
|
@ -70,7 +80,6 @@ void Bitmap::drawLine(int x0, int y0, int x1, int y1)
|
|||
int sx = x0 < x1 ? 1 : -1;
|
||||
int sy = y0 < y1 ? 1 : -1;
|
||||
int err = (dx > dy ? dx : -dy) / 2;
|
||||
int e2;
|
||||
|
||||
while(true)
|
||||
{
|
||||
|
|
@ -78,7 +87,7 @@ void Bitmap::drawLine(int x0, int y0, int x1, int y1)
|
|||
if(x0 == x1 && y0 == y1)
|
||||
break;
|
||||
|
||||
e2 = err;
|
||||
int e2 = err;
|
||||
if(e2 > -dx)
|
||||
{
|
||||
err -= dy;
|
||||
|
|
@ -92,6 +101,7 @@ void Bitmap::drawLine(int x0, int y0, int x1, int y1)
|
|||
}
|
||||
}
|
||||
|
||||
// cppcheck-suppress unusedFunction
|
||||
void Bitmap::drawHorizontalLine(int x, int y, int length)
|
||||
{
|
||||
if(y < 0 || y >= _height)
|
||||
|
|
@ -105,6 +115,7 @@ void Bitmap::drawHorizontalLine(int x, int y, int length)
|
|||
}
|
||||
}
|
||||
|
||||
// cppcheck-suppress unusedFunction
|
||||
void Bitmap::drawVerticalLine(int x, int y, int length)
|
||||
{
|
||||
if (x < 0 || x >= _width)
|
||||
|
|
@ -118,6 +129,7 @@ void Bitmap::drawVerticalLine(int x, int y, int length)
|
|||
}
|
||||
}
|
||||
|
||||
// cppcheck-suppress unusedFunction
|
||||
void Bitmap::drawRect(int x, int y, int width, int height)
|
||||
{
|
||||
drawHorizontalLine(x, y, width);
|
||||
|
|
@ -126,6 +138,7 @@ void Bitmap::drawRect(int x, int y, int width, int height)
|
|||
drawHorizontalLine(x, y + height - 1, width);
|
||||
}
|
||||
|
||||
// cppcheck-suppress unusedFunction
|
||||
void Bitmap::fillRect(int x, int y, int width, int height)
|
||||
{
|
||||
for (int i = 0; i < width; i++)
|
||||
|
|
@ -134,6 +147,7 @@ void Bitmap::fillRect(int x, int y, int width, int height)
|
|||
}
|
||||
}
|
||||
|
||||
// cppcheck-suppress unusedFunction
|
||||
void Bitmap::drawCircle(int x0, int y0, int radius)
|
||||
{
|
||||
int x = 0;
|
||||
|
|
@ -168,6 +182,7 @@ void Bitmap::drawCircle(int x0, int y0, int radius)
|
|||
setPixel(x0, y0 - radius);
|
||||
}
|
||||
|
||||
// cppcheck-suppress unusedFunction
|
||||
void Bitmap::fillCircle(int x0, int y0, int radius)
|
||||
{
|
||||
int x = 0;
|
||||
|
|
@ -195,6 +210,7 @@ void Bitmap::fillCircle(int x0, int y0, int radius)
|
|||
drawHorizontalLine(x0 - radius, y0, 2 * radius);
|
||||
}
|
||||
|
||||
// cppcheck-suppress unusedFunction
|
||||
void Bitmap::drawCircleQuads(int x0, int y0, int radius, int quads)
|
||||
{
|
||||
int x = 0;
|
||||
|
|
@ -251,6 +267,7 @@ void Bitmap::drawCircleQuads(int x0, int y0, int radius, int quads)
|
|||
}
|
||||
}
|
||||
|
||||
// cppcheck-suppress unusedFunction
|
||||
void Bitmap::drawProgressBar(int x, int y, int width, int height, int progress)
|
||||
{
|
||||
int radius = height / 2;
|
||||
|
|
@ -271,6 +288,7 @@ void Bitmap::drawProgressBar(int x, int y, int width, int height, int progress)
|
|||
fillCircle(xRadius + maxProgressWidth, yRadius, innerRadius);
|
||||
}
|
||||
|
||||
// cppcheck-suppress unusedFunction
|
||||
int Bitmap::drawChar(int x, int y, char c)
|
||||
{
|
||||
fontDesc_t const * font = getSystemFont();
|
||||
|
|
@ -322,6 +340,7 @@ int Bitmap::drawChar(int x, int y, char c)
|
|||
return x + FONT_CHAR_SPACING;
|
||||
}
|
||||
|
||||
// cppcheck-suppress unusedFunction
|
||||
int Bitmap::drawString(int x, int y, String text)
|
||||
{
|
||||
int next_x = x;
|
||||
|
|
@ -332,6 +351,7 @@ int Bitmap::drawString(int x, int y, String text)
|
|||
return next_x;
|
||||
}
|
||||
|
||||
// cppcheck-suppress unusedFunction
|
||||
void Bitmap::drawStringf(int x, int y, char * buffer, String format, ... )
|
||||
{
|
||||
va_list myargs;
|
||||
|
|
@ -341,6 +361,7 @@ void Bitmap::drawStringf(int x, int y, char * buffer, String format, ... )
|
|||
drawString(x, y, buffer);
|
||||
}
|
||||
|
||||
// cppcheck-suppress unusedFunction
|
||||
int Bitmap::drawStringLF(int x, int y, String text)
|
||||
{
|
||||
fontDesc_t const * font = getSystemFont();
|
||||
|
|
@ -357,6 +378,7 @@ int Bitmap::drawStringLF(int x, int y, String text)
|
|||
return next_x;
|
||||
}
|
||||
|
||||
// cppcheck-suppress unusedFunction
|
||||
void Bitmap::drawStringLFf(int x, int y, char * buffer, String format, ... )
|
||||
{
|
||||
va_list myargs;
|
||||
|
|
@ -394,6 +416,7 @@ void Bitmap::drawStringLFf(int x, int y, char * buffer, String format, ... )
|
|||
}
|
||||
}*/
|
||||
|
||||
// cppcheck-suppress unusedFunction
|
||||
void Bitmap::allocateBuffer()
|
||||
{
|
||||
_buffer = new uint8_t[_width * _height / 8];
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue