glamor: Move planemask to a function in case I decide to fill it in.

This commit is contained in:
Eric Anholt 2009-08-24 08:59:52 -07:00 committed by Zhigang Gong
parent 882411bef1
commit 44e4599b83
6 changed files with 28 additions and 9 deletions

View File

@ -68,6 +68,17 @@ glamor_set_destination_pixmap(PixmapPtr pixmap)
return TRUE;
}
Bool
glamor_set_planemask(PixmapPtr pixmap, unsigned long planemask)
{
if (glamor_pm_is_solid(&pixmap->drawable, planemask)) {
return GL_TRUE;
}
ErrorF("unsupported planemask\n");
return GL_FALSE;
}
void
glamor_set_alu(unsigned char alu)
{

View File

@ -154,6 +154,8 @@ glamor_solid(PixmapPtr pixmap, int x, int y, int width, int height,
if (!glamor_set_destination_pixmap(pixmap))
return;
glamor_set_alu(alu);
if (!glamor_set_planemask(pixmap, planemask))
goto fail;
glUseProgramObjectARB(glamor_priv->solid_prog);
glamor_get_color_4f_from_pixel(pixmap, fg_pixel, color);
@ -168,6 +170,7 @@ glamor_solid(PixmapPtr pixmap, int x, int y, int width, int height,
glEnd();
glUseProgramObjectARB(0);
fail:
glamor_set_alu(GXcopy);
}

View File

@ -102,6 +102,7 @@ void glamor_get_color_4f_from_pixel(PixmapPtr pixmap, unsigned long fg_pixel,
GLfloat *color);
Bool glamor_set_destination_pixmap(PixmapPtr pixmap);
void glamor_set_alu(unsigned char alu);
Bool glamor_set_planemask(PixmapPtr pixmap, unsigned long planemask);
void glamor_get_transform_uniform_locations(GLint prog,
glamor_transform_uniforms *uniform_locations);
void glamor_set_transform_for_pixmap(PixmapPtr pixmap,

View File

@ -50,17 +50,15 @@ glamor_put_image(DrawablePtr drawable, GCPtr gc, int depth, int x, int y,
return;
}
if (!glamor_pm_is_solid(drawable, gc->planemask)) {
ErrorF("putimage: non-solid planemask\n");
if (!glamor_set_planemask(pixmap, gc->planemask))
goto fail;
}
if (image_format != ZPixmap) {
ErrorF("putimage: non-ZPixmap\n");
goto fail;
}
if (bpp < 8) {
ErrorF("putimage: bad bpp: %d\n", bpp);
return;
goto fail;
}
switch (drawable->depth) {
@ -121,8 +119,10 @@ glamor_put_image(DrawablePtr drawable, GCPtr gc, int depth, int x, int y,
}
glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
glamor_set_alu(GXcopy);
glamor_set_planemask(pixmap, ~0);
return;
fail:
glamor_set_planemask(pixmap, ~0);
glamor_solid_fail_region(pixmap, x, y, w, h);
}

View File

@ -71,8 +71,12 @@ glamor_set_spans(DrawablePtr drawable, GCPtr gc, char *src,
}
if (!glamor_set_destination_pixmap(dest_pixmap))
return;
goto fail;
if (!glamor_set_planemask(dest_pixmap, gc->planemask))
goto fail;
glamor_set_alu(gc->alu);
if (!glamor_set_planemask(dest_pixmap, gc->planemask))
goto fail;
for (i = 0; i < n; i++) {
if (temp_src) {
for (j = 0; j < widths[i]; j++) {
@ -95,6 +99,8 @@ glamor_set_spans(DrawablePtr drawable, GCPtr gc, char *src,
drawpixels_src += PixmapBytePad(widths[i], drawable->depth);
}
}
fail:
glamor_set_planemask(dest_pixmap, ~0);
glamor_set_alu(GXcopy);
xfree(temp_src);
}

View File

@ -109,11 +109,8 @@ glamor_tile(PixmapPtr pixmap, PixmapPtr tile,
ErrorF("Non-FBO tile pixmap\n");
goto fail;
}
if (!glamor_pm_is_solid(&pixmap->drawable, planemask)) {
ErrorF("tile pm\n");
if (!glamor_set_planemask(pixmap, planemask))
goto fail;
}
glamor_set_alu(alu);
glUseProgramObjectARB(glamor_priv->tile_prog);
glamor_set_transform_for_pixmap(pixmap, &glamor_priv->tile_transform);
@ -141,6 +138,7 @@ glamor_tile(PixmapPtr pixmap, PixmapPtr tile,
glUseProgramObjectARB(0);
glDisable(GL_TEXTURE_2D);
glamor_set_alu(GXcopy);
glamor_set_planemask(pixmap, ~0);
return;
fail: