diff --git a/src/include/Image.h b/src/include/Image.h index 2913c4e0..a1be3f79 100644 --- a/src/include/Image.h +++ b/src/include/Image.h @@ -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); @@ -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); diff --git a/src/include/ImageBMP.cpp b/src/include/ImageBMP.cpp index a7fea934..e98d17de 100644 --- a/src/include/ImageBMP.cpp +++ b/src/include/ImageBMP.cpp @@ -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); @@ -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; @@ -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));