update clang-format to match original clang
only adjusts some comment spaces in ImageReader.cpp
This commit is contained in:
parent
9f470611e6
commit
a3086d3c22
4 changed files with 44 additions and 35 deletions
|
|
@ -2,12 +2,21 @@ Language: Cpp
|
||||||
BasedOnStyle: Google
|
BasedOnStyle: Google
|
||||||
IndentWidth: 2
|
IndentWidth: 2
|
||||||
ColumnLimit: 80
|
ColumnLimit: 80
|
||||||
AllowShortFunctionsOnASingleLine: Empty
|
AllowShortFunctionsOnASingleLine: All
|
||||||
AllowShortIfStatementsOnASingleLine: false
|
AllowShortIfStatementsOnASingleLine: false
|
||||||
AllowShortLoopsOnASingleLine: false
|
AllowShortLoopsOnASingleLine: false
|
||||||
BinPackArguments: true
|
BinPackArguments: true
|
||||||
BinPackParameters: true
|
BinPackParameters: true
|
||||||
BreakBeforeBraces: Attach
|
BreakBeforeBraces: Attach
|
||||||
DerivePointerAlignment: false
|
DerivePointerAlignment: false
|
||||||
PointerAlignment: Left
|
PointerAlignment: Right
|
||||||
SpacesBeforeTrailingComments: 1
|
SpacesBeforeTrailingComments: 1
|
||||||
|
IndentCaseLabels: true
|
||||||
|
SortIncludes: false
|
||||||
|
AlignTrailingComments: true
|
||||||
|
MaxEmptyLinesToKeep: 2
|
||||||
|
SpaceAfterCStyleCast: false
|
||||||
|
AllowShortBlocksOnASingleLine: false
|
||||||
|
KeepEmptyLinesAtTheStartOfBlocks: true
|
||||||
|
AccessModifierOffset: -2
|
||||||
|
IndentAccessModifiers: false
|
||||||
|
|
@ -529,8 +529,8 @@ ImageReturnCode Adafruit_ImageReader::coreBMP(
|
||||||
}
|
}
|
||||||
} else { // Canvas is simpler,
|
} else { // Canvas is simpler,
|
||||||
file.read(sdbuf, sizeof sdbuf); // just load sdbuf
|
file.read(sdbuf, sizeof sdbuf); // just load sdbuf
|
||||||
} // (destidx never resets)
|
} // (destidx never resets)
|
||||||
srcidx = 0; // Reset bmp buf index
|
srcidx = 0; // Reset bmp buf index
|
||||||
}
|
}
|
||||||
if (depth == 24) {
|
if (depth == 24) {
|
||||||
// Convert each pixel from BMP to 565 format, save in dest
|
// Convert each pixel from BMP to 565 format, save in dest
|
||||||
|
|
@ -564,7 +564,7 @@ ImageReturnCode Adafruit_ImageReader::coreBMP(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} // end pixel loop
|
} // end pixel loop
|
||||||
if (tft) { // Drawing to TFT?
|
if (tft) { // Drawing to TFT?
|
||||||
if (destidx) { // Any remainders?
|
if (destidx) { // Any remainders?
|
||||||
// See notes above re: DMA
|
// See notes above re: DMA
|
||||||
|
|
@ -584,11 +584,11 @@ ImageReturnCode Adafruit_ImageReader::coreBMP(
|
||||||
img->palette = quantized; // Keep palette with img
|
img->palette = quantized; // Keep palette with img
|
||||||
}
|
}
|
||||||
} // end depth>24 or quantized malloc OK
|
} // end depth>24 or quantized malloc OK
|
||||||
} // end top/left clip
|
} // end top/left clip
|
||||||
} // end malloc check
|
} // end malloc check
|
||||||
} // end depth check
|
} // end depth check
|
||||||
} // end planes/compression check
|
} // end planes/compression check
|
||||||
} // end signature
|
} // end signature
|
||||||
|
|
||||||
file.close();
|
file.close();
|
||||||
return status;
|
return status;
|
||||||
|
|
@ -643,7 +643,7 @@ ImageReturnCode Adafruit_ImageReader::bmpDimensions(const char *filename,
|
||||||
@return Unsigned 16-bit value, native endianism.
|
@return Unsigned 16-bit value, native endianism.
|
||||||
*/
|
*/
|
||||||
uint16_t Adafruit_ImageReader::readLE16(void) {
|
uint16_t Adafruit_ImageReader::readLE16(void) {
|
||||||
#if !defined(ESP32) && !defined(ESP8266) && \
|
#if !defined(ESP32) && !defined(ESP8266) && \
|
||||||
(__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)
|
(__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)
|
||||||
// Read directly into result -- BMP data and variable both little-endian.
|
// Read directly into result -- BMP data and variable both little-endian.
|
||||||
uint16_t result;
|
uint16_t result;
|
||||||
|
|
@ -662,7 +662,7 @@ uint16_t Adafruit_ImageReader::readLE16(void) {
|
||||||
@return Unsigned 32-bit value, native endianism.
|
@return Unsigned 32-bit value, native endianism.
|
||||||
*/
|
*/
|
||||||
uint32_t Adafruit_ImageReader::readLE32(void) {
|
uint32_t Adafruit_ImageReader::readLE32(void) {
|
||||||
#if !defined(ESP32) && !defined(ESP8266) && \
|
#if !defined(ESP32) && !defined(ESP8266) && \
|
||||||
(__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)
|
(__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)
|
||||||
// Read directly into result -- BMP data and variable both little-endian.
|
// Read directly into result -- BMP data and variable both little-endian.
|
||||||
uint32_t result;
|
uint32_t result;
|
||||||
|
|
|
||||||
|
|
@ -98,10 +98,10 @@ uint8_t Adafruit_ImageReader_EPD::mapColorForDisplay(uint8_t r, uint8_t g,
|
||||||
Vertical offset in pixels; top edge = 0, positive = down.
|
Vertical offset in pixels; top edge = 0, positive = down.
|
||||||
@return None (void).
|
@return None (void).
|
||||||
*/
|
*/
|
||||||
void Adafruit_Image_EPD::draw(Adafruit_EPD& epd, int16_t x, int16_t y) {
|
void Adafruit_Image_EPD::draw(Adafruit_EPD &epd, int16_t x, int16_t y) {
|
||||||
int16_t col = x, row = y;
|
int16_t col = x, row = y;
|
||||||
if (format == IMAGE_1) {
|
if (format == IMAGE_1) {
|
||||||
uint8_t* buffer = canvas.canvas1->getBuffer();
|
uint8_t *buffer = canvas.canvas1->getBuffer();
|
||||||
uint8_t i, c;
|
uint8_t i, c;
|
||||||
while (row < y + canvas.canvas1->height()) {
|
while (row < y + canvas.canvas1->height()) {
|
||||||
for (i = 0; i < 8; i++) {
|
for (i = 0; i < 8; i++) {
|
||||||
|
|
@ -122,7 +122,7 @@ void Adafruit_Image_EPD::draw(Adafruit_EPD& epd, int16_t x, int16_t y) {
|
||||||
};
|
};
|
||||||
} else if (format == IMAGE_8) {
|
} else if (format == IMAGE_8) {
|
||||||
} else if (format == IMAGE_16) {
|
} else if (format == IMAGE_16) {
|
||||||
uint16_t* buffer = canvas.canvas16->getBuffer();
|
uint16_t *buffer = canvas.canvas16->getBuffer();
|
||||||
thinkinkmode_t displayMode = epd.getMode();
|
thinkinkmode_t displayMode = epd.getMode();
|
||||||
|
|
||||||
while (row < y + canvas.canvas16->height()) {
|
while (row < y + canvas.canvas16->height()) {
|
||||||
|
|
@ -160,7 +160,7 @@ void Adafruit_Image_EPD::draw(Adafruit_EPD& epd, int16_t x, int16_t y) {
|
||||||
often be in pre-setup() declaration, but DOES need initializing
|
often be in pre-setup() declaration, but DOES need initializing
|
||||||
before any of the image loading or size functions are called!
|
before any of the image loading or size functions are called!
|
||||||
*/
|
*/
|
||||||
Adafruit_ImageReader_EPD::Adafruit_ImageReader_EPD(FatVolume& fs)
|
Adafruit_ImageReader_EPD::Adafruit_ImageReader_EPD(FatVolume &fs)
|
||||||
: Adafruit_ImageReader(fs) {}
|
: Adafruit_ImageReader(fs) {}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
|
@ -182,8 +182,8 @@ Adafruit_ImageReader_EPD::Adafruit_ImageReader_EPD(FatVolume& fs)
|
||||||
@return One of the ImageReturnCode values (IMAGE_SUCCESS on successful
|
@return One of the ImageReturnCode values (IMAGE_SUCCESS on successful
|
||||||
completion, other values on failure).
|
completion, other values on failure).
|
||||||
*/
|
*/
|
||||||
ImageReturnCode Adafruit_ImageReader_EPD::drawBMP(char* filename,
|
ImageReturnCode Adafruit_ImageReader_EPD::drawBMP(char *filename,
|
||||||
Adafruit_EPD& epd, int16_t x,
|
Adafruit_EPD &epd, int16_t x,
|
||||||
int16_t y, boolean transact) {
|
int16_t y, boolean transact) {
|
||||||
uint16_t epdbuf[BUFPIXELS]; // Temp space for buffering EPD data
|
uint16_t epdbuf[BUFPIXELS]; // Temp space for buffering EPD data
|
||||||
// Call core BMP-reading function, passing address to EPD object,
|
// Call core BMP-reading function, passing address to EPD object,
|
||||||
|
|
@ -222,12 +222,12 @@ ImageReturnCode Adafruit_ImageReader_EPD::drawBMP(char* filename,
|
||||||
completion, other values on failure).
|
completion, other values on failure).
|
||||||
*/
|
*/
|
||||||
ImageReturnCode Adafruit_ImageReader_EPD::coreBMP(
|
ImageReturnCode Adafruit_ImageReader_EPD::coreBMP(
|
||||||
char* filename, // SD file to load
|
char *filename, // SD file to load
|
||||||
Adafruit_EPD* epd, // Pointer to TFT object, or NULL if to image
|
Adafruit_EPD *epd, // Pointer to TFT object, or NULL if to image
|
||||||
uint16_t* dest, // EPD working buffer, or NULL if to canvas
|
uint16_t *dest, // EPD working buffer, or NULL if to canvas
|
||||||
int16_t x, // Position if loading to EPD (else ignored)
|
int16_t x, // Position if loading to EPD (else ignored)
|
||||||
int16_t y,
|
int16_t y,
|
||||||
Adafruit_Image_EPD* img, // NULL if load-to-screen
|
Adafruit_Image_EPD *img, // NULL if load-to-screen
|
||||||
boolean transact) { // SD & EPD sharing bus, use transactions
|
boolean transact) { // SD & EPD sharing bus, use transactions
|
||||||
thinkinkmode_t displayMode = epd ? epd->getMode() : THINKINK_TRICOLOR;
|
thinkinkmode_t displayMode = epd ? epd->getMode() : THINKINK_TRICOLOR;
|
||||||
ImageReturnCode status = IMAGE_ERR_FORMAT; // IMAGE_SUCCESS on valid file
|
ImageReturnCode status = IMAGE_ERR_FORMAT; // IMAGE_SUCCESS on valid file
|
||||||
|
|
@ -238,7 +238,7 @@ ImageReturnCode Adafruit_ImageReader_EPD::coreBMP(
|
||||||
uint8_t depth; // BMP bit depth
|
uint8_t depth; // BMP bit depth
|
||||||
uint32_t compression = 0; // BMP compression mode
|
uint32_t compression = 0; // BMP compression mode
|
||||||
uint32_t colors = 0; // Number of colors in palette
|
uint32_t colors = 0; // Number of colors in palette
|
||||||
uint16_t* quantized = NULL; // EPD Color palette
|
uint16_t *quantized = NULL; // EPD Color palette
|
||||||
uint32_t rowSize; // >bmpWidth if scanline padding
|
uint32_t rowSize; // >bmpWidth if scanline padding
|
||||||
uint8_t sdbuf[3 * BUFPIXELS]; // BMP read buf (R+G+B/pixel)
|
uint8_t sdbuf[3 * BUFPIXELS]; // BMP read buf (R+G+B/pixel)
|
||||||
int16_t epd_col = 0, epd_row = 0;
|
int16_t epd_col = 0, epd_row = 0;
|
||||||
|
|
@ -248,7 +248,7 @@ ImageReturnCode Adafruit_ImageReader_EPD::coreBMP(
|
||||||
uint16_t srcidx = sizeof sdbuf;
|
uint16_t srcidx = sizeof sdbuf;
|
||||||
#endif
|
#endif
|
||||||
uint32_t destidx = 0;
|
uint32_t destidx = 0;
|
||||||
uint8_t* dest1 = NULL; // Dest ptr for 1-bit BMPs to img
|
uint8_t *dest1 = NULL; // Dest ptr for 1-bit BMPs to img
|
||||||
boolean flip = true; // BMP is stored bottom-to-top
|
boolean flip = true; // BMP is stored bottom-to-top
|
||||||
uint32_t bmpPos = 0; // Next pixel position in file
|
uint32_t bmpPos = 0; // Next pixel position in file
|
||||||
int loadWidth, loadHeight, // Region being loaded (clipped)
|
int loadWidth, loadHeight, // Region being loaded (clipped)
|
||||||
|
|
@ -366,7 +366,7 @@ ImageReturnCode Adafruit_ImageReader_EPD::coreBMP(
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((depth >= 16) ||
|
if ((depth >= 16) ||
|
||||||
(quantized = (uint16_t*)malloc(colors * sizeof(uint16_t)))) {
|
(quantized = (uint16_t *)malloc(colors * sizeof(uint16_t)))) {
|
||||||
if (depth < 16) {
|
if (depth < 16) {
|
||||||
// Load and quantize color table
|
// Load and quantize color table
|
||||||
thinkinkmode_t displayMode =
|
thinkinkmode_t displayMode =
|
||||||
|
|
|
||||||
|
|
@ -23,10 +23,10 @@
|
||||||
ImageReader.loadBMP() and Image.draw(), not ImageReader.drawBMP().
|
ImageReader.loadBMP() and Image.draw(), not ImageReader.drawBMP().
|
||||||
*/
|
*/
|
||||||
class Adafruit_Image_EPD : public Adafruit_Image {
|
class Adafruit_Image_EPD : public Adafruit_Image {
|
||||||
public:
|
public:
|
||||||
void draw(Adafruit_EPD& epd, int16_t x, int16_t y);
|
void draw(Adafruit_EPD &epd, int16_t x, int16_t y);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
friend class Adafruit_ImageReader_EPD; ///< Loading occurs here
|
friend class Adafruit_ImageReader_EPD; ///< Loading occurs here
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -43,17 +43,17 @@ class Adafruit_Image_EPD : public Adafruit_Image {
|
||||||
for use.
|
for use.
|
||||||
*/
|
*/
|
||||||
class Adafruit_ImageReader_EPD : public Adafruit_ImageReader {
|
class Adafruit_ImageReader_EPD : public Adafruit_ImageReader {
|
||||||
public:
|
public:
|
||||||
Adafruit_ImageReader_EPD(FatVolume& fs);
|
Adafruit_ImageReader_EPD(FatVolume &fs);
|
||||||
ImageReturnCode drawBMP(char* filename, Adafruit_EPD& epd, int16_t x,
|
ImageReturnCode drawBMP(char *filename, Adafruit_EPD &epd, int16_t x,
|
||||||
int16_t y, boolean transact = true);
|
int16_t y, boolean transact = true);
|
||||||
|
|
||||||
static uint8_t mapColorForDisplay(uint8_t r, uint8_t g, uint8_t b,
|
static uint8_t mapColorForDisplay(uint8_t r, uint8_t g, uint8_t b,
|
||||||
thinkinkmode_t mode);
|
thinkinkmode_t mode);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
ImageReturnCode coreBMP(char* filename, Adafruit_EPD* epd, uint16_t* dest,
|
ImageReturnCode coreBMP(char *filename, Adafruit_EPD *epd, uint16_t *dest,
|
||||||
int16_t x, int16_t y, Adafruit_Image_EPD* img,
|
int16_t x, int16_t y, Adafruit_Image_EPD *img,
|
||||||
boolean transact);
|
boolean transact);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue