protected int cur_el;
protected double distortion_factor;
+ protected Pango.FontDescription[] fontdesc_cache;
+
// Number of items shown before and after the focus element
protected int focus_first;
protected int focus_end;
for (int i = 0; i < 300; ++i)
list[i] = "Lorem Ipsum %d".printf(i);
+ fontdesc_cache = new Pango.FontDescription[30];
+ for (int i = 0; i < 30; ++i)
+ fontdesc_cache[i] = null;
+
cur_el = 0;
focus_centre = 0;
focus_size = 20;
}
var layout = create_pango_layout(list[idx]);
-
- var fd = style.font_desc.copy();
- //fd.set_size((y1-y0)*Pango.SCALE);
- int size = (y1-y0)*Pango.SCALE*80/100;
- if (size <= 0) size = Pango.SCALE;
- fd.set_absolute_size(size);
- layout.set_font_description(fd);
+
+
+ int size = (y1-y0)*80/100;
+ if (size <= 0) size = 1;
+ if (size >= fontdesc_cache.length) size = fontdesc_cache.length - 1;
+ if (fontdesc_cache[size] == null)
+ {
+ fontdesc_cache[size] = style.font_desc.copy();
+ fontdesc_cache[size].set_absolute_size(size*Pango.SCALE);
+ }
+ layout.set_font_description(fontdesc_cache[size]);
//stderr.printf("AZAZA %p\n", layout.get_attributes());
//var attrlist = layout.get_attributes().copy();
//stderr.printf("AL %p\n", attrlist);