[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] gnash ChangeLog backend/render_handler_ogl.cpp
From: |
Tomas Groth |
Subject: |
[Gnash-commit] gnash ChangeLog backend/render_handler_ogl.cpp |
Date: |
Sat, 23 Dec 2006 16:03:56 +0000 |
CVSROOT: /sources/gnash
Module name: gnash
Changes by: Tomas Groth <tgc> 06/12/23 16:03:56
Modified files:
. : ChangeLog
backend : render_handler_ogl.cpp
Log message:
* backend/render_handler_ogl.cpp: Changed the OpenGL render,
so that it uses RGB frames for video instead of YUV, since
there's some color issues with YUV->RGB convertion.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.1996&r2=1.1997
http://cvs.savannah.gnu.org/viewcvs/gnash/backend/render_handler_ogl.cpp?cvsroot=gnash&r1=1.60&r2=1.61
Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.1996
retrieving revision 1.1997
diff -u -b -r1.1996 -r1.1997
--- ChangeLog 22 Dec 2006 09:39:43 -0000 1.1996
+++ ChangeLog 23 Dec 2006 16:03:56 -0000 1.1997
@@ -1,3 +1,9 @@
+2006-12-23 Tomas Groth Christensen <address@hidden>
+
+ * backend/render_handler_ogl.cpp: Changed the OpenGL render,
+ so that it uses RGB frames for video instead of YUV, since
+ there's some color issues with YUV->RGB convertion.
+
2006-12-22 Sandro Santilli <address@hidden>
* server/: execute_tag.h, sprite_instance.cpp, swf/tag_loaders.cpp:
Index: backend/render_handler_ogl.cpp
===================================================================
RCS file: /sources/gnash/gnash/backend/render_handler_ogl.cpp,v
retrieving revision 1.60
retrieving revision 1.61
diff -u -b -r1.60 -r1.61
--- backend/render_handler_ogl.cpp 5 Dec 2006 14:26:09 -0000 1.60
+++ backend/render_handler_ogl.cpp 23 Dec 2006 16:03:56 -0000 1.61
@@ -6,7 +6,7 @@
// A render_handler that uses SDL & OpenGL
-/* $Id: render_handler_ogl.cpp,v 1.60 2006/12/05 14:26:09 tgc Exp $ */
+/* $Id: render_handler_ogl.cpp,v 1.61 2006/12/23 16:03:56 tgc Exp $ */
//#include "gnash.h"
#include "render_handler.h"
@@ -343,14 +343,24 @@
delete bi;
}
+#define GLYUV
+
// Returns the format the current renderer wants videoframes in.
int videoFrameFormat() {
+#ifdef GLYUV
return YUV;
+#else
+ return RGB;
+#endif
}
/// Draws the video frames
void drawVideoFrame(image::image_base* baseframe, const matrix* m,
const rect* bounds){
+#ifdef GLYUV
image::yuv* frame = static_cast<image::yuv*>(baseframe);
+#else
+ image::rgb* frame = static_cast<image::rgb*>(baseframe);
+#endif
glPushAttrib(GL_ENABLE_BIT | GL_COLOR_BUFFER_BIT);
static GLfloat yuv_rgb[16] = {
@@ -362,10 +372,15 @@
glMatrixMode(GL_COLOR);
glPushMatrix();
+#ifdef GLYUV
glLoadMatrixf(yuv_rgb);
glPixelTransferf(GL_GREEN_BIAS, -0.5f);
glPixelTransferf(GL_BLUE_BIAS, -0.5f);
-
+#else
+ glLoadIdentity();
+ glPixelTransferf(GL_GREEN_BIAS, 0.0);
+ glPixelTransferf(GL_BLUE_BIAS, 0.0);
+#endif
gnash::point a, b, c, d;
m->transform(&a, gnash::point(bounds->get_x_min(),
bounds->get_y_min()));
m->transform(&b, gnash::point(bounds->get_x_max(),
bounds->get_y_min()));
@@ -375,12 +390,15 @@
float w_bounds = TWIPS_TO_PIXELS(b.m_x - a.m_x);
float h_bounds = TWIPS_TO_PIXELS(c.m_y - a.m_y);
- GLenum rgb[3] = {GL_RED, GL_GREEN, GL_BLUE};
unsigned char* ptr = frame->m_data;
+#ifdef GLYUV
+ GLenum rgb[3] = {GL_RED, GL_GREEN, GL_BLUE};
+
float xpos = a.m_x < 0 ? 0.0f : a.m_x; //hack
float ypos = a.m_y < 0 ? 0.0f : a.m_y; //hack
glRasterPos2f(xpos, ypos); //hack
+
for (int i = 0; i < 3; ++i)
{
float zx = w_bounds / (float) frame->planes[i].w;
@@ -396,6 +414,18 @@
glDrawPixels(frame->planes[i].w, frame->planes[i].h,
rgb[i], GL_UNSIGNED_BYTE, ptr);
ptr += frame->planes[i].size;
}
+#else
+ float xpos = c.m_x < 0 ? 0.0f : c.m_x; //hack
+ float ypos = c.m_y < 0 ? 0.0f : c.m_y; //hack
+ glRasterPos2f(xpos, ypos); //hack
+
+ int height = frame->m_height;
+ int width = frame->m_width;
+ float zx = w_bounds / (float) width;
+ float zy = h_bounds / (float) height;
+ glPixelZoom(zx, zy); // flip & zoom image
+ glDrawPixels(width, height, GL_RGB, GL_UNSIGNED_BYTE, ptr);
+#endif
glMatrixMode(GL_COLOR);
glPopMatrix();
- [Gnash-commit] gnash ChangeLog backend/render_handler_ogl.cpp,
Tomas Groth <=