label: Microoptimize width-for-height computation
We told Pango to limit width to mid pixels, and it returned a layout size of text_width by text_height; text_width can be considerably smaller than mid. If the layout fits, we know that it fits at text_width, so set max to that. This lets us skip many iterations in a typical case.
This commit is contained in:
@@ -1202,7 +1202,7 @@ my_pango_layout_get_width_for_height (PangoLayout *layout,
|
||||
else if (text_height > for_height)
|
||||
min = mid + 1;
|
||||
else
|
||||
max = mid;
|
||||
max = text_width;
|
||||
}
|
||||
|
||||
return min * PANGO_SCALE;
|
||||
|
||||
Reference in New Issue
Block a user