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; 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 void
glamor_set_alu(unsigned char alu) 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)) if (!glamor_set_destination_pixmap(pixmap))
return; return;
glamor_set_alu(alu); glamor_set_alu(alu);
if (!glamor_set_planemask(pixmap, planemask))
goto fail;
glUseProgramObjectARB(glamor_priv->solid_prog); glUseProgramObjectARB(glamor_priv->solid_prog);
glamor_get_color_4f_from_pixel(pixmap, fg_pixel, color); 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(); glEnd();
glUseProgramObjectARB(0); glUseProgramObjectARB(0);
fail:
glamor_set_alu(GXcopy); 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); GLfloat *color);
Bool glamor_set_destination_pixmap(PixmapPtr pixmap); Bool glamor_set_destination_pixmap(PixmapPtr pixmap);
void glamor_set_alu(unsigned char alu); void glamor_set_alu(unsigned char alu);
Bool glamor_set_planemask(PixmapPtr pixmap, unsigned long planemask);
void glamor_get_transform_uniform_locations(GLint prog, void glamor_get_transform_uniform_locations(GLint prog,
glamor_transform_uniforms *uniform_locations); glamor_transform_uniforms *uniform_locations);
void glamor_set_transform_for_pixmap(PixmapPtr pixmap, 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; return;
} }
if (!glamor_pm_is_solid(drawable, gc->planemask)) { if (!glamor_set_planemask(pixmap, gc->planemask))
ErrorF("putimage: non-solid planemask\n");
goto fail; goto fail;
}
if (image_format != ZPixmap) { if (image_format != ZPixmap) {
ErrorF("putimage: non-ZPixmap\n"); ErrorF("putimage: non-ZPixmap\n");
goto fail; goto fail;
} }
if (bpp < 8) { if (bpp < 8) {
ErrorF("putimage: bad bpp: %d\n", bpp); ErrorF("putimage: bad bpp: %d\n", bpp);
return; goto fail;
} }
switch (drawable->depth) { 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); glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
glamor_set_alu(GXcopy); glamor_set_alu(GXcopy);
glamor_set_planemask(pixmap, ~0);
return; return;
fail: fail:
glamor_set_planemask(pixmap, ~0);
glamor_solid_fail_region(pixmap, x, y, w, h); 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)) 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); glamor_set_alu(gc->alu);
if (!glamor_set_planemask(dest_pixmap, gc->planemask))
goto fail;
for (i = 0; i < n; i++) { for (i = 0; i < n; i++) {
if (temp_src) { if (temp_src) {
for (j = 0; j < widths[i]; j++) { 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); drawpixels_src += PixmapBytePad(widths[i], drawable->depth);
} }
} }
fail:
glamor_set_planemask(dest_pixmap, ~0);
glamor_set_alu(GXcopy); glamor_set_alu(GXcopy);
xfree(temp_src); xfree(temp_src);
} }

View File

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