From 6f28f44c8c48ec0de064fecfb3bf1c47950f1e3a Mon Sep 17 00:00:00 2001 From: reimar Date: Sun, 9 May 2010 00:16:46 +0000 Subject: [PATCH] Handle chroma texture size becoming 0, e.g. due to bad rounding. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@31143 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libvo/gl_common.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/libvo/gl_common.c b/libvo/gl_common.c index 2e2b04c920..87034ff7aa 100644 --- a/libvo/gl_common.c +++ b/libvo/gl_common.c @@ -528,8 +528,11 @@ void glCreateClearTex(GLenum target, GLenum fmt, GLenum format, GLenum type, GLi int w, int h, unsigned char val) { GLfloat fval = (GLfloat)val / 255.0; GLfloat border[4] = {fval, fval, fval, fval}; - int stride = w * glFmt2bpp(format, type); + int stride; char *init; + if (w == 0) w = 1; + if (h == 0) h = 1; + stride = w * glFmt2bpp(format, type); if (!stride) return; init = malloc(stride * h); memset(init, val, stride * h); @@ -1421,6 +1424,8 @@ int glAutodetectYUVConversion(void) { void glSetupYUVConversion(gl_conversion_params_t *params) { float uvcos = params->csp_params.saturation * cos(params->csp_params.hue); float uvsin = params->csp_params.saturation * sin(params->csp_params.hue); + if (params->chrom_texw == 0) params->chrom_texw = 1; + if (params->chrom_texh == 0) params->chrom_texh = 1; switch (YUV_CONVERSION(params->type)) { case YUV_CONVERSION_COMBINERS: glSetupYUVCombiners(uvcos, uvsin);