aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/glamor/glamor_glyphblt.c
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2014-07-19 15:00:38 +0200
committermarha <marha@users.sourceforge.net>2014-07-19 15:00:38 +0200
commitd0c30e7945e76ac119f6d867e27137c8a76f7e15 (patch)
tree1bfb3148a6f43bdd32746c5b882f9f083076cf91 /xorg-server/glamor/glamor_glyphblt.c
parente708bebcc029873004ade4241f347ce8c58896af (diff)
downloadvcxsrv-d0c30e7945e76ac119f6d867e27137c8a76f7e15.tar.gz
vcxsrv-d0c30e7945e76ac119f6d867e27137c8a76f7e15.tar.bz2
vcxsrv-d0c30e7945e76ac119f6d867e27137c8a76f7e15.zip
fontconfig plink libX11 libxcb mesa git update 19 July 2014
plink revision 10207 xserver commit cfa302d6224d10860e60491333950544c4fb9b04 libxcb commit 49a61c8b459ab19c7f39e653bbb0d0339ea8f00f libX11 commit 5525e8433f93bce464412f27cffa203ea628f368 fontconfig commit 6781c6baef062eeea5b5b68e4a9c31ea6cd7539b mesa commit f6fc80734533140a69b30361fe0d4773a03515db
Diffstat (limited to 'xorg-server/glamor/glamor_glyphblt.c')
-rw-r--r--xorg-server/glamor/glamor_glyphblt.c154
1 files changed, 66 insertions, 88 deletions
diff --git a/xorg-server/glamor/glamor_glyphblt.c b/xorg-server/glamor/glamor_glyphblt.c
index 1c511ff2b..73b1df51e 100644
--- a/xorg-server/glamor/glamor_glyphblt.c
+++ b/xorg-server/glamor/glamor_glyphblt.c
@@ -56,7 +56,8 @@ glamor_poly_glyph_blt_gl(DrawablePtr drawable, GCPtr gc,
glamor_make_current(glamor_priv);
- prog = glamor_use_program_fill(pixmap, gc, &glamor_priv->poly_glyph_blt_progs,
+ prog = glamor_use_program_fill(pixmap, gc,
+ &glamor_priv->poly_glyph_blt_progs,
&glamor_facet_poly_glyph_blt);
if (!prog)
goto bail_ctx;
@@ -74,7 +75,8 @@ glamor_poly_glyph_blt_gl(DrawablePtr drawable, GCPtr gc,
int off_x, off_y;
char *vbo_offset;
- glamor_set_destination_drawable(drawable, box_x, box_y, FALSE, TRUE, prog->matrix_uniform, &off_x, &off_y);
+ glamor_set_destination_drawable(drawable, box_x, box_y, FALSE, TRUE,
+ prog->matrix_uniform, &off_x, &off_y);
max_points = 500;
num_points = 0;
@@ -105,10 +107,12 @@ glamor_poly_glyph_blt_gl(DrawablePtr drawable, GCPtr gc,
if (!num_points) {
points = glamor_get_vbo_space(screen,
- max_points * (2 * sizeof (INT16)),
+ max_points *
+ (2 * sizeof (INT16)),
&vbo_offset);
- glVertexAttribPointer(GLAMOR_VERTEX_POS, 2, GL_SHORT,
+ glVertexAttribPointer(GLAMOR_VERTEX_POS,
+ 2, GL_SHORT,
GL_FALSE, 0, vbo_offset);
}
@@ -149,7 +153,8 @@ glamor_poly_glyph_blt(DrawablePtr drawable, GCPtr gc,
int start_x, int y, unsigned int nglyph,
CharInfoPtr *ppci, void *pglyph_base)
{
- if (glamor_poly_glyph_blt_gl(drawable, gc, start_x, y, nglyph, ppci, pglyph_base))
+ if (glamor_poly_glyph_blt_gl(drawable, gc, start_x, y, nglyph, ppci,
+ pglyph_base))
return;
miPolyGlyphBlt(drawable, gc, start_x, y, nglyph,
ppci, pglyph_base);
@@ -160,10 +165,13 @@ glamor_poly_glyph_blt_nf(DrawablePtr drawable, GCPtr gc,
int start_x, int y, unsigned int nglyph,
CharInfoPtr *ppci, void *pglyph_base)
{
- if (glamor_poly_glyph_blt_gl(drawable, gc, start_x, y, nglyph, ppci, pglyph_base))
+ if (glamor_poly_glyph_blt_gl(drawable, gc, start_x, y, nglyph, ppci,
+ pglyph_base))
return TRUE;
- if (glamor_ddx_fallback_check_pixmap(drawable) && glamor_ddx_fallback_check_gc(gc))
+ if (glamor_ddx_fallback_check_pixmap(drawable) &&
+ glamor_ddx_fallback_check_gc(gc)) {
return FALSE;
+ }
miPolyGlyphBlt(drawable, gc, start_x, y, nglyph,
ppci, pglyph_base);
return TRUE;
@@ -179,8 +187,8 @@ glamor_image_glyph_blt_nf(DrawablePtr drawable, GCPtr gc,
}
static Bool
-glamor_push_pixels_points(GCPtr gc, PixmapPtr bitmap,
- DrawablePtr drawable, int w, int h, int x, int y)
+glamor_push_pixels_gl(GCPtr gc, PixmapPtr bitmap,
+ DrawablePtr drawable, int w, int h, int x, int y)
{
ScreenPtr screen = drawable->pScreen;
glamor_screen_private *glamor_priv = glamor_get_screen_private(screen);
@@ -188,65 +196,40 @@ glamor_push_pixels_points(GCPtr gc, PixmapPtr bitmap,
glamor_pixmap_private *pixmap_priv;
uint8_t *bitmap_data = bitmap->devPrivate.ptr;
int bitmap_stride = bitmap->devKind;
- int off_x, off_y;
+ glamor_program *prog;
+ RegionPtr clip = gc->pCompositeClip;
+ int box_x, box_y;
int yy, xx;
- GLfloat xscale, yscale;
- float color[4];
- unsigned long fg_pixel = gc->fgPixel;
- float *points, *next_point;
- int num_points = 0;
+ int num_points;
+ INT16 *points = NULL;
char *vbo_offset;
- RegionPtr clip;
if (w * h > MAXINT / (2 * sizeof(float)))
- return FALSE;
-
- if (gc->fillStyle != FillSolid) {
- glamor_fallback("gc fillstyle not solid\n");
- return FALSE;
- }
+ goto bail;
pixmap_priv = glamor_get_pixmap_private(pixmap);
if (!GLAMOR_PIXMAP_PRIV_HAS_FBO(pixmap_priv))
- return FALSE;
+ goto bail;
glamor_make_current(glamor_priv);
- if (!glamor_set_alu(screen, gc->alu)) {
- if (gc->alu == GXclear)
- fg_pixel = 0;
- else {
- glamor_fallback("unsupported alu %x\n", gc->alu);
- return FALSE;
- }
- }
-
- if (!glamor_set_planemask(pixmap, gc->planemask)) {
- glamor_fallback("Failed to set planemask in %s.\n", __FUNCTION__);
- return FALSE;
- }
-
- glamor_get_drawable_deltas(drawable, pixmap, &off_x, &off_y);
-
- glamor_set_destination_pixmap_priv_nc(pixmap_priv);
- pixmap_priv_get_dest_scale(pixmap_priv, &xscale, &yscale);
- glUseProgram(glamor_priv->solid_prog);
+ prog = glamor_use_program_fill(pixmap, gc,
+ &glamor_priv->poly_glyph_blt_progs,
+ &glamor_facet_poly_glyph_blt);
+ if (!prog)
+ goto bail_ctx;
- glamor_get_rgba_from_pixel(fg_pixel,
- &color[0], &color[1], &color[2], &color[3],
- format_for_pixmap(pixmap));
- glUniform4fv(glamor_priv->solid_color_uniform_location, 1, color);
+ glEnableVertexAttribArray(GLAMOR_VERTEX_POS);
- points = glamor_get_vbo_space(screen, w * h * sizeof(float) * 2,
+ points = glamor_get_vbo_space(screen, w * h * sizeof(INT16) * 2,
&vbo_offset);
- next_point = points;
-
- clip = fbGetCompositeClip(gc);
+ num_points = 0;
/* Note that because fb sets miTranslate in the GC, our incoming X
* and Y are in screen coordinate space (same for spans, but not
* other operations).
*/
+
for (yy = 0; yy < h; yy++) {
uint8_t *bitmap_row = bitmap_data + yy * bitmap_stride;
for (xx = 0; xx < w; xx++) {
@@ -255,63 +238,58 @@ glamor_push_pixels_points(GCPtr gc, PixmapPtr bitmap,
x + xx,
y + yy,
NULL)) {
- next_point[0] = v_from_x_coord_x(xscale, x + xx + off_x + 0.5);
- if (glamor_priv->yInverted)
- next_point[1] = v_from_x_coord_y_inverted(yscale, y + yy + off_y + 0.5);
- else
- next_point[1] = v_from_x_coord_y(yscale, y + yy + off_y + 0.5);
-
- next_point += 2;
+ *points++ = x + xx;
+ *points++ = y + yy;
num_points++;
}
}
}
- glVertexAttribPointer(GLAMOR_VERTEX_POS, 2, GL_FLOAT,
- GL_FALSE, 2 * sizeof(float),
- vbo_offset);
- glEnableVertexAttribArray(GLAMOR_VERTEX_POS);
+ glVertexAttribPointer(GLAMOR_VERTEX_POS, 2, GL_SHORT,
+ GL_FALSE, 0, vbo_offset);
glamor_put_vbo_space(screen);
- glDrawArrays(GL_POINTS, 0, num_points);
-
- glDisableVertexAttribArray(GLAMOR_VERTEX_POS);
-
- return TRUE;
-}
-
-static Bool
-_glamor_push_pixels(GCPtr pGC, PixmapPtr pBitmap,
- DrawablePtr pDrawable, int w, int h, int x, int y,
- Bool fallback)
-{
- glamor_pixmap_private *pixmap_priv;
-
- if (!fallback && glamor_ddx_fallback_check_pixmap(pDrawable)
- && glamor_ddx_fallback_check_pixmap(&pBitmap->drawable)
- && glamor_ddx_fallback_check_gc(pGC))
- return FALSE;
+ glamor_pixmap_loop(pixmap_priv, box_x, box_y) {
+ glamor_set_destination_drawable(drawable, box_x, box_y, FALSE, TRUE,
+ prog->matrix_uniform, NULL, NULL);
- pixmap_priv = glamor_get_pixmap_private(pBitmap);
- if (pixmap_priv->type == GLAMOR_MEMORY) {
- if (glamor_push_pixels_points(pGC, pBitmap, pDrawable, w, h, x, y))
- return TRUE;
+ glDrawArrays(GL_POINTS, 0, num_points);
}
- miPushPixels(pGC, pBitmap, pDrawable, w, h, x, y);
+ glDisable(GL_COLOR_LOGIC_OP);
+ glDisableVertexAttribArray(GLAMOR_VERTEX_POS);
return TRUE;
+
+bail_ctx:
+ glDisable(GL_COLOR_LOGIC_OP);
+bail:
+ return FALSE;
}
void
glamor_push_pixels(GCPtr pGC, PixmapPtr pBitmap,
DrawablePtr pDrawable, int w, int h, int x, int y)
{
- _glamor_push_pixels(pGC, pBitmap, pDrawable, w, h, x, y, TRUE);
+ if (glamor_push_pixels_gl(pGC, pBitmap, pDrawable, w, h, x, y))
+ return;
+
+ miPushPixels(pGC, pBitmap, pDrawable, w, h, x, y);
}
Bool
-glamor_push_pixels_nf(GCPtr pGC, PixmapPtr pBitmap,
- DrawablePtr pDrawable, int w, int h, int x, int y)
+glamor_push_pixels_nf(GCPtr gc, PixmapPtr bitmap,
+ DrawablePtr drawable, int w, int h, int x, int y)
{
- return _glamor_push_pixels(pGC, pBitmap, pDrawable, w, h, x, y, FALSE);
+ if (glamor_push_pixels_gl(gc, bitmap, drawable, w, h, x, y))
+ return TRUE;
+
+ if (glamor_ddx_fallback_check_pixmap(drawable) &&
+ glamor_ddx_fallback_check_pixmap(&bitmap->drawable) &&
+ glamor_ddx_fallback_check_gc(gc))
+ {
+ return FALSE;
+ }
+
+ miPushPixels(gc, bitmap, drawable, w, h, x, y);
+ return TRUE;
}