if (atlas->row_height < glyph_draw->height)
        atlas->row_height = glyph_draw->height;

    atlas->nglyph++;

    return TRUE;
}

static const glamor_facet glamor_facet_composite_glyphs_130 = {
    .name = "composite_glyphs",
    .version = 130,
    .vs_vars = ("attribute vec4 primitive;\n"
                "attribute vec2 source;\n"
                "varying vec2 glyph_pos;\n"),
    .vs_exec = ("       vec2 pos = primitive.zw * vec2(gl_VertexID&1, (gl_VertexID&2)>>1);\n"
                GLAMOR_POS(gl_Position, (primitive.xy + pos))
                "       glyph_pos = (source + pos) * ATLAS_DIM_INV;\n"),
    .fs_vars = ("varying vec2 glyph_pos;\n"),
    .fs_exec = ("       vec4 mask = texture2D(atlas, glyph_pos);\n"),
    .source_name = "source",
    .locations = glamor_program_location_atlas,
};

static const glamor_facet glamor_facet_composite_glyphs_120 = {
    .name = "composite_glyphs",
    .vs_vars = ("attribute vec2 primitive;\n"
                "attribute vec2 source;\n"
                "varying vec2 glyph_pos;\n"),
    .vs_exec = (GLAMOR_POS(gl_Position, primitive)
                "       glyph_pos = source.xy * ATLAS_DIM_INV;\n"),
    .fs_vars = ("varying vec2 glyph_pos;\n"),
Beispiel #2
0
 * OF THIS SOFTWARE.
 */

#include "glamor_priv.h"
#include "glamor_program.h"
#include "glamor_transform.h"
#include "glamor_transfer.h"
#include "glamor_prepare.h"

static const char dash_vs_vars[] =
    "attribute vec3 primitive;\n"
    "varying float dash_offset;\n";

static const char dash_vs_exec[] =
    "       dash_offset = primitive.z / dash_length;\n"
    GLAMOR_POS(gl_Position, primitive.xy);

static const char dash_fs_vars[] =
    "varying float dash_offset;\n";

static const char on_off_fs_exec[] =
    "       float pattern = texture2D(dash, vec2(dash_offset, 0.5)).w;\n"
    "       if (pattern == 0.0)\n"
    "               discard;\n";

/* XXX deal with stippled double dashed lines once we have stippling support */
static const char double_fs_exec[] =
    "       float pattern = texture2D(dash, vec2(dash_offset, 0.5)).w;\n"
    "       if (pattern == 0.0)\n"
    "               gl_FragColor = bg;\n"
    "       else\n"
Beispiel #3
0
 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
 * OF THIS SOFTWARE.
 */

#include "glamor_priv.h"
#include "glamor_transform.h"
#include "glamor_transfer.h"

glamor_program  fill_spans_progs[4];

static const glamor_facet glamor_facet_fillspans_130 = {
    .name = "fill_spans",
    .version = 130,
    .vs_vars =  "attribute vec3 primitive;\n",
    .vs_exec = ("       vec2 pos = vec2(primitive.z,1) * vec2(gl_VertexID&1, (gl_VertexID&2)>>1);\n"
                GLAMOR_POS(gl_Position, (primitive.xy + pos))),
};

static const glamor_facet glamor_facet_fillspans_120 = {
    .name = "fill_spans",
    .vs_vars =  "attribute vec2 primitive;\n",
    .vs_exec = ("       vec2 pos = vec2(0,0);\n"
                GLAMOR_POS(gl_Position, primitive.xy)),
};

static Bool
glamor_fill_spans_gl(DrawablePtr drawable,
                     GCPtr gc,
                     int n, DDXPointPtr points, int *widths, int sorted)
{
    ScreenPtr screen = drawable->pScreen;
 * IN THE SOFTWARE.
 *
 * Authors:
 *    Zhigang Gong <*****@*****.**>
 *
 */

#include "glamor_priv.h"
#include <dixfontstr.h>
#include "glamor_transform.h"

static const glamor_facet glamor_facet_poly_glyph_blt = {
    .name = "poly_glyph_blt",
    .vs_vars = "attribute vec2 primitive;\n",
    .vs_exec = ("       vec2 pos = vec2(0,0);\n"
                GLAMOR_POS(gl_Position, primitive)),
};

static Bool
glamor_poly_glyph_blt_gl(DrawablePtr drawable, GCPtr gc,
                         int start_x, int y, unsigned int nglyph,
                         CharInfoPtr *ppci, void *pglyph_base)
{
    ScreenPtr screen = drawable->pScreen;
    glamor_screen_private *glamor_priv = glamor_get_screen_private(screen);
    PixmapPtr pixmap = glamor_get_drawable_pixmap(drawable);
    glamor_pixmap_private *pixmap_priv;
    glamor_program *prog;
    RegionPtr clip = gc->pCompositeClip;
    int box_index;