mirror of
https://github.com/adafruit/Adafruit-GFX-Library.git
synced 2024-10-03 18:18:46 -04:00
Re-running clang-format after the rebase
This commit is contained in:
parent
c53e9d24aa
commit
6791eaca01
207
Adafruit_GFX.cpp
207
Adafruit_GFX.cpp
@ -1738,8 +1738,10 @@ boolean Adafruit_GFX_Button::justReleased() {
|
|||||||
|
|
||||||
#ifdef __AVR__
|
#ifdef __AVR__
|
||||||
// Bitmask tables of 0x80>>X and ~(0x80>>X), because X>>Y is slow on AVR
|
// Bitmask tables of 0x80>>X and ~(0x80>>X), because X>>Y is slow on AVR
|
||||||
const uint8_t PROGMEM GFXcanvas1::GFXsetBit[] = { 0x80, 0x40, 0x20, 0x10, 0x08, 0x04, 0x02, 0x01 };
|
const uint8_t PROGMEM GFXcanvas1::GFXsetBit[] = {0x80, 0x40, 0x20, 0x10,
|
||||||
const uint8_t PROGMEM GFXcanvas1::GFXclrBit[] = { 0x7F, 0xBF, 0xDF, 0xEF, 0xF7, 0xFB, 0xFD, 0xFE };
|
0x08, 0x04, 0x02, 0x01};
|
||||||
|
const uint8_t PROGMEM GFXcanvas1::GFXclrBit[] = {0x7F, 0xBF, 0xDF, 0xEF,
|
||||||
|
0xF7, 0xFB, 0xFD, 0xFE};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**************************************************************************/
|
/**************************************************************************/
|
||||||
@ -1814,60 +1816,61 @@ void GFXcanvas1::drawPixel(int16_t x, int16_t y, uint16_t color) {
|
|||||||
|
|
||||||
/**********************************************************************/
|
/**********************************************************************/
|
||||||
/*!
|
/*!
|
||||||
@brief Get the pixel color value at a given coordinate
|
@brief Get the pixel color value at a given coordinate
|
||||||
@param x x coordinate
|
@param x x coordinate
|
||||||
@param y y coordinate
|
@param y y coordinate
|
||||||
@returns The desired pixel's binary color value, either 0x1 (on) or 0x0 (off)
|
@returns The desired pixel's binary color value, either 0x1 (on) or 0x0
|
||||||
|
(off)
|
||||||
*/
|
*/
|
||||||
/**********************************************************************/
|
/**********************************************************************/
|
||||||
bool GFXcanvas1::getPixel(int16_t x, int16_t y) const {
|
bool GFXcanvas1::getPixel(int16_t x, int16_t y) const {
|
||||||
int16_t t;
|
int16_t t;
|
||||||
switch(rotation) {
|
switch (rotation) {
|
||||||
case 1:
|
case 1:
|
||||||
t = x;
|
t = x;
|
||||||
x = WIDTH - 1 - y;
|
x = WIDTH - 1 - y;
|
||||||
y = t;
|
y = t;
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
x = WIDTH - 1 - x;
|
x = WIDTH - 1 - x;
|
||||||
y = HEIGHT - 1 - y;
|
y = HEIGHT - 1 - y;
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
t = x;
|
t = x;
|
||||||
x = y;
|
x = y;
|
||||||
y = HEIGHT - 1 - t;
|
y = HEIGHT - 1 - t;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return getRawPixel(x, y);
|
return getRawPixel(x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**********************************************************************/
|
/**********************************************************************/
|
||||||
/*!
|
/*!
|
||||||
@brief Get the pixel color value at a given, unrotated coordinate.
|
@brief Get the pixel color value at a given, unrotated coordinate.
|
||||||
This method is intended for hardware drivers to get pixel value
|
This method is intended for hardware drivers to get pixel value
|
||||||
in physical coordinates.
|
in physical coordinates.
|
||||||
@param x x coordinate
|
@param x x coordinate
|
||||||
@param y y coordinate
|
@param y y coordinate
|
||||||
@returns The desired pixel's binary color value, either 0x1 (on) or 0x0 (off)
|
@returns The desired pixel's binary color value, either 0x1 (on) or 0x0
|
||||||
|
(off)
|
||||||
*/
|
*/
|
||||||
/**********************************************************************/
|
/**********************************************************************/
|
||||||
bool GFXcanvas1::getRawPixel(int16_t x, int16_t y) const {
|
bool GFXcanvas1::getRawPixel(int16_t x, int16_t y) const {
|
||||||
if((x < 0) || (y < 0) || (x >= WIDTH) || (y >= HEIGHT)) return 0;
|
if ((x < 0) || (y < 0) || (x >= WIDTH) || (y >= HEIGHT))
|
||||||
if(this->getBuffer()) {
|
return 0;
|
||||||
uint8_t *buffer = this->getBuffer();
|
if (this->getBuffer()) {
|
||||||
uint8_t *ptr = &buffer[(x / 8) + y * ((WIDTH + 7) / 8)];
|
uint8_t *buffer = this->getBuffer();
|
||||||
|
uint8_t *ptr = &buffer[(x / 8) + y * ((WIDTH + 7) / 8)];
|
||||||
|
|
||||||
#ifdef __AVR__
|
#ifdef __AVR__
|
||||||
return ((*ptr) & pgm_read_byte(&GFXsetBit[x & 7])) != 0;
|
return ((*ptr) & pgm_read_byte(&GFXsetBit[x & 7])) != 0;
|
||||||
#else
|
#else
|
||||||
return ((*ptr) & (0x80 >> (x & 7))) != 0;
|
return ((*ptr) & (0x80 >> (x & 7))) != 0;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**************************************************************************/
|
/**************************************************************************/
|
||||||
/*!
|
/*!
|
||||||
@brief Fill the framebuffer completely with one color
|
@brief Fill the framebuffer completely with one color
|
||||||
@ -1942,52 +1945,52 @@ void GFXcanvas8::drawPixel(int16_t x, int16_t y, uint16_t color) {
|
|||||||
|
|
||||||
/**********************************************************************/
|
/**********************************************************************/
|
||||||
/*!
|
/*!
|
||||||
@brief Get the pixel color value at a given coordinate
|
@brief Get the pixel color value at a given coordinate
|
||||||
@param x x coordinate
|
@param x x coordinate
|
||||||
@param y y coordinate
|
@param y y coordinate
|
||||||
@returns The desired pixel's 8-bit color value
|
@returns The desired pixel's 8-bit color value
|
||||||
*/
|
*/
|
||||||
/**********************************************************************/
|
/**********************************************************************/
|
||||||
uint8_t GFXcanvas8::getPixel(int16_t x, int16_t y) const {
|
uint8_t GFXcanvas8::getPixel(int16_t x, int16_t y) const {
|
||||||
int16_t t;
|
int16_t t;
|
||||||
switch(rotation) {
|
switch (rotation) {
|
||||||
case 1:
|
case 1:
|
||||||
t = x;
|
t = x;
|
||||||
x = WIDTH - 1 - y;
|
x = WIDTH - 1 - y;
|
||||||
y = t;
|
y = t;
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
x = WIDTH - 1 - x;
|
x = WIDTH - 1 - x;
|
||||||
y = HEIGHT - 1 - y;
|
y = HEIGHT - 1 - y;
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
t = x;
|
t = x;
|
||||||
x = y;
|
x = y;
|
||||||
y = HEIGHT - 1 - t;
|
y = HEIGHT - 1 - t;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return getRawPixel(x, y);
|
return getRawPixel(x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**********************************************************************/
|
/**********************************************************************/
|
||||||
/*!
|
/*!
|
||||||
@brief Get the pixel color value at a given, unrotated coordinate.
|
@brief Get the pixel color value at a given, unrotated coordinate.
|
||||||
This method is intended for hardware drivers to get pixel value
|
This method is intended for hardware drivers to get pixel value
|
||||||
in physical coordinates.
|
in physical coordinates.
|
||||||
@param x x coordinate
|
@param x x coordinate
|
||||||
@param y y coordinate
|
@param y y coordinate
|
||||||
@returns The desired pixel's 8-bit color value
|
@returns The desired pixel's 8-bit color value
|
||||||
*/
|
*/
|
||||||
/**********************************************************************/
|
/**********************************************************************/
|
||||||
uint8_t GFXcanvas8::getRawPixel(int16_t x, int16_t y) const {
|
uint8_t GFXcanvas8::getRawPixel(int16_t x, int16_t y) const {
|
||||||
if((x < 0) || (y < 0) || (x >= WIDTH) || (y >= HEIGHT)) return 0;
|
if ((x < 0) || (y < 0) || (x >= WIDTH) || (y >= HEIGHT))
|
||||||
if(buffer) {
|
return 0;
|
||||||
return buffer[x + y * WIDTH];
|
if (buffer) {
|
||||||
}
|
return buffer[x + y * WIDTH];
|
||||||
return 0;
|
}
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**************************************************************************/
|
/**************************************************************************/
|
||||||
/*!
|
/*!
|
||||||
@brief Fill the framebuffer completely with one color
|
@brief Fill the framebuffer completely with one color
|
||||||
@ -2099,52 +2102,52 @@ void GFXcanvas16::drawPixel(int16_t x, int16_t y, uint16_t color) {
|
|||||||
|
|
||||||
/**********************************************************************/
|
/**********************************************************************/
|
||||||
/*!
|
/*!
|
||||||
@brief Get the pixel color value at a given coordinate
|
@brief Get the pixel color value at a given coordinate
|
||||||
@param x x coordinate
|
@param x x coordinate
|
||||||
@param y y coordinate
|
@param y y coordinate
|
||||||
@returns The desired pixel's 16-bit 5-6-5 color value
|
@returns The desired pixel's 16-bit 5-6-5 color value
|
||||||
*/
|
*/
|
||||||
/**********************************************************************/
|
/**********************************************************************/
|
||||||
uint16_t GFXcanvas16::getPixel(int16_t x, int16_t y) const {
|
uint16_t GFXcanvas16::getPixel(int16_t x, int16_t y) const {
|
||||||
int16_t t;
|
int16_t t;
|
||||||
switch(rotation) {
|
switch (rotation) {
|
||||||
case 1:
|
case 1:
|
||||||
t = x;
|
t = x;
|
||||||
x = WIDTH - 1 - y;
|
x = WIDTH - 1 - y;
|
||||||
y = t;
|
y = t;
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
x = WIDTH - 1 - x;
|
x = WIDTH - 1 - x;
|
||||||
y = HEIGHT - 1 - y;
|
y = HEIGHT - 1 - y;
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
t = x;
|
t = x;
|
||||||
x = y;
|
x = y;
|
||||||
y = HEIGHT - 1 - t;
|
y = HEIGHT - 1 - t;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return getRawPixel(x, y);
|
return getRawPixel(x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**********************************************************************/
|
/**********************************************************************/
|
||||||
/*!
|
/*!
|
||||||
@brief Get the pixel color value at a given, unrotated coordinate.
|
@brief Get the pixel color value at a given, unrotated coordinate.
|
||||||
This method is intended for hardware drivers to get pixel value
|
This method is intended for hardware drivers to get pixel value
|
||||||
in physical coordinates.
|
in physical coordinates.
|
||||||
@param x x coordinate
|
@param x x coordinate
|
||||||
@param y y coordinate
|
@param y y coordinate
|
||||||
@returns The desired pixel's 16-bit 5-6-5 color value
|
@returns The desired pixel's 16-bit 5-6-5 color value
|
||||||
*/
|
*/
|
||||||
/**********************************************************************/
|
/**********************************************************************/
|
||||||
uint16_t GFXcanvas16::getRawPixel(int16_t x, int16_t y) const {
|
uint16_t GFXcanvas16::getRawPixel(int16_t x, int16_t y) const {
|
||||||
if((x < 0) || (y < 0) || (x >= WIDTH) || (y >= HEIGHT)) return 0;
|
if ((x < 0) || (y < 0) || (x >= WIDTH) || (y >= HEIGHT))
|
||||||
if(buffer) {
|
return 0;
|
||||||
return buffer[x + y * WIDTH];
|
if (buffer) {
|
||||||
}
|
return buffer[x + y * WIDTH];
|
||||||
return 0;
|
}
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**************************************************************************/
|
/**************************************************************************/
|
||||||
/*!
|
/*!
|
||||||
@brief Fill the framebuffer completely with one color
|
@brief Fill the framebuffer completely with one color
|
||||||
|
@ -318,8 +318,10 @@ public:
|
|||||||
*/
|
*/
|
||||||
/**********************************************************************/
|
/**********************************************************************/
|
||||||
uint8_t *getBuffer(void) const { return buffer; }
|
uint8_t *getBuffer(void) const { return buffer; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool getRawPixel(int16_t x, int16_t y) const;
|
bool getRawPixel(int16_t x, int16_t y) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
uint8_t *buffer;
|
uint8_t *buffer;
|
||||||
|
|
||||||
@ -345,8 +347,10 @@ public:
|
|||||||
*/
|
*/
|
||||||
/**********************************************************************/
|
/**********************************************************************/
|
||||||
uint8_t *getBuffer(void) const { return buffer; }
|
uint8_t *getBuffer(void) const { return buffer; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
uint8_t getRawPixel(int16_t x, int16_t y) const;
|
uint8_t getRawPixel(int16_t x, int16_t y) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
uint8_t *buffer;
|
uint8_t *buffer;
|
||||||
};
|
};
|
||||||
@ -359,7 +363,7 @@ public:
|
|||||||
void drawPixel(int16_t x, int16_t y, uint16_t color);
|
void drawPixel(int16_t x, int16_t y, uint16_t color);
|
||||||
void fillScreen(uint16_t color);
|
void fillScreen(uint16_t color);
|
||||||
void byteSwap(void);
|
void byteSwap(void);
|
||||||
uint16_t getPixel(int16_t x, int16_t y) const;
|
uint16_t getPixel(int16_t x, int16_t y) const;
|
||||||
/**********************************************************************/
|
/**********************************************************************/
|
||||||
/*!
|
/*!
|
||||||
@brief Get a pointer to the internal buffer memory
|
@brief Get a pointer to the internal buffer memory
|
||||||
@ -367,8 +371,10 @@ public:
|
|||||||
*/
|
*/
|
||||||
/**********************************************************************/
|
/**********************************************************************/
|
||||||
uint16_t *getBuffer(void) const { return buffer; }
|
uint16_t *getBuffer(void) const { return buffer; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
uint16_t getRawPixel(int16_t x, int16_t y) const;
|
uint16_t getRawPixel(int16_t x, int16_t y) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
uint16_t *buffer;
|
uint16_t *buffer;
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user