gl-renderer: pass 'gr' from draw_view()

Avoid looking up 'gr' from view->compositor by passing it explicitly
into the functions needing it.

Also fixes the whitespace in repaint_region() signature.

Clarifies code by removing local variables, but also future changes will
need 'gr' more.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
dev
Pekka Paalanen 4 years ago committed by Pekka Paalanen
parent 6e45fcc999
commit 83e4315e41
  1. 17
      libweston/renderer-gl/gl-renderer.c

@ -721,10 +721,9 @@ static const struct gl_shader_requirements requirements_triangle_fan = {
}; };
static void static void
triangle_fan_debug(struct weston_view *view, int first, int count) triangle_fan_debug(struct gl_renderer *gr,
int first, int count)
{ {
struct weston_compositor *compositor = view->surface->compositor;
struct gl_renderer *gr = get_renderer(compositor);
int i; int i;
GLushort *buffer; GLushort *buffer;
GLushort *index; GLushort *index;
@ -767,11 +766,11 @@ triangle_fan_debug(struct weston_view *view, int first, int count)
} }
static void static void
repaint_region(struct weston_view *ev, pixman_region32_t *region, repaint_region(struct gl_renderer *gr,
struct weston_view *ev,
pixman_region32_t *region,
pixman_region32_t *surf_region) pixman_region32_t *surf_region)
{ {
struct weston_compositor *ec = ev->surface->compositor;
struct gl_renderer *gr = get_renderer(ec);
GLfloat *v; GLfloat *v;
unsigned int *vtxcnt; unsigned int *vtxcnt;
int i, first, nfans; int i, first, nfans;
@ -800,7 +799,7 @@ repaint_region(struct weston_view *ev, pixman_region32_t *region,
for (i = 0, first = 0; i < nfans; i++) { for (i = 0, first = 0; i < nfans; i++) {
glDrawArrays(GL_TRIANGLE_FAN, first, vtxcnt[i]); glDrawArrays(GL_TRIANGLE_FAN, first, vtxcnt[i]);
if (gr->fan_debug) if (gr->fan_debug)
triangle_fan_debug(ev, first, vtxcnt[i]); triangle_fan_debug(gr, first, vtxcnt[i]);
first += vtxcnt[i]; first += vtxcnt[i];
} }
@ -1086,14 +1085,14 @@ draw_view(struct weston_view *ev, struct weston_output *output,
else else
glDisable(GL_BLEND); glDisable(GL_BLEND);
repaint_region(ev, &repaint, &surface_opaque); repaint_region(gr, ev, &repaint, &surface_opaque);
gs->used_in_output_repaint = true; gs->used_in_output_repaint = true;
} }
if (pixman_region32_not_empty(&surface_blend)) { if (pixman_region32_not_empty(&surface_blend)) {
gl_renderer_use_program(gr, &shader); gl_renderer_use_program(gr, &shader);
glEnable(GL_BLEND); glEnable(GL_BLEND);
repaint_region(ev, &repaint, &surface_blend); repaint_region(gr, ev, &repaint, &surface_blend);
gs->used_in_output_repaint = true; gs->used_in_output_repaint = true;
} }

Loading…
Cancel
Save