Skip to content

Add a couple of missing const declarations #200

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/include/Image.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ class Image : virtual public NetworkClient, virtual public Adafruit_GFX

void drawBitmap3Bit(int16_t _x, int16_t _y, const unsigned char *_p, int16_t _w, int16_t _h);

bool drawBitmapFromBuffer(uint8_t *buf, int x, int y, bool dither, bool invert);
bool drawBitmapFromBuffer(const uint8_t *buf, int x, int y, bool dither, bool invert);

bool drawBitmapFromSd(const char *fileName, int x, int y, bool dither = 0, bool invert = 0);
bool drawBitmapFromSd(SdFile *p, int x, int y, bool dither = 0, bool invert = 0);
Expand Down Expand Up @@ -169,7 +169,7 @@ class Image : virtual public NetworkClient, virtual public Adafruit_GFX
uint8_t ditherGetPixelJpeg(uint8_t px, int i, int j, int x, int y, int w, int h);
void ditherSwapBlockJpeg(int x);

void readBmpHeader(uint8_t *buf, bitmapHeader *_h);
void readBmpHeader(const uint8_t *buf, bitmapHeader *_h);
void readBmpHeaderSd(SdFile *_f, bitmapHeader *_h);

inline void displayBmpLine(int16_t x, int16_t y, bitmapHeader *bmpHeader, bool dither, bool invert);
Expand Down
6 changes: 3 additions & 3 deletions src/include/ImageBMP.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ void Image::readBmpHeaderSd(SdFile *_f, bitmapHeader *_h)
* @param bitmspHeader *_h
* Bitmap image header to save data to
*/
void Image::readBmpHeader(uint8_t *buf, bitmapHeader *_h)
void Image::readBmpHeader(const uint8_t *buf, bitmapHeader *_h)
{
_h->signature = READ16(buf + 0);
_h->fileSize = READ32(buf + 2);
Expand Down Expand Up @@ -273,7 +273,7 @@ bool Image::drawBitmapFromWeb(WiFiClient *s, int x, int y, int32_t len, bool dit
*
* @return 1 if drawn successfully, 0 if not
*/
bool Image::drawBitmapFromBuffer(uint8_t *buf, int x, int y, bool dither, bool invert)
bool Image::drawBitmapFromBuffer(const uint8_t *buf, int x, int y, bool dither, bool invert)
{

bitmapHeader bmpHeader;
Expand All @@ -286,7 +286,7 @@ bool Image::drawBitmapFromBuffer(uint8_t *buf, int x, int y, bool dither, bool i
if (dither)
memset(ditherBuffer, 0, sizeof ditherBuffer);

uint8_t *bufferPtr = buf + bmpHeader.startRAW;
const uint8_t *bufferPtr = buf + bmpHeader.startRAW;
for (int i = 0; i < bmpHeader.height; ++i)
{
memcpy(pixelBuffer, bufferPtr, ROWSIZE(bmpHeader.width, bmpHeader.color));
Expand Down