From a949b185e69f30f83b633507e4af1ddf3400bac0 Mon Sep 17 00:00:00 2001 From: ChunEon Park Date: Sat, 15 Dec 2012 09:40:47 +0000 Subject: [PATCH] evas/gl - fix the line incorrect position in arm. line position is slightly different between gl drivers. I have no idea why it is. So added to work differently based on the manufacturers. This work may be based on the renderer. If you can test it with much drivers then please test and fix. Also changed the ENV name from EVAS_GL_LINE_NO_OFFSET_HACK to EVAS_GL_LINE_OFFSET_HACK_DISABLE. SVN revision: 81016 --- ChangeLog | 5 ++ NEWS | 2 + .../evas/engines/gl_common/evas_gl_line.c | 50 ++++++++++++++++--- 3 files changed, 49 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2d8a3ee299..1d4b6a3782 100644 --- a/ChangeLog +++ b/ChangeLog @@ -170,3 +170,8 @@ * Fix EINA_INLIST_FOREACH_SAFE macro to work when inlist is not the first item in the struct. + +2012-09-04 Roberto de Souza + + * Fix EINA_INLIST_FOREACH_SAFE macro to work when inlist is not the + first item in the struct. diff --git a/NEWS b/NEWS index 2288d159dc..e17e355969 100644 --- a/NEWS +++ b/NEWS @@ -41,6 +41,7 @@ Additions: * ecore_getopt: add ECORE_GETOPT_ACTION_BREAK * evas: - Add ellipsis support in Evas_Object_Text. + - Add EVAS_GL_LINE_OFFSET_HACK_DISABLE to turn off line shift correction by evas. Deprecations: * ecore_x: @@ -80,3 +81,4 @@ Fixes: * Fix possible memory corruption in xrandr EDID functions. * Fix potential segv in software engine native_set code. * Fix uninitialized data in Evas OpenGL engine. + * Fix the line drawing clipping problem on arm gl driver. diff --git a/src/modules/evas/engines/gl_common/evas_gl_line.c b/src/modules/evas/engines/gl_common/evas_gl_line.c index 4a8c1c31ae..364f011524 100644 --- a/src/modules/evas/engines/gl_common/evas_gl_line.c +++ b/src/modules/evas/engines/gl_common/evas_gl_line.c @@ -1,12 +1,15 @@ #include "evas_gl_private.h" - void evas_gl_common_line_draw(Evas_Engine_GL_Context *gc, int x1, int y1, int x2, int y2) { RGBA_Draw_Context *dc; int r, g, b, a; int c, cx, cy, cw, ch; + static int offset_hack = -1; + const int OFFSET_HACK_OFF = 0; + const int OFFSET_HACK_DEFAULT = 1; + const int OFFSET_HACK_ARM = 2; dc = gc->dc; if (dc->mul.use) @@ -28,16 +31,47 @@ evas_gl_common_line_draw(Evas_Engine_GL_Context *gc, int x1, int y1, int x2, int cx = gc->dc->clip.x; cy = gc->dc->clip.y; cw = gc->dc->clip.w; ch = gc->dc->clip.h; - //Increment pixels since the gl line origin position is slightly different. - if ((gc->rot == 0) || (gc->rot == 90)) + //I have no idea but shift lines/clips since the gl line origin position and + //sissor area is slightly different by the gl driver. + if (offset_hack == -1) { - x1++; - x2++; + if (!getenv("EVAS_GL_LINE_OFFSET_HACK_DISABLE")) + { + const char *vendor_name; + vendor_name = (char *) glGetString(GL_VENDOR); + if (vendor_name && !strcmp(vendor_name, "ARM")) + offset_hack = OFFSET_HACK_ARM; + else + offset_hack = OFFSET_HACK_DEFAULT; + } + else offset_hack = OFFSET_HACK_OFF; } - if ((gc->rot == 90) || (gc->rot == 180)) + + if (offset_hack == OFFSET_HACK_DEFAULT) { - y1++; - y2++; + if ((gc->rot == 0) || (gc->rot == 90)) + { + x1++; + x2++; + } + if ((gc->rot == 90) || (gc->rot == 180)) + { + y1++; + y2++; + } + } + else if (offset_hack == OFFSET_HACK_ARM) + { + if ((gc->rot == 90) || (gc->rot == 180)) + { + cx--; + cw--; + } + if ((gc->rot == 180) || (gc->rot == 270)) + { + cy--; + ch--; + } } evas_gl_common_context_line_push(gc, x1, y1, x2, y2,