blendPixelColor Shortcut

Don't call color_blend if not needed.
This commit is contained in:
Brandon502
2024-07-17 14:34:17 -04:00
parent 67d777f474
commit e759c4bd16
2 changed files with 4 additions and 2 deletions

View File

@@ -403,7 +403,8 @@ uint32_t IRAM_ATTR_YN Segment::getPixelColorXY(int x, int y) {
// Blends the specified color with the existing pixel color.
void Segment::blendPixelColorXY(uint16_t x, uint16_t y, uint32_t color, uint8_t blend) {
setPixelColorXY(x, y, color_blend(getPixelColorXY(x,y), color, blend));
if (blend == UINT8_MAX) setPixelColorXY(x, y, color);
else setPixelColorXY(x, y, color_blend(getPixelColorXY(x,y), color, blend));
}
// Adds the specified color with the existing pixel color perserving color balance.

View File

@@ -1362,7 +1362,8 @@ void Segment::fill(uint32_t c) {
// Blends the specified color with the existing pixel color.
void Segment::blendPixelColor(int n, uint32_t color, uint8_t blend) {
setPixelColor(n, color_blend(getPixelColor(n), color, blend));
if (blend == UINT8_MAX) setPixelColor(n, color);
else setPixelColor(n, color_blend(getPixelColor(n), color, blend));
}
// Adds the specified color with the existing pixel color perserving color balance.