From 3919b61b3add6b7e68c3ed02edfa5323a54f304b Mon Sep 17 00:00:00 2001 From: Michael Miller Date: Thu, 21 Oct 2021 10:46:15 -0700 Subject: [PATCH] Render incorrectly converts to color object when not needed (#528) --- .../bitmaps/NeoPixelBufferShader/NeoPixelBufferShader.ino | 2 +- src/internal/NeoBuffer.h | 7 +++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/examples/bitmaps/NeoPixelBufferShader/NeoPixelBufferShader.ino b/examples/bitmaps/NeoPixelBufferShader/NeoPixelBufferShader.ino index c2c8e74..b778822 100644 --- a/examples/bitmaps/NeoPixelBufferShader/NeoPixelBufferShader.ino +++ b/examples/bitmaps/NeoPixelBufferShader/NeoPixelBufferShader.ino @@ -47,7 +47,7 @@ public: // required for a shader object, it will be called for // every pixel - void Apply(uint16_t index, uint8_t* pDest, uint8_t* pSrc) + void Apply(uint16_t index, uint8_t* pDest, const uint8_t* pSrc) { // we don't care what the index is so we ignore it // diff --git a/src/internal/NeoBuffer.h b/src/internal/NeoBuffer.h index d904e87..adc439c 100644 --- a/src/internal/NeoBuffer.h +++ b/src/internal/NeoBuffer.h @@ -144,11 +144,10 @@ public: for (uint16_t indexPixel = 0; indexPixel < countPixels; indexPixel++) { - typename T_BUFFER_METHOD::ColorObject color; - - shader.Apply(indexPixel, (uint8_t*)(&color), _method.Pixels() + (indexPixel * _method.PixelSize())); + const uint8_t* pSrc = T_BUFFER_METHOD::ColorFeature::getPixelAddress(_method.Pixels(), indexPixel); + uint8_t* pDest = T_BUFFER_METHOD::ColorFeature::getPixelAddress(destBuffer.Pixels, indexPixel); - T_BUFFER_METHOD::ColorFeature::applyPixelColor(destBuffer.Pixels, indexPixel, color); + shader.Apply(indexPixel, pDest, pSrc); } }