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

Unified Diff: ui/gfx/harfbuzz_font_skia.cc

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
« no previous file with comments | « third_party/WebKit/Source/platform/fonts/shaping/HarfBuzzFace.cpp ('k') | ui/gfx/render_text_harfbuzz.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/harfbuzz_font_skia.cc
diff --git a/ui/gfx/harfbuzz_font_skia.cc b/ui/gfx/harfbuzz_font_skia.cc
index 723b68aedc9277d6947111b00cbe9b11750d1e13..e2adeaff4d91f5e3186626491fca4709855ccfd9 100644
--- a/ui/gfx/harfbuzz_font_skia.cc
+++ b/ui/gfx/harfbuzz_font_skia.cc
@@ -16,6 +16,7 @@
#include "third_party/skia/include/core/SkPaint.h"
#include "third_party/skia/include/core/SkTypeface.h"
#include "ui/gfx/render_text.h"
+#include "ui/gfx/skia_util.h"
namespace gfx {
@@ -65,14 +66,14 @@ void GetGlyphWidthAndExtents(SkPaint* paint,
paint->getTextWidths(&glyph, sizeof(glyph), &sk_width, &sk_bounds);
if (width)
- *width = SkScalarToFixed(sk_width);
+ *width = SkiaScalarToHarfBuzzUnits(sk_width);
if (extents) {
// Invert y-axis because Skia is y-grows-down but we set up HarfBuzz to be
// y-grows-up.
- extents->x_bearing = SkScalarToFixed(sk_bounds.fLeft);
- extents->y_bearing = SkScalarToFixed(-sk_bounds.fTop);
- extents->width = SkScalarToFixed(sk_bounds.width());
- extents->height = SkScalarToFixed(-sk_bounds.height());
+ extents->x_bearing = SkiaScalarToHarfBuzzUnits(sk_bounds.fLeft);
+ extents->y_bearing = SkiaScalarToHarfBuzzUnits(-sk_bounds.fTop);
+ extents->width = SkiaScalarToHarfBuzzUnits(sk_bounds.width());
+ extents->height = SkiaScalarToHarfBuzzUnits(-sk_bounds.height());
}
}
@@ -132,7 +133,7 @@ hb_position_t GetGlyphKerning(FontData* font_data,
SkScalar upm = SkIntToScalar(typeface->getUnitsPerEm());
SkScalar size = font_data->paint_.getTextSize();
- return SkScalarToFixed(
+ return SkiaScalarToHarfBuzzUnits(
SkScalarMulDiv(SkIntToScalar(kerning_adjustments[0]), size, upm));
}
@@ -271,7 +272,7 @@ hb_font_t* CreateHarfBuzzFont(SkTypeface* skia_face,
face_cache->first.Init(skia_face);
hb_font_t* harfbuzz_font = hb_font_create(face_cache->first.get());
- const int scale = SkScalarToFixed(text_size);
+ const int scale = SkiaScalarToHarfBuzzUnits(text_size);
hb_font_set_scale(harfbuzz_font, scale, scale);
FontData* hb_font_data = new FontData(&face_cache->second);
hb_font_data->paint_.setTypeface(skia_face);
« no previous file with comments | « third_party/WebKit/Source/platform/fonts/shaping/HarfBuzzFace.cpp ('k') | ui/gfx/render_text_harfbuzz.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698