Keith Packard <kei...@keithp.com> writes:

> This just adds a bunch of support code to construct shaders from
> 'facets', which bundle attributes needed for each layer of the
> rendering system. At this point, that includes only the primtive and
> the fill stuff.
>
> Signed-off-by: Keith Packard <kei...@keithp.com>

> diff --git a/glamor/glamor_transform.c b/glamor/glamor_transform.c
> new file mode 100644
> index 0000000..f5a6bb2
> --- /dev/null
> +++ b/glamor/glamor_transform.c

> +
> +    /* A tricky computation to find the right value for the two linear 
> functions
> +     * that transform rendering coordinates to pixmap coordinates
> +     *
> +     *  pixmap_x = render_x + drawable->x + off_x
> +     *  pixmap_y = render_y + drawable->y + off_y
> +     *
> +     *  gl_x = pixmap_x * 2 / width - 1
> +     *  gl_y = pixmap_y * 2 / height - 1
> +     *
> +     *  gl_x = (render_x + drawable->x + off_x) * 2 / width - 1
> +     *
> +     *  gl_x = (render_x) * 2 / width + (drawable->x + off_x) * 2 / width - 1
> +     *
> +     * To get GL_POINTS drawn in the right spot, we need to adjust the
> +     * coordinates by 1/2 a pixel. This doesn't hurt rectangles at
> +     * all, so we just always do it. If we need to change someday, we
> +     * can add a parameter to this function

This comment is stale now that center_offset exists.

> +
> +    if (do_drawable_translate) {
> +        off_x += drawable->x;
> +        off_y += drawable->y;
> +    }
> +
> +    if (center_offset)
> +        center_adjust = 0.5f;
> +
> +    glUniform4f(matrix_uniform_location,
> +                scale_x, (off_x + center_adjust) * scale_x - 1.0f,
> +                scale_y, (off_y + center_adjust) * scale_y - 1.0f);
> +
> +    glamor_set_destination_pixmap_fbo(glamor_pixmap_fbo_at(pixmap_priv, 
> box_x, box_y),
> +                                      0, 0, w, h);
> +}

Attachment: pgph_MHsTMOEw.pgp
Description: PGP signature

_______________________________________________
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

Reply via email to