Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1028)

Unified Diff: third_party/WebKit/Source/platform/fonts/shaping/HarfBuzzFace.cpp

Issue 1752953003: Replace uses of SkFixed for HarfBuzz conversions. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/platform/fonts/shaping/HarfBuzzFace.cpp
diff --git a/third_party/WebKit/Source/platform/fonts/shaping/HarfBuzzFace.cpp b/third_party/WebKit/Source/platform/fonts/shaping/HarfBuzzFace.cpp
index 48e587be4220550748f7a0c032f79a2c3f11d2e9..39c0c02a6cf1202bdd050460a7382ff40113a4aa 100644
--- a/third_party/WebKit/Source/platform/fonts/shaping/HarfBuzzFace.cpp
+++ b/third_party/WebKit/Source/platform/fonts/shaping/HarfBuzzFace.cpp
@@ -45,6 +45,7 @@
#include "platform/fonts/SimpleFontData.h"
#include "platform/fonts/shaping/HarfBuzzShaper.h"
#include "wtf/HashMap.h"
+#include "wtf/MathExtras.h"
namespace blink {
@@ -138,7 +139,9 @@ public:
static hb_position_t SkiaScalarToHarfBuzzPosition(SkScalar value)
{
- return SkScalarToFixed(value);
+ // We treat HarfBuzz hb_position_t as 16.16 fixed-point.
+ static const int kHbPosition1 = 1 << 16;
+ return clampTo<int>(value * kHbPosition1);
}
static void SkiaGetGlyphWidthAndExtents(SkPaint* paint, hb_codepoint_t codepoint, hb_position_t* width, hb_glyph_extents_t* extents)

Powered by Google App Engine
This is Rietveld 408576698