gimp r25989 - branches/soc-2008-text/app/text
- From: danedde svn gnome org
- To: svn-commits-list gnome org
- Subject: gimp r25989 - branches/soc-2008-text/app/text
- Date: Wed, 25 Jun 2008 12:06:29 +0000 (UTC)
Author: danedde
Date: Wed Jun 25 12:06:29 2008
New Revision: 25989
URL: http://svn.gnome.org/viewvc/gimp?rev=25989&view=rev
Log:
2008-06-25 Daniel Eddeland <danedde svn gnome org>
* app/text/gimptext-bitmap.c
* app/text/gimptextlayer.c
* app/text/gimptextlayout.c
* app/text/gimptextlayout-render.c: fixed black-box bug and made some
minor changes.
Modified:
branches/soc-2008-text/app/text/gimptext-bitmap.c
branches/soc-2008-text/app/text/gimptextlayer.c
branches/soc-2008-text/app/text/gimptextlayout-render.c
branches/soc-2008-text/app/text/gimptextlayout.c
Modified: branches/soc-2008-text/app/text/gimptext-bitmap.c
==============================================================================
--- branches/soc-2008-text/app/text/gimptext-bitmap.c (original)
+++ branches/soc-2008-text/app/text/gimptext-bitmap.c Wed Jun 25 12:06:29 2008
@@ -37,16 +37,6 @@
#define FT_LOAD_TARGET_MONO FT_LOAD_MONOCHROME
#endif
-/*
-void
-gimp_text_render_bitmap (PangoFont *font,
- PangoGlyph glyph,
- cairo_font_options_t *flags,
- cairo_matrix_t *trafo,
- gint x,
- gint y,
- cairo_surface_t *surface)
-*/
void
gimp_text_render_bitmap (PangoFont *font,
PangoGlyph glyph,
@@ -74,7 +64,6 @@
cairo_set_font_options (cr, options);
cairo_transform (cr, trafo);
- cairo_move_to (cr, x, y);
cairo_set_source_rgb (cr, 0.5, 0.5, 0.5);
Modified: branches/soc-2008-text/app/text/gimptextlayer.c
==============================================================================
--- branches/soc-2008-text/app/text/gimptextlayer.c (original)
+++ branches/soc-2008-text/app/text/gimptextlayer.c Wed Jun 25 12:06:29 2008
@@ -594,23 +594,22 @@
GimpDrawable *drawable = GIMP_DRAWABLE (layer);
GimpItem *item = GIMP_ITEM (layer);
TileManager *mask;
- cairo_t *cr;
+ cairo_t *cr;
cairo_surface_t *surface;
PixelRegion textPR;
PixelRegion maskPR;
gint i;
- gint pitch;
+ gint width, height;
gimp_drawable_fill (drawable, &layer->text->color, NULL);
- pitch = gimp_item_width (item);
- if (pitch & 3)
- pitch += 4 - (pitch & 3);
+ width = gimp_item_width (item);
+ height = gimp_item_height (item);
surface = cairo_image_surface_create ( CAIRO_FORMAT_A8,
- pitch, gimp_item_height (item));
+ width, height);
cr = cairo_create (surface);
@@ -618,21 +617,21 @@
(GimpTextRenderFunc) gimp_text_render_bitmap,
cr);
- mask = tile_manager_new (cairo_image_surface_get_width (surface), cairo_image_surface_get_height (surface), 1);
- pixel_region_init (&maskPR, mask, 0, 0, cairo_image_surface_get_width (surface), cairo_image_surface_get_height (surface), TRUE);
+ mask = tile_manager_new ( width, height, 1);
+ pixel_region_init (&maskPR, mask, 0, 0, width, height, TRUE);
- for (i = 0; i < cairo_image_surface_get_height (surface); i++)
+ for (i = 0; i < height; i++)
pixel_region_set_row (&maskPR,
- 0, i, cairo_image_surface_get_width (surface),
+ 0, i, width,
cairo_image_surface_get_data (surface) + i * cairo_image_surface_get_stride (surface));
cairo_destroy (cr);
cairo_surface_destroy (surface);
pixel_region_init (&textPR, gimp_drawable_get_tiles (drawable),
- 0, 0, cairo_image_surface_get_width (surface), cairo_image_surface_get_height (surface), TRUE);
+ 0, 0, width, height, TRUE);
pixel_region_init (&maskPR, mask,
- 0, 0, cairo_image_surface_get_width (surface), cairo_image_surface_get_height (surface), FALSE);
+ 0, 0, width, height, FALSE);
apply_mask_to_region (&textPR, &maskPR, OPAQUE_OPACITY);
Modified: branches/soc-2008-text/app/text/gimptextlayout-render.c
==============================================================================
--- branches/soc-2008-text/app/text/gimptextlayout-render.c (original)
+++ branches/soc-2008-text/app/text/gimptextlayout-render.c Wed Jun 25 12:06:29 2008
@@ -187,26 +187,14 @@
cairo_font_options_set_antialias (flags, CAIRO_ANTIALIAS_DEFAULT);
else
cairo_font_options_set_antialias (flags, CAIRO_ANTIALIAS_NONE);
-
- if (!text->hinting)
- cairo_font_options_set_hint_style (flags, CAIRO_HINT_STYLE_NONE);
-
- if (text->autohint)
- cairo_font_options_set_antialias (flags, CAIRO_HINT_STYLE_DEFAULT);
-
-
/*
- if (text->antialias)
- flags = FT_LOAD_NO_BITMAP;
- else
- flags = FT_LOAD_TARGET_MONO;
-
- if (!text->hinting)
- flags |= FT_LOAD_NO_HINTING;
-
+ * commented because there's no real autohint support in cairo as in ft2
if (text->autohint)
- flags |= FT_LOAD_FORCE_AUTOHINT;
+ cairo_font_options_set_hint_style (flags, CAIRO_HINT_STYLE_DEFAULT);
*/
+ if (!text->hinting)
+ cairo_font_options_set_hint_style (flags, CAIRO_HINT_STYLE_NONE);
+
return flags;
}
@@ -216,12 +204,6 @@
{
GimpText *text = layout->text;
-/*
- trafo->xx = text->transformation.coeff[0][0] * 65536.0 / layout->yres * layout->xres;
- trafo->xy = text->transformation.coeff[0][1] * 65536.0;
- trafo->yx = text->transformation.coeff[1][0] * 65536.0 / layout->yres * layout->xres;
- trafo->yy = text->transformation.coeff[1][1] * 65536.0;
- */
trafo->xx = text->transformation.coeff[0][0] * 1.0 / layout->yres * layout->xres;
trafo->xy = text->transformation.coeff[0][1] * 1.0;
trafo->yx = text->transformation.coeff[1][0] * 1.0 / layout->yres * layout->xres;
Modified: branches/soc-2008-text/app/text/gimptextlayout.c
==============================================================================
--- branches/soc-2008-text/app/text/gimptextlayout.c (original)
+++ branches/soc-2008-text/app/text/gimptextlayout.c Wed Jun 25 12:06:29 2008
@@ -303,18 +303,6 @@
#endif
}
-/*
-static void
-gimp_text_cairo_subst_func (cairo_font_options_t *options,
- gpointer data)
-{
- GimpText *text = GIMP_TEXT (data);
-
- FcPatternAddBool (pattern, FC_HINTING, text->hinting);
- FcPatternAddBool (pattern, FC_AUTOHINT, text->autohint);
- FcPatternAddBool (pattern, FC_ANTIALIAS, text->antialias);
-}
-*/
static PangoContext *
gimp_text_get_pango_context (GimpText *text,
gdouble xres,
@@ -326,29 +314,10 @@
fontmap = PANGO_CAIRO_FONT_MAP (pango_cairo_font_map_new ());
pango_cairo_font_map_set_resolution (fontmap, xres);
-/*
- pango_cairo_font_map_set_default_substitute (fontmap,
- gimp_text_cairo_subst_func,
- g_object_ref (text),
- (GDestroyNotify) g_object_unref);
-*/
+
context = pango_cairo_font_map_create_context (fontmap);
g_object_unref (fontmap);
- /* Workaround for bug #143542 (PangoFT2Fontmap leak),
- * see also bug #148997 (Text layer rendering leaks font file descriptor):
- *
- * Calling pango_ft2_font_map_substitute_changed() causes the
- * font_map cache to be flushed, thereby removing the circular
- * reference that causes the leak.
- */
-
- /*
- g_object_weak_ref (G_OBJECT (context),
- (GWeakNotify) pango_cairo_font_map_substitute_changed,
- fontmap);
-*/
-
if (text->language)
pango_context_set_language (context,
pango_language_from_string (text->language));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]