diff --git a/src/common/guac_surface.c b/src/common/guac_surface.c index 7566a393..e19c0a17 100644 --- a/src/common/guac_surface.c +++ b/src/common/guac_surface.c @@ -29,6 +29,8 @@ #include #include +#include + /** * The width of an update which should be considered negible and thus @@ -365,6 +367,45 @@ static void __guac_common_surface_put(unsigned char* src_buffer, int src_stride, } +static void __guac_common_surface_fill_mask(unsigned char* src_buffer, int src_stride, + int sx, int sy, int w, int h, + guac_common_surface* dst, int dx, int dy, + int red, int green, int blue) { + + unsigned char* dst_buffer = dst->buffer; + int dst_stride = dst->stride; + + uint32_t color = 0xFF000000 | (red << 16) | (green << 8) | blue; + int x, y; + + src_buffer += src_stride*sy + 4*sx; + dst_buffer += dst_stride*dy + 4*dx; + + /* For each row */ + for (y=0; y #include +#include + /** * Surface which backs a Guacamole buffer or layer, automatically * combining updates when possible. @@ -160,6 +162,22 @@ void guac_common_surface_resize(guac_common_surface* surface, int w, int h); */ void guac_common_surface_draw(guac_common_surface* surface, int x, int y, cairo_surface_t* src); +/** + * Paints to the given guac_common_surface using the given data as a stencil, + * filling opaque regions with the specified color, and leaving transparent + * regions untouched. + * + * @param surface The surface to draw to. + * @param x The X coordinate of the draw location. + * @param y The Y coordinate of the draw location. + * @param src The Cairo surface to retrieve data from. + * @param red The red component of the fill color. + * @param green The green component of the fill color. + * @param blue The blue component of the fill color. + */ +void guac_common_surface_paint(guac_common_surface* surface, int x, int y, cairo_surface_t* src, + int red, int green, int blue); + /** * Copies a rectangle of data between two surfaces. *