Skip to content

Commit c035859

Browse files
Laurence BankLaurence Bank
authored andcommitted
ran clang-format
1 parent a8f1bd5 commit c035859

File tree

2 files changed

+52
-46
lines changed

2 files changed

+52
-46
lines changed

Adafruit_GFX.cpp

Lines changed: 51 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -246,32 +246,39 @@ void Adafruit_GFX::writeFillRect(int16_t x, int16_t y, int16_t w, int16_t h,
246246

247247
/**************************************************************************/
248248
/*!
249-
@brief set the address window (memory area), overwrite in subclasses if needed
249+
@brief set the address window (memory area), overwrite in subclasses if
250+
needed
250251
*/
251252
/**************************************************************************/
252-
void Adafruit_GFX::setAddrWindow(uint16_t x, uint16_t y, uint16_t w, uint16_t h)
253-
{
254-
(void)x; (void)y; (void)w; (void)h;
253+
void Adafruit_GFX::setAddrWindow(uint16_t x, uint16_t y, uint16_t w,
254+
uint16_t h) {
255+
(void)x;
256+
(void)y;
257+
(void)w;
258+
(void)h;
255259
}
256260

257261
/**************************************************************************/
258262
/*!
259-
@brief write len pixels of the given color, overwrite in subclasses if needed
263+
@brief write len pixels of the given color, overwrite in subclasses if
264+
needed
260265
*/
261266
/**************************************************************************/
262-
void Adafruit_GFX::writeColor(uint16_t color, uint32_t len)
263-
{
264-
(void)color; (void)len;
267+
void Adafruit_GFX::writeColor(uint16_t color, uint32_t len) {
268+
(void)color;
269+
(void)len;
265270
}
266271

267272
/**************************************************************************/
268273
/*!
269274
@brief write a buffer of pixels, overwrite in subclasses if needed
270275
*/
271276
void Adafruit_GFX::writePixels(uint16_t *colors, uint32_t len, bool block,
272-
bool bigEndian)
273-
{
274-
(void)colors; (void)len; (void)block; (void)bigEndian;
277+
bool bigEndian) {
278+
(void)colors;
279+
(void)len;
280+
(void)block;
281+
(void)bigEndian;
275282
}
276283
/**************************************************************************/
277284
/*!
@@ -1176,42 +1183,41 @@ void Adafruit_GFX::drawChar(int16_t x, int16_t y, unsigned char c,
11761183
c++; // Handle 'classic' charset behavior
11771184

11781185
startWrite();
1179-
if (color != bg) { // faster opaque text
1180-
setAddrWindow(x, y, 5*size_x, 7*size_y);
1181-
for (int8_t j = 0; j < 7; j++) { // 7 lines
1182-
uint8_t uc, ucMask = (1 << j);
1183-
for (uint8_t k=0; k<size_y; k++) { // repeat size_y lines
1184-
for (uint8_t i=0; i<5; i++) { // 5 columns
1185-
uc = pgm_read_byte(&font[(c * 5) + i]);
1186-
writeColor((uc & ucMask) ? color:bg, size_x);
1187-
} // for each column
1188-
} // repeat for each line of size_y
1189-
} // for j
1190-
} else
1191-
{ // slower text which doesn't overwrite the background color
1192-
for (int8_t i = 0; i < 5; i++) { // Char bitmap = 5 columns
1193-
uint8_t line = pgm_read_byte(&font[c * 5 + i]);
1194-
for (int8_t j = 0; j < 8; j++, line >>= 1) {
1195-
if (line & 1) {
1196-
if (size_x == 1 && size_y == 1)
1197-
writePixel(x + i, y + j, color);
1198-
else
1199-
writeFillRect(x + i * size_x, y + j * size_y, size_x, size_y,
1200-
color);
1201-
} else if (bg != color) {
1202-
if (size_x == 1 && size_y == 1)
1203-
writePixel(x + i, y + j, bg);
1204-
else
1205-
writeFillRect(x + i * size_x, y + j * size_y, size_x, size_y, bg);
1206-
}
1186+
if (color != bg) { // faster opaque text
1187+
setAddrWindow(x, y, 5 * size_x, 7 * size_y);
1188+
for (int8_t j = 0; j < 7; j++) { // 7 lines
1189+
uint8_t uc, ucMask = (1 << j);
1190+
for (uint8_t k = 0; k < size_y; k++) { // repeat size_y lines
1191+
for (uint8_t i = 0; i < 5; i++) { // 5 columns
1192+
uc = pgm_read_byte(&font[(c * 5) + i]);
1193+
writeColor((uc & ucMask) ? color : bg, size_x);
1194+
} // for each column
1195+
} // repeat for each line of size_y
1196+
} // for j
1197+
} else { // slower text which doesn't overwrite the background color
1198+
for (int8_t i = 0; i < 5; i++) { // Char bitmap = 5 columns
1199+
uint8_t line = pgm_read_byte(&font[c * 5 + i]);
1200+
for (int8_t j = 0; j < 8; j++, line >>= 1) {
1201+
if (line & 1) {
1202+
if (size_x == 1 && size_y == 1)
1203+
writePixel(x + i, y + j, color);
1204+
else
1205+
writeFillRect(x + i * size_x, y + j * size_y, size_x, size_y,
1206+
color);
1207+
} else if (bg != color) {
1208+
if (size_x == 1 && size_y == 1)
1209+
writePixel(x + i, y + j, bg);
1210+
else
1211+
writeFillRect(x + i * size_x, y + j * size_y, size_x, size_y, bg);
12071212
}
12081213
}
1209-
if (bg != color) { // If opaque, draw vertical line for last column
1210-
if (size_x == 1 && size_y == 1)
1211-
writeFastVLine(x + 5, y, 8, bg);
1212-
else
1213-
writeFillRect(x + 5 * size_x, y, size_x, 8 * size_y, bg);
1214-
}
1214+
}
1215+
if (bg != color) { // If opaque, draw vertical line for last column
1216+
if (size_x == 1 && size_y == 1)
1217+
writeFastVLine(x + 5, y, 8, bg);
1218+
else
1219+
writeFillRect(x + 5 * size_x, y, size_x, 8 * size_y, bg);
1220+
}
12151221
}
12161222
endWrite();
12171223

Adafruit_GFX.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class Adafruit_GFX : public Print {
3535
virtual void setAddrWindow(uint16_t x, uint16_t y, uint16_t w, uint16_t h);
3636
virtual void writeColor(uint16_t color, uint32_t len);
3737
virtual void writePixels(uint16_t *colors, uint32_t len, bool block,
38-
bool bigEndian);
38+
bool bigEndian);
3939
virtual void writePixel(int16_t x, int16_t y, uint16_t color);
4040
virtual void writeFillRect(int16_t x, int16_t y, int16_t w, int16_t h,
4141
uint16_t color);

0 commit comments

Comments
 (0)