Browse Source

Merged default into minor

--HG--
branch : minor
Alex Szpakowski 11 years ago
parent
commit
626701fc2b

+ 11 - 15
src/modules/audio/openal/Pool.cpp

@@ -98,11 +98,7 @@ bool Pool::isPlaying(Source *s)
 	bool p = false;
 	{
 		thread::Lock lock(mutex);
-		for (auto i = playing.begin(); i != playing.end(); i++)
-		{
-			if (i->first == s)
-				p = true;
-		}
+		p = (playing.find(s) != playing.end());
 	}
 	return p;
 }
@@ -181,11 +177,11 @@ bool Pool::play(Source *source, ALuint &out)
 void Pool::stop()
 {
 	thread::Lock lock(mutex);
-	for (auto i = playing.begin(); i != playing.end(); i++)
+	for (const auto &i : playing)
 	{
-		i->first->stopAtomic();
-		i->first->release();
-		available.push(i->second);
+		i.first->stopAtomic();
+		i.first->release();
+		available.push(i.second);
 	}
 
 	playing.clear();
@@ -200,8 +196,8 @@ void Pool::stop(Source *source)
 void Pool::pause()
 {
 	thread::Lock lock(mutex);
-	for (auto i = playing.begin(); i != playing.end(); i++)
-		i->first->pauseAtomic();
+	for (const auto &i : playing)
+		i.first->pauseAtomic();
 }
 
 void Pool::pause(Source *source)
@@ -215,8 +211,8 @@ void Pool::pause(Source *source)
 void Pool::resume()
 {
 	thread::Lock lock(mutex);
-	for (auto i = playing.begin(); i != playing.end(); i++)
-		i->first->resumeAtomic();
+	for (const auto &i : playing)
+		i.first->resumeAtomic();
 }
 
 void Pool::resume(Source *source)
@@ -230,8 +226,8 @@ void Pool::resume(Source *source)
 void Pool::rewind()
 {
 	thread::Lock lock(mutex);
-	for (auto i = playing.begin(); i != playing.end(); i++)
-		i->first->rewindAtomic();
+	for (const auto &i : playing)
+		i.first->rewindAtomic();
 }
 
 // For those times we don't need it backed.

+ 4 - 13
src/modules/graphics/Volatile.cpp

@@ -43,26 +43,17 @@ Volatile::~Volatile()
 bool Volatile::loadAll()
 {
 	bool success = true;
-	std::list<Volatile *>::iterator i = all.begin();
 
-	while (i != all.end())
-	{
-		success = success && (*i)->loadVolatile();
-		i++;
-	}
+	for (Volatile *v : all)
+		success = success && v->loadVolatile();
 
 	return success;
 }
 
 void Volatile::unloadAll()
 {
-	std::list<Volatile *>::iterator i = all.begin();
-
-	while (i != all.end())
-	{
-		(*i)->unloadVolatile();
-		i++;
-	}
+	for (Volatile *v : all)
+		v->unloadVolatile();
 }
 
 } // graphics

+ 3 - 38
src/modules/graphics/opengl/OpenGL.cpp

@@ -468,11 +468,10 @@ void OpenGL::deleteTexture(GLuint texture)
 {
 	// glDeleteTextures binds texture 0 to all texture units the deleted texture
 	// was bound to before deletion.
-	std::vector<GLuint>::iterator it;
-	for (it = state.textureUnits.begin(); it != state.textureUnits.end(); ++it)
+	for (GLuint &texid : state.textureUnits)
 	{
-		if (*it == texture)
-			*it = 0;
+		if (texid == texture)
+			texid = 0;
 	}
 
 	glDeleteTextures(1, &texture);
@@ -609,40 +608,6 @@ void OpenGL::setTextureWrap(const graphics::Texture::Wrap &w)
 	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, gt);
 }
 
-graphics::Texture::Wrap OpenGL::getTextureWrap()
-{
-	GLint gs, gt;
-
-	glGetTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, &gs);
-	glGetTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, &gt);
-
-	Texture::Wrap w;
-
-	switch (gs)
-	{
-	case GL_CLAMP_TO_EDGE:
-		w.s = Texture::WRAP_CLAMP;
-		break;
-	case GL_REPEAT:
-	default:
-		w.s = Texture::WRAP_REPEAT;
-		break;
-	}
-
-	switch (gt)
-	{
-	case GL_CLAMP_TO_EDGE:
-		w.t = Texture::WRAP_CLAMP;
-		break;
-	case GL_REPEAT:
-	default:
-		w.t = Texture::WRAP_REPEAT;
-		break;
-	}
-
-	return w;
-}
-
 int OpenGL::getMaxTextureSize() const
 {
 	return maxTextureSize;

+ 0 - 5
src/modules/graphics/opengl/OpenGL.h

@@ -286,11 +286,6 @@ public:
 	 **/
 	void setTextureWrap(const graphics::Texture::Wrap &w);
 
-	/**
-	 * Returns the texture wrap mode for the currently bound texture.
-	 **/
-	graphics::Texture::Wrap getTextureWrap();
-
 	/**
 	 * Returns the maximum supported width or height of a texture.
 	 **/

+ 6 - 5
src/scripts/graphics.lua

@@ -1295,8 +1295,7 @@ do
 #define number float
 #define Image sampler2D
 #define extern uniform
-#define Texel texture2D
-#define love_Canvases gl_FragData]]
+#define Texel texture2D]]
 
 	local GLSL_UNIFORMS = [[
 #define TransformMatrix gl_ModelViewMatrix
@@ -1339,12 +1338,14 @@ void main() {
 #define PIXEL
 
 varying vec4 VaryingTexCoord;
-varying vec4 VaryingColor;]],
+varying vec4 VaryingColor;
+
+#define love_Canvases gl_FragData]],
 
 		FOOTER = [[
 void main() {
 	// fix crashing issue in OSX when _tex0_ is unused within effect()
-	float dummy = texture2D(_tex0_, vec2(.5)).r;
+	float dummy = Texel(_tex0_, vec2(.5)).r;
 
 	// See Shader::checkSetScreenParams in Shader.cpp.
 	vec2 pixelcoord = vec2(gl_FragCoord.x, (gl_FragCoord.y * love_ScreenSize.z) + love_ScreenSize.w);
@@ -1355,7 +1356,7 @@ void main() {
 		FOOTER_MULTI_CANVAS = [[
 void main() {
 	// fix crashing issue in OSX when _tex0_ is unused within effect()
-	float dummy = texture2D(_tex0_, vec2(.5)).r;
+	float dummy = Texel(_tex0_, vec2(.5)).r;
 
 	// See Shader::checkSetScreenParams in Shader.cpp.
 	vec2 pixelcoord = vec2(gl_FragCoord.x, (gl_FragCoord.y * love_ScreenSize.z) + love_ScreenSize.w);

+ 10 - 10
src/scripts/graphics.lua.h

@@ -6276,9 +6276,7 @@ const unsigned char graphics_lua[] =
 	0x23, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x65, 0x20, 0x65, 0x78, 0x74, 0x65, 0x72, 0x6e, 0x20, 0x75, 0x6e, 0x69, 
 	0x66, 0x6f, 0x72, 0x6d, 0x0a,
 	0x23, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x65, 0x20, 0x54, 0x65, 0x78, 0x65, 0x6c, 0x20, 0x74, 0x65, 0x78, 0x74, 
-	0x75, 0x72, 0x65, 0x32, 0x44, 0x0a,
-	0x23, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x65, 0x20, 0x6c, 0x6f, 0x76, 0x65, 0x5f, 0x43, 0x61, 0x6e, 0x76, 0x61, 
-	0x73, 0x65, 0x73, 0x20, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5d, 0x5d, 0x0a,
+	0x75, 0x72, 0x65, 0x32, 0x44, 0x5d, 0x5d, 0x0a,
 	0x09, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x20, 0x47, 0x4c, 0x53, 0x4c, 0x5f, 0x55, 0x4e, 0x49, 0x46, 0x4f, 0x52, 
 	0x4d, 0x53, 0x20, 0x3d, 0x20, 0x5b, 0x5b, 0x0a,
 	0x23, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x65, 0x20, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x66, 0x6f, 0x72, 0x6d, 0x4d, 
@@ -6348,16 +6346,18 @@ const unsigned char graphics_lua[] =
 	0x76, 0x61, 0x72, 0x79, 0x69, 0x6e, 0x67, 0x20, 0x76, 0x65, 0x63, 0x34, 0x20, 0x56, 0x61, 0x72, 0x79, 0x69, 
 	0x6e, 0x67, 0x54, 0x65, 0x78, 0x43, 0x6f, 0x6f, 0x72, 0x64, 0x3b, 0x0a,
 	0x76, 0x61, 0x72, 0x79, 0x69, 0x6e, 0x67, 0x20, 0x76, 0x65, 0x63, 0x34, 0x20, 0x56, 0x61, 0x72, 0x79, 0x69, 
-	0x6e, 0x67, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x3b, 0x5d, 0x5d, 0x2c, 0x0a,
+	0x6e, 0x67, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x3b, 0x0a,
+	0x23, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x65, 0x20, 0x6c, 0x6f, 0x76, 0x65, 0x5f, 0x43, 0x61, 0x6e, 0x76, 0x61, 
+	0x73, 0x65, 0x73, 0x20, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5d, 0x5d, 0x2c, 0x0a,
 	0x09, 0x09, 0x46, 0x4f, 0x4f, 0x54, 0x45, 0x52, 0x20, 0x3d, 0x20, 0x5b, 0x5b, 0x0a,
 	0x76, 0x6f, 0x69, 0x64, 0x20, 0x6d, 0x61, 0x69, 0x6e, 0x28, 0x29, 0x20, 0x7b, 0x0a,
 	0x09, 0x2f, 0x2f, 0x20, 0x66, 0x69, 0x78, 0x20, 0x63, 0x72, 0x61, 0x73, 0x68, 0x69, 0x6e, 0x67, 0x20, 0x69, 
 	0x73, 0x73, 0x75, 0x65, 0x20, 0x69, 0x6e, 0x20, 0x4f, 0x53, 0x58, 0x20, 0x77, 0x68, 0x65, 0x6e, 0x20, 0x5f, 
 	0x74, 0x65, 0x78, 0x30, 0x5f, 0x20, 0x69, 0x73, 0x20, 0x75, 0x6e, 0x75, 0x73, 0x65, 0x64, 0x20, 0x77, 0x69, 
 	0x74, 0x68, 0x69, 0x6e, 0x20, 0x65, 0x66, 0x66, 0x65, 0x63, 0x74, 0x28, 0x29, 0x0a,
-	0x09, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x20, 0x64, 0x75, 0x6d, 0x6d, 0x79, 0x20, 0x3d, 0x20, 0x74, 0x65, 0x78, 
-	0x74, 0x75, 0x72, 0x65, 0x32, 0x44, 0x28, 0x5f, 0x74, 0x65, 0x78, 0x30, 0x5f, 0x2c, 0x20, 0x76, 0x65, 0x63, 
-	0x32, 0x28, 0x2e, 0x35, 0x29, 0x29, 0x2e, 0x72, 0x3b, 0x0a,
+	0x09, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x20, 0x64, 0x75, 0x6d, 0x6d, 0x79, 0x20, 0x3d, 0x20, 0x54, 0x65, 0x78, 
+	0x65, 0x6c, 0x28, 0x5f, 0x74, 0x65, 0x78, 0x30, 0x5f, 0x2c, 0x20, 0x76, 0x65, 0x63, 0x32, 0x28, 0x2e, 0x35, 
+	0x29, 0x29, 0x2e, 0x72, 0x3b, 0x0a,
 	0x09, 0x2f, 0x2f, 0x20, 0x53, 0x65, 0x65, 0x20, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x3a, 0x3a, 0x63, 0x68, 
 	0x65, 0x63, 0x6b, 0x53, 0x65, 0x74, 0x53, 0x63, 0x72, 0x65, 0x65, 0x6e, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 
 	0x20, 0x69, 0x6e, 0x20, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x2e, 0x63, 0x70, 0x70, 0x2e, 0x0a,
@@ -6380,9 +6380,9 @@ const unsigned char graphics_lua[] =
 	0x73, 0x73, 0x75, 0x65, 0x20, 0x69, 0x6e, 0x20, 0x4f, 0x53, 0x58, 0x20, 0x77, 0x68, 0x65, 0x6e, 0x20, 0x5f, 
 	0x74, 0x65, 0x78, 0x30, 0x5f, 0x20, 0x69, 0x73, 0x20, 0x75, 0x6e, 0x75, 0x73, 0x65, 0x64, 0x20, 0x77, 0x69, 
 	0x74, 0x68, 0x69, 0x6e, 0x20, 0x65, 0x66, 0x66, 0x65, 0x63, 0x74, 0x28, 0x29, 0x0a,
-	0x09, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x20, 0x64, 0x75, 0x6d, 0x6d, 0x79, 0x20, 0x3d, 0x20, 0x74, 0x65, 0x78, 
-	0x74, 0x75, 0x72, 0x65, 0x32, 0x44, 0x28, 0x5f, 0x74, 0x65, 0x78, 0x30, 0x5f, 0x2c, 0x20, 0x76, 0x65, 0x63, 
-	0x32, 0x28, 0x2e, 0x35, 0x29, 0x29, 0x2e, 0x72, 0x3b, 0x0a,
+	0x09, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x20, 0x64, 0x75, 0x6d, 0x6d, 0x79, 0x20, 0x3d, 0x20, 0x54, 0x65, 0x78, 
+	0x65, 0x6c, 0x28, 0x5f, 0x74, 0x65, 0x78, 0x30, 0x5f, 0x2c, 0x20, 0x76, 0x65, 0x63, 0x32, 0x28, 0x2e, 0x35, 
+	0x29, 0x29, 0x2e, 0x72, 0x3b, 0x0a,
 	0x09, 0x2f, 0x2f, 0x20, 0x53, 0x65, 0x65, 0x20, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x3a, 0x3a, 0x63, 0x68, 
 	0x65, 0x63, 0x6b, 0x53, 0x65, 0x74, 0x53, 0x63, 0x72, 0x65, 0x65, 0x6e, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 
 	0x20, 0x69, 0x6e, 0x20, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x2e, 0x63, 0x70, 0x70, 0x2e, 0x0a,