MCPcopy Create free account
hub / github.com/audacity/audacity / OnPaint

Method OnPaint

src/TrackPanel.cpp:485–532  ·  view source on GitHub ↗

AS: OnPaint( ) is called during the normal course of completing a repaint operation.

Source from the content-addressed store, hash-verified

483/// AS: OnPaint( ) is called during the normal course of
484/// completing a repaint operation.
485void TrackPanel::OnPaint(wxPaintEvent & /* event */)
486{
487 // If the selected region changes - we must repaint the tracks, because the
488 // selection is baked into track image
489 if (mLastDrawnSelectedRegion != mViewInfo->selectedRegion)
490 {
491 mRefreshBacking = true;
492 mLastDrawnSelectedRegion = mViewInfo->selectedRegion;
493 }
494
495 auto sw =
496 FrameStatistics::CreateStopwatch(FrameStatistics::SectionID::TrackPanel);
497
498 {
499 wxPaintDC dc(this);
500
501 // Retrieve the damage rectangle
502 wxRect box = GetUpdateRegion().GetBox();
503
504 // Recreate the backing bitmap if we have a full refresh
505 // (See TrackPanel::Refresh())
506 if (mRefreshBacking || (box == GetRect()))
507 {
508 // Reset (should a mutex be used???)
509 mRefreshBacking = false;
510
511 // Redraw the backing bitmap
512 DrawTracks(&GetBackingDCForRepaint());
513
514 // Copy it to the display
515 DisplayBitmap(dc);
516 }
517 else
518 {
519 // Copy full, possibly clipped, damage rectangle
520 RepairBitmap(dc, box.x, box.y, box.width, box.height);
521 }
522
523 // Done with the clipped DC
524
525 // Drawing now goes directly to the client area.
526 // DrawOverlays() may need to draw outside the clipped region.
527 // (Used to make a NEW, separate wxClientDC, but that risks flashing
528 // problems on Mac.)
529 dc.DestroyClippingRegion();
530 DrawOverlays(true, &dc);
531 }
532}
533
534void TrackPanel::MakeParentRedrawScrollbars()
535{

Callers

nothing calls this directly

Calls 1

GetBoxMethod · 0.80

Tested by

no test coverage detected