Revert "evas gl: move to floating point coordinate system."

This reverts commit 2ac93b5005.
This commit is contained in:
Hermet Park 2019-04-18 15:24:55 +09:00
parent dd11b54f87
commit 3a5ca4d1d9
3 changed files with 75 additions and 42 deletions

View File

@ -335,7 +335,7 @@ struct _Evas_Engine_GL_Context
} shader;
struct {
int num, alloc;
GLfloat *vertex;
GLshort *vertex;
GLubyte *color;
GLfloat *texuv;
GLfloat *texuv2;

View File

@ -1403,7 +1403,7 @@ array_alloc(Evas_Engine_GL_Context *gc, int n)
gc->pipe[n].array.field = _pipebuf_resize(gc->pipe[n].array.field, \
gc->pipe[n].array.alloc * sizeof(type) * size)
RALOC(vertex, GLfloat, VERTEX_CNT);
RALOC(vertex, GLshort, VERTEX_CNT);
RALOC(color, GLubyte, COLOR_CNT);
RALOC(texuv, GLfloat, TEX_CNT);
RALOC(texa, GLfloat, TEX_CNT);
@ -1778,21 +1778,14 @@ static int
pipe_region_intersects(Evas_Engine_GL_Context *gc, int n,
int x, int y, int w, int h)
{
#define SPANS_INTERSECT(x1, w1, x2, w2) \
(!((((x2) + (w2)) <= (x1)) || ((x2) >= ((x1) + (w1)))))
#define REGIONS_INTERSECT(x, y, w, h, xx, yy, ww, hh) \
((SPANS_COMMON((x), (w), (xx), (ww))) && (SPANS_COMMON((y), (h), (yy), (hh))))
float rx, ry, rw, rh;
int ii, end;
const GLfloat *v;
int rx, ry, rw, rh, ii, end;
const GLshort *v;
rx = gc->pipe[n].region.x;
ry = gc->pipe[n].region.y;
rw = gc->pipe[n].region.w;
rh = gc->pipe[n].region.h;
if (!REGIONS_INTERSECT(x, y, w, h, rx, ry, rw, rh)) return 0;
if (!RECTS_INTERSECT(x, y, w, h, rx, ry, rw, rh)) return 0;
// a hack for now. map pipes use their whole bounding box for intersects
// which at worst case reduces to old pipeline flushes, but cheaper than
@ -1810,7 +1803,7 @@ pipe_region_intersects(Evas_Engine_GL_Context *gc, int n,
ry = v[ii + 1];
rw = v[ii + 3] - rx;
rh = v[ii + 7] - ry;
if (REGIONS_INTERSECT(x, y, w, h, rx, ry, rw, rh)) return 1;
if (RECTS_INTERSECT(x, y, w, h, rx, ry, rw, rh)) return 1;
}
return 0;
}
@ -2937,14 +2930,16 @@ evas_gl_common_context_image_map_push(Evas_Engine_GL_Context *gc,
(A_VAL(&(p[2].col)) < 0xff) || (A_VAL(&(p[3].col)) < 0xff))
blend = EINA_TRUE;
if (((p[0].z == p[1].z) && (p[1].z == p[2].z) && (p[2].z == p[3].z)) ||
(p[0].foc <= 0))
{
flat = EINA_TRUE;
}
if ((p[0].z == p[1].z) && (p[1].z == p[2].z) && (p[2].z == p[3].z))
flat = EINA_TRUE;
if (!clip) cx = cy = cw = ch = 0;
if (!flat)
{
if (p[0].foc <= 0) flat = EINA_TRUE;
}
switch (cspace)
{
case EVAS_COLORSPACE_YCBCR422P601_PL:
@ -3005,11 +3000,28 @@ evas_gl_common_context_image_map_push(Evas_Engine_GL_Context *gc,
w = w - x;
h = h - y;
// FUZZZZ!
x -= 3;
y -= 3;
w += 6;
h += 6;
if (!flat)
{
// FUZZZZ!
x -= 3;
y -= 3;
w += 6;
h += 6;
}
if (clip)
{
if (flat)
{
int nx = x, ny = y, nw = w, nh = h;
RECTS_CLIP_TO_RECT(nx, ny, nw, nh, cx, cy, cw, ch);
if ((nx == x) && (ny == y) && (nw == w) && (nh == h))
{
clip = 0; cx = 0; cy = 0; cw = 0; ch = 0;
}
x = nx; y = ny; w = nw; h = nh;
}
}
if (!flat)
{
@ -3021,17 +3033,6 @@ evas_gl_common_context_image_map_push(Evas_Engine_GL_Context *gc,
gc->change.size = 1;
_evas_gl_common_viewport_set(gc);
}
else if (clip)
{
int nx = x, ny = y, nw = w, nh = h;
RECTS_CLIP_TO_RECT(nx, ny, nw, nh, cx, cy, cw, ch);
if ((nx == x) && (ny == y) && (nw == w) && (nh == h))
{
clip = 0; cx = 0; cy = 0; cw = 0; ch = 0;
}
x = nx; y = ny; w = nw; h = nh;
}
pn = _evas_gl_common_context_push(SHD_MAP,
gc, tex, mtex,
@ -3107,8 +3108,8 @@ evas_gl_common_context_image_map_push(Evas_Engine_GL_Context *gc,
if (flat)
{
PUSH_VERTEX(pn,
p[points[i]].fx,
p[points[i]].fy,
(p[points[i]].x >> FP),
(p[points[i]].y >> FP),
0);
}
else
@ -4105,7 +4106,7 @@ shader_array_flush(Evas_Engine_GL_Context *gc)
}
// use_vertex is always true
glVertexAttribPointer(SHAD_VERTEX, VERTEX_CNT, GL_FLOAT, GL_FALSE, 0, vertex_ptr);
glVertexAttribPointer(SHAD_VERTEX, VERTEX_CNT, GL_SHORT, GL_FALSE, 0, vertex_ptr);
if (gc->pipe[i].array.use_color)
{

View File

@ -1229,17 +1229,49 @@ eng_image_scale_hint_get(void *engine EINA_UNUSED, void *image)
}
static Eina_Bool
eng_image_map_draw(void *engine EINA_UNUSED, void *data, void *context, void *surface, void *image,
RGBA_Map *m, int smooth, int level, Eina_Bool do_async EINA_UNUSED)
eng_image_map_draw(void *engine, void *data, void *context, void *surface, void *image, RGBA_Map *m, int smooth, int level, Eina_Bool do_async)
{
Evas_Engine_GL_Context *gl_context;
Evas_GL_Image *gim = image;
if (!image) return EINA_FALSE;
gl_context = gl_generic_context_get(data, 1);
evas_gl_common_context_target_surface_set(gl_context, surface);
gl_context->dc = context;
evas_gl_common_image_map_draw(gl_context, image, m->count, &m->pts[0],
smooth, level);
if ((m->pts[0].x == m->pts[3].x) &&
(m->pts[1].x == m->pts[2].x) &&
(m->pts[0].y == m->pts[1].y) &&
(m->pts[3].y == m->pts[2].y) &&
(m->pts[0].x <= m->pts[1].x) &&
(m->pts[0].y <= m->pts[2].y) &&
(m->pts[0].u == 0) &&
(m->pts[0].v == 0) &&
(m->pts[1].u == (gim->w << FP)) &&
(m->pts[1].v == 0) &&
(m->pts[2].u == (gim->w << FP)) &&
(m->pts[2].v == (gim->h << FP)) &&
(m->pts[3].u == 0) &&
(m->pts[3].v == (gim->h << FP)) &&
(m->pts[0].col == 0xffffffff) &&
(m->pts[1].col == 0xffffffff) &&
(m->pts[2].col == 0xffffffff) &&
(m->pts[3].col == 0xffffffff))
{
int dx, dy, dw, dh;
dx = m->pts[0].x >> FP;
dy = m->pts[0].y >> FP;
dw = (m->pts[2].x >> FP) - dx;
dh = (m->pts[2].y >> FP) - dy;
eng_image_draw(engine, data, context, surface, image,
0, 0, gim->w, gim->h, dx, dy, dw, dh, smooth, do_async);
}
else
{
evas_gl_common_image_map_draw(gl_context, image, m->count, &m->pts[0],
smooth, level);
}
return EINA_FALSE;
}