mirror of
https://gitlab.freedesktop.org/cairo/cairo.git
synced 2026-05-05 04:08:13 +02:00
[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:
parent
25c3750939
commit
055e9b0eb6
1 changed files with 6 additions and 0 deletions
|
|
@ -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++) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue