It turns out the reason OpenGL videos aren't being scaled properly is the 
current OpenGL code doesn't take into account the implicit scale caused by 
the viewport not matching the movie coordinates, which is fine everywhere 
except in video drawing b/c video drawing doesn't take into account the 
projection matrix(I think) since it just uses glDrawPixels.  I've provided a 
patch which properly calculates the values to pass to glPixelZoom, but I am 
running into an obnoxious bug in my OpenGL implementation here (i915/945GM) 
where the leftmost few columns have a transparent line through them at the 
top of each source pixel.
Index: render_handler_ogl.cpp
===================================================================
RCS file: /sources/gnash/gnash/backend/render_handler_ogl.cpp,v
retrieving revision 1.74
diff -u -r1.74 render_handler_ogl.cpp
--- render_handler_ogl.cpp	2 Jun 2007 09:54:20 -0000	1.74
+++ render_handler_ogl.cpp	4 Jun 2007 00:02:48 -0000
@@ -96,6 +96,9 @@
     // Output size.
     float	m_display_width;
     float	m_display_height;
+
+	float m_xzoom;
+	float m_yzoom;
 	
     gnash::matrix	m_current_matrix;
     gnash::cxform	m_current_cxform;
@@ -413,8 +416,8 @@
 		d.m_x = b.m_x + c.m_x - a.m_x;
 		d.m_y = b.m_y + c.m_y - a.m_y;
 
-		float w_bounds = TWIPS_TO_PIXELS(b.m_x - a.m_x);
-		float h_bounds = TWIPS_TO_PIXELS(c.m_y - a.m_y);
+		float w_bounds = (float(d.m_x - a.m_x));
+		float h_bounds = (float(d.m_y - a.m_y));
 
 		unsigned char*   ptr = frame->m_data;
 		float xpos = a.m_x < 0 ? 0.0f : a.m_x;	//hack
@@ -428,7 +431,7 @@
 		{
 			float zx = w_bounds / (float) frame->planes[i].w;
 			float zy = h_bounds / (float) frame->planes[i].h;
-			glPixelZoom(zx, - zy);	// flip & zoom image
+			glPixelZoom(zx/m_xzoom, - zy/m_yzoom);	// flip & zoom image
 
 			if (i > 0)
 			{
@@ -444,7 +447,7 @@
 		int width = frame->m_width;
 		float zx = w_bounds / (float) width;
 		float zy = h_bounds / (float) height;
-		glPixelZoom(zx,  -zy);	// flip & zoom image
+		glPixelZoom(zx/m_xzoom,  -zy/m_yzoom);	// flip & zoom image
 		glDrawPixels(width, height, GL_RGB, GL_UNSIGNED_BYTE, ptr);
 #endif
 
@@ -493,6 +496,8 @@
 	    glMatrixMode(GL_MODELVIEW);
 	    glPushMatrix();
 	    glOrtho(x0, x1, y0, y1, -1, 1);
+		m_xzoom=float(x1-x0)/float(viewport_width);
+		m_yzoom=float(y1-y0)/float(viewport_height);
 
 	    glEnable(GL_BLEND);
 	    glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
_______________________________________________
Gnash-dev mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/gnash-dev

Reply via email to