MCPcopy Index your code
hub / github.com/Audio4Linux/JDSP4Linux / resizeEvent

Method resizeEvent

src/interface/WidgetMarqueeLabel.cpp:107–149  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

105}
106
107void ScrollText::resizeEvent(QResizeEvent*)
108{
109 // When the widget is resized, we need to update the alpha channel.
110
111 alphaChannel = QImage(size(), QImage::Format_ARGB32_Premultiplied);
112 buffer = QImage(size(), QImage::Format_ARGB32_Premultiplied);
113
114 // Create Alpha Channel:
115 if (width() > 64)
116 {
117 // create first scanline
118 QRgb *scanline1 = (QRgb*) alphaChannel.scanLine(0);
119
120 for (int x = 1; x < 16; ++x)
121 {
122 scanline1[x - 1] = scanline1[width() - x] = qRgba(0, 0, 0, x << 4);
123 }
124
125 for (int x = 15; x < width() - 15; ++x)
126 {
127 scanline1[x] = qRgb(0, 0, 0);
128 }
129
130 // copy scanline to the other ones
131 for (int y = 1; y < height(); ++y)
132 {
133 memcpy(alphaChannel.scanLine(y), (uchar*) scanline1, width() * 4);
134 }
135 }
136 else
137 {
138 alphaChannel.fill(qRgb(0, 0, 0));
139 }
140
141
142 // Update scrolling state
143 bool newScrollEnabled = (singleTextWidth > width() - leftMargin);
144
145 if (newScrollEnabled != scrollEnabled)
146 {
147 updateText();
148 }
149}
150
151void ScrollText::timer_timeout()
152{

Callers

nothing calls this directly

Calls 4

sizeFunction · 0.85
widthFunction · 0.85
heightFunction · 0.85
fillMethod · 0.80

Tested by

no test coverage detected