- fixed: an overlay that failed to load no longer attempts to reload it over and over again

Tue, 11 Mar 2014 16:42:37 +0200

author
Santeri Piippo <crimsondusk64@gmail.com>
date
Tue, 11 Mar 2014 16:42:37 +0200
changeset 704
d19213bec2f9
parent 703
ce2a76cebdbb
child 705
09150d027e8c

- fixed: an overlay that failed to load no longer attempts to reload it over and over again

src/GLCompiler.cc file | annotate | diff | comparison | revisions
src/GLCompiler.h file | annotate | diff | comparison | revisions
src/GLRenderer.cc file | annotate | diff | comparison | revisions
src/GLRenderer.h file | annotate | diff | comparison | revisions
--- a/src/GLCompiler.cc	Tue Mar 11 16:11:22 2014 +0200
+++ b/src/GLCompiler.cc	Tue Mar 11 16:42:37 2014 +0200
@@ -305,7 +305,7 @@
 			assert (false);
 	}
 
-	for (int complement = 0; complement < vboNumComplements; ++complement)
+	for (int complement = 0; complement < VBOCM_NumComplements; ++complement)
 	{
 		const int vbonum			= vboNumber (surface, (EVBOComplement) complement);
 		QVector<GLfloat>& vbodata	= objinfo->data[vbonum];
@@ -349,7 +349,7 @@
 					break;
 				}
 
-				case vboNumComplements:
+				case VBOCM_NumComplements:
 					break;
 			}
 		}
--- a/src/GLCompiler.h	Tue Mar 11 16:11:22 2014 +0200
+++ b/src/GLCompiler.h	Tue Mar 11 16:42:37 2014 +0200
@@ -49,7 +49,7 @@
 
 		static inline int	vboNumber (EVBOSurface surface, EVBOComplement complement)
 		{
-			return (surface * vboNumComplements) + complement;
+			return (surface * VBOCM_NumComplements) + complement;
 		}
 
 		inline GLuint		vbo (int vbonum) const
--- a/src/GLRenderer.cc	Tue Mar 11 16:11:22 2014 +0200
+++ b/src/GLRenderer.cc	Tue Mar 11 16:42:37 2014 +0200
@@ -1688,6 +1688,7 @@
 	if (img->isNull())
 	{
 		critical (tr ("Failed to load overlay image!"));
+		currentDocumentData().overlays[cam].invalid = true;
 		delete img;
 		return false;
 	}
@@ -1700,6 +1701,7 @@
 	info.ox = x;
 	info.oy = y;
 	info.img = img;
+	info.invalid = false;
 
 	if (info.lw == 0)
 		info.lw = (info.lh * img->width()) / img->height();
@@ -1992,7 +1994,7 @@
 			delete meta.img;
 			meta.img = null;
 		}
-		elif (ovlobj && (!meta.img || meta.fname != ovlobj->fileName()))
+		elif (ovlobj && (meta.img == null || meta.fname != ovlobj->fileName()) && meta.invalid == false)
 			setupOverlay (cam, ovlobj->fileName(), ovlobj->x(),
 				ovlobj->y(), ovlobj->width(), ovlobj->height());
 	}
@@ -2010,7 +2012,7 @@
 		LDGLOverlay& meta = currentDocumentData().overlays[cam];
 		LDOverlay* ovlobj = findOverlayObject (cam);
 
-		if (!meta.img && ovlobj)
+		if (meta.img == null && ovlobj != null)
 		{
 			// If this is the last overlay image, we need to remove the empty space after it as well.
 			LDObject* nextobj = ovlobj->next();
@@ -2021,7 +2023,8 @@
 			// If the overlay object was there and the overlay itself is
 			// not, remove the object.
 			ovlobj->destroy();
-		} elif (meta.img && !ovlobj)
+		}
+		elif (meta.img != null && ovlobj == null)
 		{
 			// Inverse case: image is there but the overlay object is
 			// not, thus create the object.
--- a/src/GLRenderer.h	Tue Mar 11 16:11:22 2014 +0200
+++ b/src/GLRenderer.h	Tue Mar 11 16:42:37 2014 +0200
@@ -51,6 +51,7 @@
 					lh;
 	QString			fname;
 	QImage*			img;
+	bool			invalid;
 };
 
 struct LDFixedCameraInfo
@@ -84,6 +85,7 @@
 			if (i < 6)
 			{
 				overlays[i].img = null;
+				overlays[i].invalid = false;
 				depthValues[i] = 0.0f;
 			}
 

mercurial