summaryrefslogtreecommitdiff
path: root/src/modules
diff options
context:
space:
mode:
authorCarsten Haitzler (Rasterman) <raster@rasterman.com>2013-09-26 19:19:50 +0900
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>2013-09-26 19:20:22 +0900
commitd4861504127c8a2d7375b076c18c22086914e94c (patch)
tree4d5b13c99ba0f379ad424880d51b16b00fab168f /src/modules
parentdfb0e32bb66691bf784402ab5860fe3454b57b6c (diff)
evas gl engine - simplify and optimise pipe region intersection checks.
Diffstat (limited to 'src/modules')
-rw-r--r--src/modules/evas/engines/gl_common/evas_gl_context.c30
1 files changed, 12 insertions, 18 deletions
diff --git a/src/modules/evas/engines/gl_common/evas_gl_context.c b/src/modules/evas/engines/gl_common/evas_gl_context.c
index ea8194c217..951cfbe362 100644
--- a/src/modules/evas/engines/gl_common/evas_gl_context.c
+++ b/src/modules/evas/engines/gl_common/evas_gl_context.c
@@ -1166,37 +1166,31 @@ static int
1166pipe_region_intersects(Evas_Engine_GL_Context *gc, int n, 1166pipe_region_intersects(Evas_Engine_GL_Context *gc, int n,
1167 int x, int y, int w, int h) 1167 int x, int y, int w, int h)
1168{ 1168{
1169 int i, rx, ry, rw, rh, ii; 1169 int i, rx, ry, rw, rh, end;
1170 const GLshort *v;
1170 1171
1171 rx = gc->pipe[n].region.x; 1172 rx = gc->pipe[n].region.x;
1172 ry = gc->pipe[n].region.y; 1173 ry = gc->pipe[n].region.y;
1173 rw = gc->pipe[n].region.w; 1174 rw = gc->pipe[n].region.w;
1174 rh = gc->pipe[n].region.h; 1175 rh = gc->pipe[n].region.h;
1175 if (!RECTS_INTERSECT(x, y, w, h, rx, ry, rw, rh)) 1176 if (!RECTS_INTERSECT(x, y, w, h, rx, ry, rw, rh)) return 0;
1176 return 0;
1177 1177
1178 // a hack for now. map pipes use their whole bounding box for intersects 1178 // a hack for now. map pipes use their whole bounding box for intersects
1179 // which at worst case reduces to old pipeline flushes, but cheaper than 1179 // which at worst case reduces to old pipeline flushes, but cheaper than
1180 // full quad region or triangle intersects right now 1180 // full quad region or triangle intersects right now
1181 if (gc->pipe[n].region.type == RTYPE_MAP) return 1; 1181 if (gc->pipe[n].region.type == RTYPE_MAP) return 1;
1182 1182 end = gc->pipe[n].array.num;
1183 for (i = 0, 1183 v = gc->pipe[n].array.vertex;
1184 ii = 0; 1184 for (i = 0; i < end; i += (3 * 3 * 2))
1185
1186 i < gc->pipe[n].array.num;
1187
1188 i += (3 * 2),
1189 ii += (3 * 3 * 2))
1190 { // tri 1... 1185 { // tri 1...
1191 // 0, 1, 2 < top left 1186 // 0, 1, 2 < top left
1192 // 3, 4, 5 < top right 1187 // 3, 4, 5 < top right
1193 // 6. 7, 8 < bottom left 1188 // 6, 7, 8 < bottom left
1194 rx = gc->pipe[n].array.vertex[ii + 0]; 1189 rx = v[i + 0];
1195 ry = gc->pipe[n].array.vertex[ii + 1]; 1190 ry = v[i + 1];
1196 rw = gc->pipe[n].array.vertex[ii + 3] - rx; 1191 rw = v[i + 3] - rx;
1197 rh = gc->pipe[n].array.vertex[ii + 7] - ry; 1192 rh = v[i + 7] - ry;
1198 if (RECTS_INTERSECT(x, y, w, h, rx, ry, rw, rh)) 1193 if (RECTS_INTERSECT(x, y, w, h, rx, ry, rw, rh)) return 1;
1199 return 1;
1200 } 1194 }
1201 return 0; 1195 return 0;
1202} 1196}