evas/gl - fix the line incorrect position in arm.
authorChunEon Park <hermet@hermet.pe.kr>
Sat, 15 Dec 2012 09:40:47 +0000 (09:40 +0000)
committerChunEon Park <hermet@hermet.pe.kr>
Sat, 15 Dec 2012 09:40:47 +0000 (09:40 +0000)
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
NEWS
src/modules/evas/engines/gl_common/evas_gl_line.c

index 2d8a3ee..1d4b6a3 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
 
         * Fix EINA_INLIST_FOREACH_SAFE macro to work when inlist is not the
         first item in the struct.
+
+2012-09-04  Roberto de Souza <zehortigoza@profusion.mobi>
+
+        * 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 2288d15..e17e355 100644 (file)
--- 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.
index 4a8c1c3..364f011 100644 (file)
@@ -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)
+     {
+        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 (offset_hack == OFFSET_HACK_DEFAULT)
      {
-        x1++;
-        x2++;
+        if ((gc->rot == 0) || (gc->rot == 90))
+          {
+             x1++;
+             x2++;
+          }
+        if ((gc->rot == 90) || (gc->rot == 180))
+          {
+             y1++;
+             y2++;
+          }
      }
-   if ((gc->rot == 90) || (gc->rot == 180))
+   else if (offset_hack == OFFSET_HACK_ARM)
      {
-        y1++;
-        y2++;
+        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,