|
14 | 14 |
|
15 | 15 | #if !(defined(WLED_DISABLE_PARTICLESYSTEM2D) && defined(WLED_DISABLE_PARTICLESYSTEM1D)) // not both disabled |
16 | 16 | #include "FXparticleSystem.h" |
| 17 | +#include "particle_simd.h" |
17 | 18 | // local shared functions (used both in 1D and 2D system) |
18 | 19 | static int32_t calcForce_dv(const int8_t force, uint8_t& counter); |
19 | 20 | static bool checkBoundsAndWrap(int32_t& position, const int32_t max, const int32_t particleradius, const bool wrap); // returns false if out of bounds by more than particleradius |
@@ -561,16 +562,26 @@ void ParticleSystem2D::render() { |
561 | 562 | blend = LINEARBLEND_NOWRAP; |
562 | 563 | } |
563 | 564 |
|
564 | | - if (motionBlur) { // motion-blurring active |
| 565 | + uint32_t numPixels = (maxXpixel + 1) * (maxYpixel + 1); |
| 566 | + |
| 567 | + if (motionBlur) { |
| 568 | + #if HAS_PIE_SIMD |
| 569 | + fast_color_scale_simd(framebuffer, motionBlur, numPixels); |
| 570 | + #else |
565 | 571 | for (int32_t y = 0; y <= maxYpixel; y++) { |
566 | 572 | int index = y * (maxXpixel + 1); |
567 | 573 | for (int32_t x = 0; x <= maxXpixel; x++) { |
568 | | - fast_color_scale(framebuffer[index], motionBlur); // note: could skip if only globalsmear is active but usually they are both active and scaling is fast enough |
| 574 | + fast_color_scale(framebuffer[index], motionBlur); |
569 | 575 | index++; |
570 | 576 | } |
571 | 577 | } |
572 | | - } else { // no blurring: clear buffer |
573 | | - memset(framebuffer, 0, (maxXpixel + 1) * (maxYpixel + 1) * sizeof(CRGB)); |
| 578 | + #endif |
| 579 | + } else { |
| 580 | + #if HAS_PIE_SIMD |
| 581 | + clear_buffer_simd(framebuffer, numPixels * sizeof(CRGB)); |
| 582 | + #else |
| 583 | + memset(framebuffer, 0, numPixels * sizeof(CRGB)); |
| 584 | + #endif |
574 | 585 | } |
575 | 586 |
|
576 | 587 | // go over particles and render them to the buffer |
|
0 commit comments