aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/ports
diff options
context:
space:
mode:
authorGravatar reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-08-29 19:46:06 +0000
committerGravatar reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-08-29 19:46:06 +0000
commitc07448fd72cb60c4b758d07255ae35f1451eafa4 (patch)
tree5747f48aee056251b07ebf9c87fb8bc7a975c47f /src/ports
parentc2a2483bbee761db5afb12a1a512285d67da821e (diff)
check for exceeding int range when we stash the values in the cache
git-svn-id: http://skia.googlecode.com/svn/trunk@5339 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/ports')
-rw-r--r--src/ports/SkFontHost_mac_coretext.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/ports/SkFontHost_mac_coretext.cpp b/src/ports/SkFontHost_mac_coretext.cpp
index 21fb2ed5cb..307985fbc5 100644
--- a/src/ports/SkFontHost_mac_coretext.cpp
+++ b/src/ports/SkFontHost_mac_coretext.cpp
@@ -1016,8 +1016,8 @@ void SkScalerContext_Mac::generateMetrics(SkGlyph* glyph) {
}
glyph->zeroMetrics();
- glyph->fAdvanceX = SkFloatToFixed(theAdvance.width);
- glyph->fAdvanceY = -SkFloatToFixed(theAdvance.height);
+ glyph->fAdvanceX = SkFloatToFixed_Check(theAdvance.width);
+ glyph->fAdvanceY = -SkFloatToFixed_Check(theAdvance.height);
if (CGRectIsEmpty_inline(theBounds)) {
return;
@@ -1060,14 +1060,14 @@ void SkScalerContext_Mac::generateMetrics(SkGlyph* glyph) {
theBounds.origin.y = SkScalarToFloat(adjust.fTop) - 1;
}
// Lion returns fractions in the bounds
- glyph->fWidth = sk_float_ceil2int(theBounds.size.width);
- glyph->fHeight = sk_float_ceil2int(theBounds.size.height);
+ glyph->fWidth = SkToU16(sk_float_ceil2int(theBounds.size.width));
+ glyph->fHeight = SkToU16(sk_float_ceil2int(theBounds.size.height));
} else {
- glyph->fWidth = sk_float_round2int(theBounds.size.width);
- glyph->fHeight = sk_float_round2int(theBounds.size.height);
+ glyph->fWidth = SkToU16(sk_float_round2int(theBounds.size.width));
+ glyph->fHeight = SkToU16(sk_float_round2int(theBounds.size.height));
}
- glyph->fTop = -sk_float_round2int(CGRectGetMaxY_inline(theBounds));
- glyph->fLeft = sk_float_round2int(CGRectGetMinX_inline(theBounds));
+ glyph->fTop = SkToS16(-sk_float_round2int(CGRectGetMaxY_inline(theBounds)));
+ glyph->fLeft = SkToS16(sk_float_round2int(CGRectGetMinX_inline(theBounds)));
SkIPoint offset;
if (fVertical && (isSnowLeopard() || lionAdjustedMetrics)) {
// SnowLeopard doesn't respect vertical metrics, so compute them manually.