MCPcopy Create free account
hub / github.com/jerryuhoo/Fire / paint

Method paint

Source/Panels/SpectrogramPanel/SpectrumBackground.cpp:37–54  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

35}
36
37void SpectrumBackground::paint(juce::Graphics& g)
38{
39 // 1. Get the real physical scale factor for this paint cycle
40 const float currentDisplayScale = g.getInternalContext().getPhysicalPixelScaleFactor();
41
42 // 2. Check if the scale has changed (or if it's the first time painting)
43 if (currentDisplayScale != lastDisplayScale)
44 {
45 // If it changed, update our stored value and regenerate the background image
46 lastDisplayScale = currentDisplayScale;
47 createBackgroundImage();
48
49 // Return immediately. The regeneration will trigger a new paint call.
50 return;
51 }
52 // 3. If scale is unchanged, just draw the pre-rendered cache.
53 g.drawImage(cachedBackground, getLocalBounds().toFloat());
54}
55
56void SpectrumBackground::resized()
57{

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected