[test] Cache resolved scaled-font

The intention is to stress test the solid pattern caches, so we can cheat
and avoid repeatedly resolving the toy font.
This commit is contained in:
Chris Wilson 2009-06-07 23:35:57 +01:00
parent 25c3750939
commit 055e9b0eb6

View file

@ -37,6 +37,8 @@
#define drand48() (rand () / (double) RAND_MAX)
#endif
static cairo_scaled_font_t *scaled_font;
static cairo_t *
_cairo_create_similar (cairo_t *cr, int width, int height)
{
@ -93,6 +95,7 @@ _draw (cairo_t *cr,
cairo_mask (cr, cairo_get_source (cr));
cairo_set_scaled_font (cr, scaled_font);
cairo_text_extents (cr, "cairo", &extents);
cairo_move_to (cr,
-extents.x_bearing - .5 * extents.width,
@ -173,6 +176,9 @@ draw (cairo_t *cr, int width, int height)
};
int i, j, loop;
/* cache a resolved scaled-font */
scaled_font = cairo_get_scaled_font (cr);
for (loop = 0; loop < LOOPS; loop++) {
for (i = 0; i < LOOPS; i++) {
for (j = 0; j < 8; j++) {