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
This commit is contained in:
ChunEon Park 2012-12-15 09:40:47 +00:00
parent bd22aeb35d
commit a949b185e6
3 changed files with 49 additions and 8 deletions

View File

@ -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 <zehortigoza@profusion.mobi>
* Fix EINA_INLIST_FOREACH_SAFE macro to work when inlist is not the
first item in the struct.

2
NEWS
View File

@ -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.

View 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)
{
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,