iterate over the tiles instead of rendering row-by-row.

2008-10-27  Sven Neumann  <sven@gimp.org>

	* app/text/gimptextlayer.c (gimp_text_layer_render_layout):
	iterate over the tiles instead of rendering row-by-row.


svn path=/trunk/; revision=27438
This commit is contained in:
Sven Neumann 2008-10-27 08:34:07 +00:00 committed by Sven Neumann
parent a725329cda
commit edf9690e00
2 changed files with 30 additions and 10 deletions

View File

@ -1,3 +1,8 @@
2008-10-27 Sven Neumann <sven@gimp.org>
* app/text/gimptextlayer.c (gimp_text_layer_render_layout):
iterate over the tiles instead of rendering row-by-row.
2008-10-27 Sven Neumann <sven@gimp.org>
* app/text/gimptextlayout.c (gimp_text_get_pango_context): use the

View File

@ -602,18 +602,18 @@ gimp_text_layer_render_layout (GimpTextLayer *layer,
cairo_surface_t *surface;
PixelRegion textPR;
PixelRegion maskPR;
gint i;
gint width, height;
const guchar *data;
gint rowstride;
gint width;
gint height;
gpointer pr;
gimp_drawable_fill (drawable, &layer->text->color, NULL);
width = gimp_item_width (item);
height = gimp_item_height (item);
surface = cairo_image_surface_create (CAIRO_FORMAT_A8,
width, height);
surface = cairo_image_surface_create (CAIRO_FORMAT_A8, width, height);
cr = cairo_create (surface);
@ -624,10 +624,25 @@ gimp_text_layer_render_layout (GimpTextLayer *layer,
mask = tile_manager_new ( width, height, 1);
pixel_region_init (&maskPR, mask, 0, 0, width, height, TRUE);
for (i = 0; i < height; i++)
pixel_region_set_row (&maskPR,
0, i, width,
cairo_image_surface_get_data (surface) + i * cairo_image_surface_get_stride (surface));
data = cairo_image_surface_get_data (surface);
rowstride = cairo_image_surface_get_stride (surface);
for (pr = pixel_regions_register (1, &maskPR);
pr != NULL;
pr = pixel_regions_process (pr))
{
const guchar *src = data + maskPR.x + maskPR.y * rowstride;
guchar *dest = maskPR.data;
gint rows = maskPR.h;
while (rows--)
{
memcpy (dest, src, maskPR.w);
src += rowstride;
dest += maskPR.rowstride;
}
}
cairo_destroy (cr);
cairo_surface_destroy (surface);