| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "SkiaTextMetrics.h" | 5 #include "SkiaTextMetrics.h" |
| 6 | 6 |
| 7 #include "wtf/MathExtras.h" | 7 #include "platform/wtf/MathExtras.h" |
| 8 | 8 |
| 9 #include <SkPath.h> | 9 #include <SkPath.h> |
| 10 | 10 |
| 11 namespace blink { | 11 namespace blink { |
| 12 | 12 |
| 13 static hb_position_t SkiaScalarToHarfBuzzPosition(SkScalar value) { | 13 static hb_position_t SkiaScalarToHarfBuzzPosition(SkScalar value) { |
| 14 // We treat HarfBuzz hb_position_t as 16.16 fixed-point. | 14 // We treat HarfBuzz hb_position_t as 16.16 fixed-point. |
| 15 static const int kHbPosition1 = 1 << 16; | 15 static const int kHbPosition1 = 1 << 16; |
| 16 return clampTo<int>(value * kHbPosition1); | 16 return clampTo<int>(value * kHbPosition1); |
| 17 } | 17 } |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 SkScalar skWidth; | 81 SkScalar skWidth; |
| 82 m_paint->getTextWidths(&glyph, sizeof(glyph), &skWidth, nullptr); | 82 m_paint->getTextWidths(&glyph, sizeof(glyph), &skWidth, nullptr); |
| 83 | 83 |
| 84 if (!m_paint->isSubpixelText()) | 84 if (!m_paint->isSubpixelText()) |
| 85 skWidth = SkScalarRoundToInt(skWidth); | 85 skWidth = SkScalarRoundToInt(skWidth); |
| 86 | 86 |
| 87 return SkScalarToFloat(skWidth); | 87 return SkScalarToFloat(skWidth); |
| 88 } | 88 } |
| 89 | 89 |
| 90 } // namespace blink | 90 } // namespace blink |
| OLD | NEW |