From: Junghoon Date: Wed, 25 Nov 2015 07:33:48 +0000 (+0900) Subject: render: gl-renderer: minor refactoring of repaint_region_scissor() X-Git-Tag: accepted/tizen/mobile/20151221.050925~20 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F10%2F52910%2F1;p=platform%2Fcore%2Fuifw%2Fpepper.git render: gl-renderer: minor refactoring of repaint_region_scissor() Change-Id: Iaec6c59dc57cd96698ed426eddac534d905e10b9 --- diff --git a/src/lib/render/gl-renderer.c b/src/lib/render/gl-renderer.c index e7be3f7..c7f4f87 100644 --- a/src/lib/render/gl-renderer.c +++ b/src/lib/render/gl-renderer.c @@ -1179,60 +1179,39 @@ repaint_view_clip(pepper_renderer_t *renderer, pepper_output_t *output, } static void +set_vertex(gl_surface_state_t *state, int32_t sx, int32_t sy, GLfloat *vertex_array) +{ + double x, y; + + pepper_coordinates_surface_to_buffer(state->surface, sx, sy, &x, &y); + + if (!state->y_inverted) + y = state->buffer_height - y; + + vertex_array[ 0] = sx; + vertex_array[ 1] = sy; + vertex_array[ 2] = (GLfloat)x / state->buffer_width; + vertex_array[ 3] = (GLfloat)y / state->buffer_height; +} + +static void repaint_region_scissor(gl_renderer_t *gr, gl_surface_state_t *state, pixman_region32_t *damage, pixman_region32_t *surface_region) { - int i, j, w, h; + int i, j; int nrects, surface_nrects; pixman_box32_t *rects, *surface_rects; GLfloat vertex_array[16]; - gl_render_target_t *gt = (gl_render_target_t *)gr->base.target; - pepper_surface_t *surface = state->surface; - w = state->buffer_width; - h = state->buffer_height; surface_rects = pixman_region32_rectangles(surface_region, &surface_nrects); for (i = 0; i < surface_nrects; i++) { - double x, y; - - pepper_coordinates_surface_to_buffer(surface, surface_rects[i].x1, surface_rects[i].y1, - &x, &y); - if (!state->y_inverted) - y = h - y; - vertex_array[ 0] = surface_rects[i].x1; - vertex_array[ 1] = surface_rects[i].y1; - vertex_array[ 2] = (GLfloat)x / w; - vertex_array[ 3] = (GLfloat)y / h; - - pepper_coordinates_surface_to_buffer(surface, surface_rects[i].x2, surface_rects[i].y1, - &x, &y); - if (!state->y_inverted) - y = h - y; - vertex_array[ 4] = surface_rects[i].x2; - vertex_array[ 5] = surface_rects[i].y1; - vertex_array[ 6] = (GLfloat)x / w; - vertex_array[ 7] = (GLfloat)y / h; - - pepper_coordinates_surface_to_buffer(surface, surface_rects[i].x2, surface_rects[i].y2, - &x, &y); - if (!state->y_inverted) - y = h - y; - vertex_array[ 8] = surface_rects[i].x2; - vertex_array[ 9] = surface_rects[i].y2; - vertex_array[10] = (GLfloat)x / w; - vertex_array[11] = (GLfloat)y / h; - - pepper_coordinates_surface_to_buffer(surface, surface_rects[i].x1, surface_rects[i].y2, - &x, &y); - if (!state->y_inverted) - y = h - y; - vertex_array[12] = surface_rects[i].x1; - vertex_array[13] = surface_rects[i].y2; - vertex_array[14] = (GLfloat)x / w; - vertex_array[15] = (GLfloat)y / h; + set_vertex(state, surface_rects[i].x1, surface_rects[i].y1, &vertex_array[0]); + set_vertex(state, surface_rects[i].x2, surface_rects[i].y1, &vertex_array[4]); + set_vertex(state, surface_rects[i].x2, surface_rects[i].y2, &vertex_array[8]); + set_vertex(state, surface_rects[i].x1, surface_rects[i].y2, &vertex_array[12]); glVertexAttribPointer(0, 2, GL_FLOAT, GL_FALSE, 4 * sizeof(GLfloat), &vertex_array[0]); glEnableVertexAttribArray(0);