From: Joogab Yun Date: Mon, 12 Jun 2017 06:33:44 +0000 (+0900) Subject: [evas_gl_engine] 1. add orientation checking at image_stride_get() X-Git-Tag: submit/sandbox/upgrade/efl120/20180319.053334~933 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=996c67e1ea67e8e3428f9443154cb04f5ada0616;p=platform%2Fupstream%2Fefl.git [evas_gl_engine] 1. add orientation checking at image_stride_get() 2. add stride_get in case of tbm surface Change-Id: I6ea901be0ba316f98dd1cc56ac697078c9a67cef --- diff --git a/src/modules/evas/engines/gl_generic/evas_engine.c b/src/modules/evas/engines/gl_generic/evas_engine.c index 33e905f..ca6319e 100755 --- a/src/modules/evas/engines/gl_generic/evas_engine.c +++ b/src/modules/evas/engines/gl_generic/evas_engine.c @@ -1547,28 +1547,51 @@ static void eng_image_stride_get(void *engine EINA_UNUSED, void *image, int *stride) { Evas_GL_Image *im = image; + int width = 0; + + if (im->native.data) + { + Evas_Native_Surface *ns = im->native.data; + if (ns->type == EVAS_NATIVE_SURFACE_TBM) + { + tbm_surface_h tbm = ns->data.tbm.buffer; + tbm_surface_info_s tinfo; + secsym_tbm_surface_get_info(tbm, &tinfo); + *stride = tinfo.planes[0].stride; + return; + } + } if ((im->tex) && (im->tex->pt->dyn.img)) *stride = im->tex->pt->dyn.stride; else { + + if (im->orient == EVAS_IMAGE_ORIENT_90 || + im->orient == EVAS_IMAGE_ORIENT_270 || + im->orient == EVAS_IMAGE_FLIP_TRANSPOSE || + im->orient == EVAS_IMAGE_FLIP_TRANSVERSE) + width = im->h; + else + width = im->w; + switch (im->cs.space) { case EVAS_COLORSPACE_ARGB8888: - *stride = im->w * 4; + *stride = width * 4; return; case EVAS_COLORSPACE_AGRY88: - *stride = im->w * 2; + *stride = width * 2; return; case EVAS_COLORSPACE_GRY8: - *stride = im->w * 1; + *stride = width * 1; return; case EVAS_COLORSPACE_YCBCR422P601_PL: case EVAS_COLORSPACE_YCBCR422P709_PL: case EVAS_COLORSPACE_YCBCR422601_PL: case EVAS_COLORSPACE_YCBCR420NV12601_PL: case EVAS_COLORSPACE_YCBCR420TM12601_PL: - *stride = im->w * 1; + *stride = width * 1; return; /* the strides below are approximations, since stride doesn't * really make sense for ETC & S3TC */ @@ -1576,7 +1599,7 @@ eng_image_stride_get(void *engine EINA_UNUSED, void *image, int *stride) case EVAS_COLORSPACE_RGB8_ETC2: case EVAS_COLORSPACE_RGB_S3TC_DXT1: case EVAS_COLORSPACE_RGBA_S3TC_DXT1: - *stride = (im->w + 2 + 3) / 4 * (8 / 4); + *stride = (width + 2 + 3) / 4 * (8 / 4); return; case EVAS_COLORSPACE_ETC1_ALPHA: case EVAS_COLORSPACE_RGBA8_ETC2_EAC: @@ -1584,7 +1607,7 @@ eng_image_stride_get(void *engine EINA_UNUSED, void *image, int *stride) case EVAS_COLORSPACE_RGBA_S3TC_DXT3: case EVAS_COLORSPACE_RGBA_S3TC_DXT4: case EVAS_COLORSPACE_RGBA_S3TC_DXT5: - *stride = (im->w + 2 + 3) / 4 * (16 / 4); + *stride = (width + 2 + 3) / 4 * (16 / 4); return; default: ERR("Requested stride on an invalid format %d", im->cs.space);