blendPixelColor Shortcut
Don't call color_blend if not needed.
This commit is contained in:
@@ -403,7 +403,8 @@ uint32_t IRAM_ATTR_YN Segment::getPixelColorXY(int x, int y) {
|
|||||||
|
|
||||||
// Blends the specified color with the existing pixel color.
|
// Blends the specified color with the existing pixel color.
|
||||||
void Segment::blendPixelColorXY(uint16_t x, uint16_t y, uint32_t color, uint8_t blend) {
|
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.
|
// Adds the specified color with the existing pixel color perserving color balance.
|
||||||
|
|||||||
@@ -1362,7 +1362,8 @@ void Segment::fill(uint32_t c) {
|
|||||||
|
|
||||||
// Blends the specified color with the existing pixel color.
|
// Blends the specified color with the existing pixel color.
|
||||||
void Segment::blendPixelColor(int n, uint32_t color, uint8_t blend) {
|
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.
|
// Adds the specified color with the existing pixel color perserving color balance.
|
||||||
|
|||||||
Reference in New Issue
Block a user