Author: agrundman
Date: Tue Jun 1 07:13:18 2010
New Revision: 8834
URL: http://svn.slimdevices.com/jive?rev=8834&view=rev
Log:
Avoid extra calls to draw the same background on every frame of the spectrum
meter
Modified:
7.6/trunk/squeezeplay/src/squeezeplay/share/jive/audio/SpectrumMeter.lua
Modified:
7.6/trunk/squeezeplay/src/squeezeplay/share/jive/audio/SpectrumMeter.lua
URL:
http://svn.slimdevices.com/jive/7.6/trunk/squeezeplay/src/squeezeplay/share/jive/audio/SpectrumMeter.lua?rev=8834&r1=8833&r2=8834&view=diff
==============================================================================
--- 7.6/trunk/squeezeplay/src/squeezeplay/share/jive/audio/SpectrumMeter.lua
(original)
+++ 7.6/trunk/squeezeplay/src/squeezeplay/share/jive/audio/SpectrumMeter.lua
Tue Jun 1 07:13:18 2010
@@ -73,6 +73,8 @@
self.barSpace = self:styleValue("barSpace")
self.binSpace = self:styleValue("binSpace")
self.clipSubbands = self:styleValue("clipSubbands")
+
+ self.backgroundDrawn = false;
if self.barsInBin[1] < 1 then
self.barsInBin[1] = 1
@@ -143,11 +145,15 @@
function draw(self, surface)
-- Black background instead of image
-- self.bgImg:blit(surface, self:getBounds())
- local x, y, w, h = self:getBounds()
- surface:filledRectangle(x, y, x + w, y + h, self.bgCol)
-
-
- local bins = { {}, {}}
+
+ -- Avoid calling this more than once as it's not necessary
+ if not self.backgroundDrawn then
+ local x, y, w, h = self:getBounds()
+ surface:filledRectangle(x, y, x + w, y + h, self.bgCol)
+ self.backgroundDrawn = true
+ end
+
+ local bins = { {}, {} }
bins[1], bins[2] = decode:spectrum()
_______________________________________________
Jive-checkins mailing list
[email protected]
http://lists.slimdevices.com/mailman/listinfo/jive-checkins