cogl: Simplify add_stencil_clip_region coordinates

https://gitlab.gnome.org/GNOME/mutter/merge_requests/969
This commit is contained in:
Daniel van Vugt 2019-12-13 15:52:11 +08:00
parent 99cc435730
commit a48206e827

View File

@ -170,26 +170,27 @@ add_stencil_clip_region (CoglFramebuffer *framebuffer,
for (i = 0; i < num_rectangles; i++) for (i = 0; i < num_rectangles; i++)
{ {
cairo_rectangle_int_t rect; cairo_rectangle_int_t rect;
float tl[4], br[4]; float x1, y1, z1, w1;
float x2, y2, z2, w2;
cairo_region_get_rectangle (region, i, &rect); cairo_region_get_rectangle (region, i, &rect);
tl[0] = rect.x; x1 = rect.x;
tl[1] = rect.y; y1 = rect.y;
tl[2] = 0.; z1 = 0.f;
tl[3] = 1.; w1 = 1.f;
br[0] = rect.x + rect.width; x2 = rect.x + rect.width;
br[1] = rect.y + rect.height; y2 = rect.y + rect.height;
br[2] = 0.; z2 = 0.f;
br[3] = 1.; w2 = 1.f;
cogl_matrix_transform_point (&matrix, &tl[0], &tl[1], &tl[2], &tl[3]); cogl_matrix_transform_point (&matrix, &x1, &y1, &z1, &w1);
cogl_matrix_transform_point (&matrix, &br[0], &br[1], &br[2], &br[3]); cogl_matrix_transform_point (&matrix, &x2, &y2, &z2, &w2);
_cogl_rectangle_immediate (framebuffer, _cogl_rectangle_immediate (framebuffer,
ctx->stencil_pipeline, ctx->stencil_pipeline,
tl[0], tl[1], br[0], br[1]); x1, y1, x2, y2);
} }
if (merge) if (merge)