| 407 | } |
| 408 | |
| 409 | void Painter::PaintBrightSurprise( |
| 410 | const KeyboardState& keyboard, |
| 411 | const int* led_column_table, int led_column_table_length, |
| 412 | LedRopeInterface* led_rope) { |
| 413 | |
| 414 | led_rope->RawBeginDraw(); |
| 415 | int total_counted = 0; |
| 416 | |
| 417 | float r, g, b; |
| 418 | r = g = b = 0; |
| 419 | |
| 420 | for (int i = 0; i < KeyboardState::kNumKeys; ++i) { |
| 421 | const Key& key = keyboard.mKeys[i]; |
| 422 | |
| 423 | |
| 424 | if (key.mCurrColor.v_ > 0.0f) { |
| 425 | const Color3i rgb = key.mCurrColor.ToRGB(); |
| 426 | r += rgb.r_; |
| 427 | g += rgb.g_; |
| 428 | b += rgb.b_; |
| 429 | ++total_counted; |
| 430 | } |
| 431 | } |
| 432 | |
| 433 | float denom = total_counted ? total_counted : 1; |
| 434 | r /= denom; |
| 435 | g /= denom; |
| 436 | b /= denom; |
| 437 | |
| 438 | |
| 439 | const Color3i rgb(r, g, b); |
| 440 | |
| 441 | for (int i = 0; i < led_column_table_length; ++i) { |
| 442 | const int n = led_column_table[i]; |
| 443 | for (int i = 0; i < n; ++i) { |
| 444 | led_rope->RawDrawPixel(rgb); |
| 445 | } |
| 446 | } |
| 447 | led_rope->RawCommitDraw(); |
| 448 | } |
| 449 | |
| 450 | void Painter::PaintVuSpaceInvaders(uint32_t /*now_ms*/, |
| 451 | const KeyboardState& keyboard, |
nothing calls this directly
no test coverage detected