| 882 | } |
| 883 | |
| 884 | void fill_2dnoise8(CRGB *leds, int width, int height, bool serpentine, |
| 885 | fl::u8 octaves, fl::u16 x, int xscale, fl::u16 y, int yscale, fl::u16 time, |
| 886 | fl::u8 hue_octaves, fl::u16 hue_x, int hue_xscale, fl::u16 hue_y, fl::u16 hue_yscale,fl::u16 hue_time,bool blend) { |
| 887 | const size_t array_size = (size_t)height * width; |
| 888 | if (array_size <= 0) return; |
| 889 | FASTLED_STACK_ARRAY(fl::u8, V, array_size); |
| 890 | FASTLED_STACK_ARRAY(fl::u8, H, array_size); |
| 891 | |
| 892 | fl::memset(V,0,height*width); |
| 893 | fl::memset(H,0,height*width); |
| 894 | |
| 895 | fill_raw_2dnoise8((fl::u8*)V,width,height,octaves,x,xscale,y,yscale,time); |
| 896 | fill_raw_2dnoise8((fl::u8*)H,width,height,hue_octaves,hue_x,hue_xscale,hue_y,hue_yscale,hue_time); |
| 897 | |
| 898 | int w1 = width-1; |
| 899 | int h1 = height-1; |
| 900 | for(int i = 0; i < height; ++i) { |
| 901 | int wb = i*width; |
| 902 | for(int j = 0; j < width; ++j) { |
| 903 | CRGB led(CHSV(H[(h1-i)*width + (w1-j)], 255, V[i*width + j])); |
| 904 | |
| 905 | int pos = j; |
| 906 | if(serpentine && (i & 0x1)) { |
| 907 | pos = w1-j; |
| 908 | } |
| 909 | |
| 910 | if(blend) { |
| 911 | // Safer blending using shift-and-add to avoid ambiguous operator+ |
| 912 | leds[wb+pos] >>= 1; |
| 913 | leds[wb+pos] += (led >>= 1); |
| 914 | } else { |
| 915 | leds[wb+pos] = led; |
| 916 | } |
| 917 | } |
| 918 | } |
| 919 | } |
| 920 | |
| 921 | |
| 922 | void fill_2dnoise16(CRGB *leds, int width, int height, bool serpentine, |
nothing calls this directly
no test coverage detected