Skip to content

Commit 6791eac

Browse files
Re-running clang-format after the rebase
1 parent c53e9d2 commit 6791eac

File tree

2 files changed

+113
-104
lines changed

2 files changed

+113
-104
lines changed

Adafruit_GFX.cpp

Lines changed: 105 additions & 102 deletions
Original file line numberDiff line numberDiff line change
@@ -1738,8 +1738,10 @@ boolean Adafruit_GFX_Button::justReleased() {
17381738

17391739
#ifdef __AVR__
17401740
// Bitmask tables of 0x80>>X and ~(0x80>>X), because X>>Y is slow on AVR
1741-
const uint8_t PROGMEM GFXcanvas1::GFXsetBit[] = { 0x80, 0x40, 0x20, 0x10, 0x08, 0x04, 0x02, 0x01 };
1742-
const uint8_t PROGMEM GFXcanvas1::GFXclrBit[] = { 0x7F, 0xBF, 0xDF, 0xEF, 0xF7, 0xFB, 0xFD, 0xFE };
1741+
const uint8_t PROGMEM GFXcanvas1::GFXsetBit[] = {0x80, 0x40, 0x20, 0x10,
1742+
0x08, 0x04, 0x02, 0x01};
1743+
const uint8_t PROGMEM GFXcanvas1::GFXclrBit[] = {0x7F, 0xBF, 0xDF, 0xEF,
1744+
0xF7, 0xFB, 0xFD, 0xFE};
17431745
#endif
17441746

17451747
/**************************************************************************/
@@ -1814,60 +1816,61 @@ void GFXcanvas1::drawPixel(int16_t x, int16_t y, uint16_t color) {
18141816

18151817
/**********************************************************************/
18161818
/*!
1817-
@brief Get the pixel color value at a given coordinate
1818-
@param x x coordinate
1819-
@param y y coordinate
1820-
@returns The desired pixel's binary color value, either 0x1 (on) or 0x0 (off)
1819+
@brief Get the pixel color value at a given coordinate
1820+
@param x x coordinate
1821+
@param y y coordinate
1822+
@returns The desired pixel's binary color value, either 0x1 (on) or 0x0
1823+
(off)
18211824
*/
18221825
/**********************************************************************/
18231826
bool GFXcanvas1::getPixel(int16_t x, int16_t y) const {
1824-
int16_t t;
1825-
switch(rotation) {
1826-
case 1:
1827-
t = x;
1828-
x = WIDTH - 1 - y;
1829-
y = t;
1830-
break;
1831-
case 2:
1832-
x = WIDTH - 1 - x;
1833-
y = HEIGHT - 1 - y;
1834-
break;
1835-
case 3:
1836-
t = x;
1837-
x = y;
1838-
y = HEIGHT - 1 - t;
1839-
break;
1840-
}
1841-
return getRawPixel(x, y);
1827+
int16_t t;
1828+
switch (rotation) {
1829+
case 1:
1830+
t = x;
1831+
x = WIDTH - 1 - y;
1832+
y = t;
1833+
break;
1834+
case 2:
1835+
x = WIDTH - 1 - x;
1836+
y = HEIGHT - 1 - y;
1837+
break;
1838+
case 3:
1839+
t = x;
1840+
x = y;
1841+
y = HEIGHT - 1 - t;
1842+
break;
1843+
}
1844+
return getRawPixel(x, y);
18421845
}
18431846

18441847
/**********************************************************************/
18451848
/*!
1846-
@brief Get the pixel color value at a given, unrotated coordinate.
1849+
@brief Get the pixel color value at a given, unrotated coordinate.
18471850
This method is intended for hardware drivers to get pixel value
18481851
in physical coordinates.
1849-
@param x x coordinate
1850-
@param y y coordinate
1851-
@returns The desired pixel's binary color value, either 0x1 (on) or 0x0 (off)
1852+
@param x x coordinate
1853+
@param y y coordinate
1854+
@returns The desired pixel's binary color value, either 0x1 (on) or 0x0
1855+
(off)
18521856
*/
18531857
/**********************************************************************/
18541858
bool GFXcanvas1::getRawPixel(int16_t x, int16_t y) const {
1855-
if((x < 0) || (y < 0) || (x >= WIDTH) || (y >= HEIGHT)) return 0;
1856-
if(this->getBuffer()) {
1857-
uint8_t *buffer = this->getBuffer();
1858-
uint8_t *ptr = &buffer[(x / 8) + y * ((WIDTH + 7) / 8)];
1859+
if ((x < 0) || (y < 0) || (x >= WIDTH) || (y >= HEIGHT))
1860+
return 0;
1861+
if (this->getBuffer()) {
1862+
uint8_t *buffer = this->getBuffer();
1863+
uint8_t *ptr = &buffer[(x / 8) + y * ((WIDTH + 7) / 8)];
18591864

18601865
#ifdef __AVR__
1861-
return ((*ptr) & pgm_read_byte(&GFXsetBit[x & 7])) != 0;
1866+
return ((*ptr) & pgm_read_byte(&GFXsetBit[x & 7])) != 0;
18621867
#else
1863-
return ((*ptr) & (0x80 >> (x & 7))) != 0;
1868+
return ((*ptr) & (0x80 >> (x & 7))) != 0;
18641869
#endif
1865-
}
1866-
return 0;
1870+
}
1871+
return 0;
18671872
}
18681873

1869-
1870-
18711874
/**************************************************************************/
18721875
/*!
18731876
@brief Fill the framebuffer completely with one color
@@ -1942,52 +1945,52 @@ void GFXcanvas8::drawPixel(int16_t x, int16_t y, uint16_t color) {
19421945

19431946
/**********************************************************************/
19441947
/*!
1945-
@brief Get the pixel color value at a given coordinate
1946-
@param x x coordinate
1947-
@param y y coordinate
1948-
@returns The desired pixel's 8-bit color value
1948+
@brief Get the pixel color value at a given coordinate
1949+
@param x x coordinate
1950+
@param y y coordinate
1951+
@returns The desired pixel's 8-bit color value
19491952
*/
19501953
/**********************************************************************/
19511954
uint8_t GFXcanvas8::getPixel(int16_t x, int16_t y) const {
1952-
int16_t t;
1953-
switch(rotation) {
1954-
case 1:
1955-
t = x;
1956-
x = WIDTH - 1 - y;
1957-
y = t;
1958-
break;
1959-
case 2:
1960-
x = WIDTH - 1 - x;
1961-
y = HEIGHT - 1 - y;
1962-
break;
1963-
case 3:
1964-
t = x;
1965-
x = y;
1966-
y = HEIGHT - 1 - t;
1967-
break;
1968-
}
1969-
return getRawPixel(x, y);
1955+
int16_t t;
1956+
switch (rotation) {
1957+
case 1:
1958+
t = x;
1959+
x = WIDTH - 1 - y;
1960+
y = t;
1961+
break;
1962+
case 2:
1963+
x = WIDTH - 1 - x;
1964+
y = HEIGHT - 1 - y;
1965+
break;
1966+
case 3:
1967+
t = x;
1968+
x = y;
1969+
y = HEIGHT - 1 - t;
1970+
break;
1971+
}
1972+
return getRawPixel(x, y);
19701973
}
19711974

19721975
/**********************************************************************/
19731976
/*!
1974-
@brief Get the pixel color value at a given, unrotated coordinate.
1977+
@brief Get the pixel color value at a given, unrotated coordinate.
19751978
This method is intended for hardware drivers to get pixel value
19761979
in physical coordinates.
1977-
@param x x coordinate
1978-
@param y y coordinate
1979-
@returns The desired pixel's 8-bit color value
1980+
@param x x coordinate
1981+
@param y y coordinate
1982+
@returns The desired pixel's 8-bit color value
19801983
*/
19811984
/**********************************************************************/
19821985
uint8_t GFXcanvas8::getRawPixel(int16_t x, int16_t y) const {
1983-
if((x < 0) || (y < 0) || (x >= WIDTH) || (y >= HEIGHT)) return 0;
1984-
if(buffer) {
1985-
return buffer[x + y * WIDTH];
1986-
}
1987-
return 0;
1986+
if ((x < 0) || (y < 0) || (x >= WIDTH) || (y >= HEIGHT))
1987+
return 0;
1988+
if (buffer) {
1989+
return buffer[x + y * WIDTH];
1990+
}
1991+
return 0;
19881992
}
19891993

1990-
19911994
/**************************************************************************/
19921995
/*!
19931996
@brief Fill the framebuffer completely with one color
@@ -2099,52 +2102,52 @@ void GFXcanvas16::drawPixel(int16_t x, int16_t y, uint16_t color) {
20992102

21002103
/**********************************************************************/
21012104
/*!
2102-
@brief Get the pixel color value at a given coordinate
2103-
@param x x coordinate
2104-
@param y y coordinate
2105-
@returns The desired pixel's 16-bit 5-6-5 color value
2105+
@brief Get the pixel color value at a given coordinate
2106+
@param x x coordinate
2107+
@param y y coordinate
2108+
@returns The desired pixel's 16-bit 5-6-5 color value
21062109
*/
21072110
/**********************************************************************/
21082111
uint16_t GFXcanvas16::getPixel(int16_t x, int16_t y) const {
2109-
int16_t t;
2110-
switch(rotation) {
2111-
case 1:
2112-
t = x;
2113-
x = WIDTH - 1 - y;
2114-
y = t;
2115-
break;
2116-
case 2:
2117-
x = WIDTH - 1 - x;
2118-
y = HEIGHT - 1 - y;
2119-
break;
2120-
case 3:
2121-
t = x;
2122-
x = y;
2123-
y = HEIGHT - 1 - t;
2124-
break;
2125-
}
2126-
return getRawPixel(x, y);
2112+
int16_t t;
2113+
switch (rotation) {
2114+
case 1:
2115+
t = x;
2116+
x = WIDTH - 1 - y;
2117+
y = t;
2118+
break;
2119+
case 2:
2120+
x = WIDTH - 1 - x;
2121+
y = HEIGHT - 1 - y;
2122+
break;
2123+
case 3:
2124+
t = x;
2125+
x = y;
2126+
y = HEIGHT - 1 - t;
2127+
break;
2128+
}
2129+
return getRawPixel(x, y);
21272130
}
21282131

21292132
/**********************************************************************/
21302133
/*!
2131-
@brief Get the pixel color value at a given, unrotated coordinate.
2134+
@brief Get the pixel color value at a given, unrotated coordinate.
21322135
This method is intended for hardware drivers to get pixel value
21332136
in physical coordinates.
2134-
@param x x coordinate
2135-
@param y y coordinate
2136-
@returns The desired pixel's 16-bit 5-6-5 color value
2137+
@param x x coordinate
2138+
@param y y coordinate
2139+
@returns The desired pixel's 16-bit 5-6-5 color value
21372140
*/
21382141
/**********************************************************************/
21392142
uint16_t GFXcanvas16::getRawPixel(int16_t x, int16_t y) const {
2140-
if((x < 0) || (y < 0) || (x >= WIDTH) || (y >= HEIGHT)) return 0;
2141-
if(buffer) {
2142-
return buffer[x + y * WIDTH];
2143-
}
2144-
return 0;
2143+
if ((x < 0) || (y < 0) || (x >= WIDTH) || (y >= HEIGHT))
2144+
return 0;
2145+
if (buffer) {
2146+
return buffer[x + y * WIDTH];
2147+
}
2148+
return 0;
21452149
}
21462150

2147-
21482151
/**************************************************************************/
21492152
/*!
21502153
@brief Fill the framebuffer completely with one color

Adafruit_GFX.h

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -318,8 +318,10 @@ class GFXcanvas1 : public Adafruit_GFX {
318318
*/
319319
/**********************************************************************/
320320
uint8_t *getBuffer(void) const { return buffer; }
321+
321322
protected:
322323
bool getRawPixel(int16_t x, int16_t y) const;
324+
323325
private:
324326
uint8_t *buffer;
325327

@@ -345,8 +347,10 @@ class GFXcanvas8 : public Adafruit_GFX {
345347
*/
346348
/**********************************************************************/
347349
uint8_t *getBuffer(void) const { return buffer; }
350+
348351
protected:
349352
uint8_t getRawPixel(int16_t x, int16_t y) const;
353+
350354
private:
351355
uint8_t *buffer;
352356
};
@@ -359,16 +363,18 @@ class GFXcanvas16 : public Adafruit_GFX {
359363
void drawPixel(int16_t x, int16_t y, uint16_t color);
360364
void fillScreen(uint16_t color);
361365
void byteSwap(void);
362-
uint16_t getPixel(int16_t x, int16_t y) const;
366+
uint16_t getPixel(int16_t x, int16_t y) const;
363367
/**********************************************************************/
364368
/*!
365369
@brief Get a pointer to the internal buffer memory
366370
@returns A pointer to the allocated buffer
367371
*/
368372
/**********************************************************************/
369373
uint16_t *getBuffer(void) const { return buffer; }
374+
370375
protected:
371-
uint16_t getRawPixel(int16_t x, int16_t y) const;
376+
uint16_t getRawPixel(int16_t x, int16_t y) const;
377+
372378
private:
373379
uint16_t *buffer;
374380
};

0 commit comments

Comments
 (0)