glmemory: Fix handling of stride with alignement larger then 8

Setting a scaled factor for X coordinate is not enough as the indexer
will still think stride is shorter and will not fully skip it. Instead,
update width, so the lines are as expected. Combined with the scale, it
will hide the cropped portion.

https://bugzilla.gnome.org/show_bug.cgi?id=729896
This commit is contained in:
Nicolas Dufresne 2014-05-12 19:29:45 -04:00
parent 16d969b945
commit d4bcef3204

View file

@ -400,6 +400,7 @@ _calculate_unpack_length (GstGLMemory * gl_mem)
gl_mem->unpack_length = j; gl_mem->unpack_length = j;
gl_mem->tex_scaling[0] = gl_mem->tex_scaling[0] =
(gfloat) (gl_mem->width * n_gl_bytes) / (gfloat) gl_mem->stride; (gfloat) (gl_mem->width * n_gl_bytes) / (gfloat) gl_mem->stride;
gl_mem->width = gl_mem->stride / n_gl_bytes;
break; break;
} }
j >>= 1; j >>= 1;
@ -511,9 +512,12 @@ _gl_mem_new (GstAllocator * allocator, GstMemory * parent,
{ {
GstGLMemory *mem; GstGLMemory *mem;
GenTexture data = { 0, }; GenTexture data = { 0, };
mem = g_slice_new0 (GstGLMemory);
_gl_mem_init (mem, allocator, parent, context, tex_type, width, height,
stride, user_data, notify);
data.width = width; data.width = mem->width;
data.height = height; data.height = mem->height;
data.gl_format = _gst_gl_format_from_gl_texture_type (tex_type); data.gl_format = _gst_gl_format_from_gl_texture_type (tex_type);
data.gl_type = GL_UNSIGNED_BYTE; data.gl_type = GL_UNSIGNED_BYTE;
if (tex_type == GST_VIDEO_GL_TEXTURE_TYPE_RGB16) if (tex_type == GST_VIDEO_GL_TEXTURE_TYPE_RGB16)
@ -528,10 +532,6 @@ _gl_mem_new (GstAllocator * allocator, GstMemory * parent,
GST_CAT_TRACE (GST_CAT_GL_MEMORY, "created texture %u", data.result); GST_CAT_TRACE (GST_CAT_GL_MEMORY, "created texture %u", data.result);
mem = g_slice_new0 (GstGLMemory);
_gl_mem_init (mem, allocator, parent, context, tex_type, width, height,
stride, user_data, notify);
mem->tex_id = data.result; mem->tex_id = data.result;
return mem; return mem;