diff options
author | Daniel Garcia <danielgarcia@gmail.com> | 2016-02-17 07:03:19 +0300 |
---|---|---|
committer | Daniel Garcia <danielgarcia@gmail.com> | 2016-02-17 07:03:19 +0300 |
commit | 6af3e9d825e6fef9e3a1f5644cfd17a6b7ac0b24 (patch) | |
tree | 9bd5bec8fc0eac69f9ce19b2d21c3c6d1beebf5f | |
parent | b3ca0b6957871301bcdf43a448eba537c80d5b5b (diff) |
Tweak dithering value setup in a world where scale8 is fixed
-rw-r--r-- | controller.h | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/controller.h b/controller.h index 8c06c0ca..cb312e90 100644 --- a/controller.h +++ b/controller.h @@ -296,6 +296,9 @@ struct PixelController { byte s = mScale.raw[i]; e[i] = s ? (256/s) + 1 : 0; d[i] = scale8(Q, e[i]); +#if (FASTLED_SCALE8_FIXED == 1) + if(d[i]) (d[i]--); +#endif if(e[i]) e[i]--; } #endif @@ -338,10 +341,10 @@ struct PixelController { template<int SLOT> __attribute__((always_inline)) inline static uint8_t loadByte(PixelController & pc) { return pc.mData[RO(SLOT)]; } template<int SLOT> __attribute__((always_inline)) inline static uint8_t loadByte(PixelController & pc, int lane) { return pc.mData[pc.mOffsets[lane] + RO(SLOT)]; } - + template<int SLOT> __attribute__((always_inline)) inline static uint8_t dither(PixelController & pc, uint8_t b) { return b ? qadd8(b, pc.d[RO(SLOT)]) : 0; } template<int SLOT> __attribute__((always_inline)) inline static uint8_t dither(PixelController & , uint8_t b, uint8_t d) { return b ? qadd8(b,d) : 0; } - + template<int SLOT> __attribute__((always_inline)) inline static uint8_t scale(PixelController & pc, uint8_t b) { return scale8(b, pc.mScale.raw[RO(SLOT)]); } template<int SLOT> __attribute__((always_inline)) inline static uint8_t scale(PixelController & , uint8_t b, uint8_t scale) { return scale8(b, scale); } |