aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorZufu Liu <unknown>2025-12-22 09:04:53 +1100
committerZufu Liu <unknown>2025-12-22 09:04:53 +1100
commitcf2169f74a2ed05ee7f5d0c74436b8da32a8de1d (patch)
tree8b1db153a159501027b3978a4a054abe7875a45e /src
parent6fbec94e04de1fe14351adb42564bfd17ceed2b2 (diff)
downloadscintilla-mirror-cf2169f74a2ed05ee7f5d0c74436b8da32a8de1d.tar.gz
Small optimization avoids retrieving font ascent twice.
Diffstat (limited to 'src')
-rw-r--r--src/ViewStyle.cxx5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/ViewStyle.cxx b/src/ViewStyle.cxx
index 361b71d25..767e019f4 100644
--- a/src/ViewStyle.cxx
+++ b/src/ViewStyle.cxx
@@ -74,10 +74,11 @@ void FontRealised::Realise(Surface &surface, int zoomLevel, Technology technolog
// floor here is historical as platform layers have tweaked their values to match.
// ceil would likely be better to ensure (nearly) all of the ink of a character is seen
// but that would require platform layer changes.
- measurements.ascent = std::floor(surface.Ascent(font.get()));
+ const XYPOSITION ascent = surface.Ascent(font.get());
+ measurements.ascent = std::floor(ascent);
measurements.descent = std::floor(surface.Descent(font.get()));
- measurements.capitalHeight = surface.Ascent(font.get()) - surface.InternalLeading(font.get());
+ measurements.capitalHeight = ascent - surface.InternalLeading(font.get());
measurements.aveCharWidth = surface.AverageCharWidth(font.get());
measurements.monospaceCharacterWidth = measurements.aveCharWidth;
measurements.spaceWidth = surface.WidthText(font.get(), " ");