Commit 29484aa5 authored by Lucas Murray's avatar Lucas Murray
Browse files

Allow snow flakes to completely exit the screen before removing them.

Also create the flakes off-screen as well.
BUG: 182561

svn path=/trunk/KDE/kdebase/workspace/; revision=919039
parent a6fb2688
......@@ -42,6 +42,6 @@ void main()
else
yCoord = float(height)*0.5;
vec2 vertex = vec2( xCoord, yCoord );
vertex = (vertex)*rotation + vec2( float(x), 0.0 ) + vec2(hSpeed, vSpeed)*float(frames);
vertex = (vertex)*rotation + vec2( float(x), float(-height) ) + vec2(hSpeed, vSpeed)*float(frames);
gl_Position = gl_ModelViewProjectionMatrix * vec4(vertex, gl_Vertex.zw);
}
......@@ -98,7 +98,7 @@ void SnowEffect::prePaintScreen( ScreenPrePaintData& data, int time )
int size = 0;
while ( size < mMinFlakeSize )
size = random() % mMaxFlakeSize;
SnowFlake flake = SnowFlake( random() % (displayWidth() - size), -1 * size, size, size, mMaxVSpeed, mMaxHSpeed );
SnowFlake flake = SnowFlake( random() % (displayWidth() - size), -size, size, size, mMaxVSpeed, mMaxHSpeed );
flakes.append( flake );
// calculation of next time of snowflake
......@@ -356,9 +356,9 @@ SnowFlake::SnowFlake(int x, int y, int width, int height, int maxVSpeed, int max
if(rotationSpeed == 0) rotationSpeed = 0.5;
rect = QRect(x, y, width, height);
frameCounter = 0;
maxFrames = displayHeight() / vSpeed;
maxFrames = (displayHeight() + 2*height) / vSpeed;
if( hSpeed > 0 )
maxFrames = qMin( maxFrames, (displayWidth() - x)/hSpeed );
maxFrames = qMin( maxFrames, (displayWidth() + width - x)/hSpeed );
else if( hSpeed < 0 )
maxFrames = qMin( maxFrames, (x + width)/(-hSpeed) );
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment