| 502 | } |
| 503 | |
| 504 | void EffectScienFilterPanel::OnPaint(wxPaintEvent & WXUNUSED(evt)) |
| 505 | { |
| 506 | wxPaintDC dc(this); |
| 507 | int width, height; |
| 508 | GetSize(&width, &height); |
| 509 | |
| 510 | if (!mBitmap || mWidth != width || mHeight != height) |
| 511 | { |
| 512 | mWidth = width; |
| 513 | mHeight = height; |
| 514 | mBitmap = std::make_unique<wxBitmap>(mWidth, mHeight,24); |
| 515 | } |
| 516 | |
| 517 | wxBrush bkgndBrush(wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE)); |
| 518 | |
| 519 | wxMemoryDC memDC; |
| 520 | memDC.SelectObject(*mBitmap); |
| 521 | |
| 522 | wxRect bkgndRect; |
| 523 | bkgndRect.x = 0; |
| 524 | bkgndRect.y = 0; |
| 525 | bkgndRect.width = mWidth; |
| 526 | bkgndRect.height = mHeight; |
| 527 | memDC.SetBrush(bkgndBrush); |
| 528 | memDC.SetPen(*wxTRANSPARENT_PEN); |
| 529 | memDC.DrawRectangle(bkgndRect); |
| 530 | |
| 531 | bkgndRect.y = mHeight; |
| 532 | memDC.DrawRectangle(bkgndRect); |
| 533 | |
| 534 | wxRect border; |
| 535 | border.x = 0; |
| 536 | border.y = 0; |
| 537 | border.width = mWidth; |
| 538 | border.height = mHeight; |
| 539 | |
| 540 | memDC.SetBrush(*wxWHITE_BRUSH); |
| 541 | memDC.SetPen(*wxBLACK_PEN); |
| 542 | memDC.DrawRectangle(border); |
| 543 | |
| 544 | mEnvRect = border; |
| 545 | mEnvRect.Deflate(2, 2); |
| 546 | |
| 547 | // Pure blue x-axis line |
| 548 | memDC.SetPen(wxPen(theTheme.Colour(clrGraphLines), 1, wxPENSTYLE_SOLID)); |
| 549 | int center = (int) (mEnvRect.height * mDbMax / (mDbMax - mDbMin) + 0.5); |
| 550 | AColor::Line(memDC, |
| 551 | mEnvRect.GetLeft(), mEnvRect.y + center, |
| 552 | mEnvRect.GetRight(), mEnvRect.y + center); |
| 553 | |
| 554 | //Now draw the actual response that you will get. |
| 555 | //mFilterFunc has a linear scale, window has a log one so we have to fiddle about |
| 556 | memDC.SetPen(wxPen(theTheme.Colour(clrResponseLines), 3, wxPENSTYLE_SOLID)); |
| 557 | double scale = (double) mEnvRect.height / (mDbMax - mDbMin); // pixels per dB |
| 558 | double yF; // gain at this freq |
| 559 | |
| 560 | double loLog = log10(mLoFreq); |
| 561 | double step = log10(mHiFreq) - loLog; |
nothing calls this directly
no test coverage detected