pango r2777 - in trunk: . pango-view
- From: behdad svn gnome org
- To: svn-commits-list gnome org
- Subject: pango r2777 - in trunk: . pango-view
- Date: Fri, 2 Jan 2009 11:39:51 +0000 (UTC)
Author: behdad
Date: Fri Jan 2 11:39:51 2009
New Revision: 2777
URL: http://svn.gnome.org/viewvc/pango?rev=2777&view=rev
Log:
2009-01-02 Behdad Esfahbod <behdad gnome org>
* pango-view/viewer-main.c (main):
* pango-view/viewer-pangocairo.c (pangocairo_view_render):
* pango-view/viewer-pangoft2.c (pangoft2_view_render):
* pango-view/viewer-pangox.c (pangox_view_render):
* pango-view/viewer-pangoxft.c (pangoxft_view_render):
* pango-view/viewer.h:
Make sure we measure layout with the same surface type as the
final target. Also reduces fonts loaded by the pangocairo backend.
Modified:
trunk/ChangeLog
trunk/pango-view/viewer-main.c
trunk/pango-view/viewer-pangocairo.c
trunk/pango-view/viewer-pangoft2.c
trunk/pango-view/viewer-pangox.c
trunk/pango-view/viewer-pangoxft.c
trunk/pango-view/viewer.h
Modified: trunk/pango-view/viewer-main.c
==============================================================================
--- trunk/pango-view/viewer-main.c (original)
+++ trunk/pango-view/viewer-main.c Fri Jan 2 11:39:51 2009
@@ -57,10 +57,13 @@
instance = view->create (view);
context = view->get_context (instance);
- do_output (context, NULL, NULL, NULL, NULL, &width, &height);
+ width = height = 1;
+ surface = view->create_surface (instance, width, height);
+ view->render (instance, surface, context, &width, &height, NULL);
+ view->destroy_surface (instance, surface);
surface = view->create_surface (instance, width, height);
for (run = 0; run < MAX(1,opt_runs); run++)
- view->render (instance, surface, context, width, height, NULL);
+ view->render (instance, surface, context, &width, &height, NULL);
if (opt_output)
{
@@ -123,7 +126,7 @@
if (!state)
break;
- view->render (instance, surface, context, width, height, state);
+ view->render (instance, surface, context, &width, &height, state);
}
if (view->destroy_window)
Modified: trunk/pango-view/viewer-pangocairo.c
==============================================================================
--- trunk/pango-view/viewer-pangocairo.c (original)
+++ trunk/pango-view/viewer-pangocairo.c Fri Jan 2 11:39:51 2009
@@ -309,27 +309,16 @@
pangocairo_view_render (gpointer instance G_GNUC_UNUSED,
gpointer surface,
PangoContext *context,
- int width G_GNUC_UNUSED,
- int height G_GNUC_UNUSED,
+ int *width,
+ int *height,
gpointer state)
{
cairo_t *cr;
CairoSurface *c_surface = (CairoSurface *) surface;
- if (!surface)
- {
- cairo_surface_t *cs;
- /* This is annoying ... we have to create a temporary surface just to
- * get the extents of the text.
- */
- /* image surface here is not good as it may have font options different
- * from the target surface */
- cs = cairo_image_surface_create (CAIRO_FORMAT_RGB24, 1, 1);
- cr = cairo_create (cs);
- cairo_surface_destroy (cs);
- }
- else
- cr = cairo_create (c_surface->cairo);
+ g_assert (surface);
+
+ cr = cairo_create (c_surface->cairo);
transform_callback (context, NULL, cr, state);
@@ -337,7 +326,7 @@
cairo_paint (cr);
cairo_set_source_rgb (cr, 0.0, 0.0, 0.0);
- do_output (context, render_callback, transform_callback, cr, state, NULL, NULL);
+ do_output (context, render_callback, transform_callback, cr, state, width, height);
cairo_destroy (cr);
}
Modified: trunk/pango-view/viewer-pangoft2.c
==============================================================================
--- trunk/pango-view/viewer-pangoft2.c (original)
+++ trunk/pango-view/viewer-pangoft2.c Fri Jan 2 11:39:51 2009
@@ -113,14 +113,14 @@
pangoft2_view_render (gpointer instance G_GNUC_UNUSED,
gpointer surface,
PangoContext *context,
- int width G_GNUC_UNUSED,
- int height G_GNUC_UNUSED,
+ int *width,
+ int *height,
gpointer state)
{
int pix_idx;
FT_Bitmap *bitmap = (FT_Bitmap *) surface;
- do_output (context, render_callback, NULL, surface, state, NULL, NULL);
+ do_output (context, render_callback, NULL, surface, state, width, height);
for (pix_idx=0; pix_idx<bitmap->pitch * bitmap->rows; pix_idx++)
bitmap->buffer[pix_idx] = 255 - bitmap->buffer[pix_idx];
Modified: trunk/pango-view/viewer-pangox.c
==============================================================================
--- trunk/pango-view/viewer-pangox.c (original)
+++ trunk/pango-view/viewer-pangox.c Fri Jan 2 11:39:51 2009
@@ -79,8 +79,8 @@
pangox_view_render (gpointer instance,
gpointer surface,
PangoContext *context,
- int width,
- int height,
+ int *width,
+ int *height,
gpointer state)
{
XViewer *x = (XViewer *) instance;
@@ -91,14 +91,14 @@
gc = XCreateGC (x->display, pixmap, 0, NULL);
XSetForeground(x->display, gc, WhitePixel(x->display, x->screen));
- XFillRectangle (x->display, pixmap, gc, 0, 0, width, height);
+ XFillRectangle (x->display, pixmap, gc, 0, 0, *width, *height);
x_context.x = x;
x_context.drawable = pixmap;
x_context.gc = gc;
XSetForeground(x->display, gc, BlackPixel(x->display, x->screen));
- do_output (context, render_callback, NULL, &x_context, state, NULL, NULL);
+ do_output (context, render_callback, NULL, &x_context, state, width, height);
XFlush(x->display);
Modified: trunk/pango-view/viewer-pangoxft.c
==============================================================================
--- trunk/pango-view/viewer-pangoxft.c (original)
+++ trunk/pango-view/viewer-pangoxft.c Fri Jan 2 11:39:51 2009
@@ -100,8 +100,8 @@
pangoxft_view_render (gpointer instance,
gpointer surface,
PangoContext *context,
- int width,
- int height,
+ int *width,
+ int *height,
gpointer state)
{
XViewer *x = (XViewer *) instance;
@@ -119,7 +119,7 @@
color.color.green = 0xffff;
color.color.alpha = 0xffff;
- XftDrawRect (draw, &color, 0, 0, width, height);
+ XftDrawRect (draw, &color, 0, 0, *width, *height);
color.color.red = 0x0;
color.color.green = 0x0;
@@ -129,7 +129,7 @@
xft_context.draw = draw;
xft_context.color = color;
- do_output (context, render_callback, NULL, &xft_context, state, NULL, NULL);
+ do_output (context, render_callback, NULL, &xft_context, state, width, height);
XftDrawDestroy (draw);
}
Modified: trunk/pango-view/viewer.h
==============================================================================
--- trunk/pango-view/viewer.h (original)
+++ trunk/pango-view/viewer.h Fri Jan 2 11:39:51 2009
@@ -50,8 +50,8 @@
void (*render) (gpointer instance,
gpointer surface,
PangoContext *context,
- int width,
- int height,
+ int *width,
+ int *height,
gpointer state);
/* The following can be NULL */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]