| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2012 Google Inc. All rights reserved. | 2 * Copyright (c) 2012 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 m_unscaledFont = result.storedValue->value->hbFont(); | 155 m_unscaledFont = result.storedValue->value->hbFont(); |
| 156 m_harfBuzzFontData = result.storedValue->value->hbFontData(); | 156 m_harfBuzzFontData = result.storedValue->value->hbFontData(); |
| 157 } | 157 } |
| 158 | 158 |
| 159 HarfBuzzFace::~HarfBuzzFace() { | 159 HarfBuzzFace::~HarfBuzzFace() { |
| 160 HarfBuzzFontCache::iterator result = harfBuzzFontCache()->find(m_uniqueID); | 160 HarfBuzzFontCache::iterator result = harfBuzzFontCache()->find(m_uniqueID); |
| 161 SECURITY_DCHECK(result != harfBuzzFontCache()->end()); | 161 SECURITY_DCHECK(result != harfBuzzFontCache()->end()); |
| 162 ASSERT(result.get()->value->refCount() > 1); | 162 ASSERT(result.get()->value->refCount() > 1); |
| 163 result.get()->value->deref(); | 163 result.get()->value->deref(); |
| 164 if (result.get()->value->refCount() == 1) | 164 if (result.get()->value->refCount() == 1) |
| 165 harfBuzzFontCache()->remove(m_uniqueID); | 165 harfBuzzFontCache()->erase(m_uniqueID); |
| 166 } | 166 } |
| 167 | 167 |
| 168 static hb_position_t SkiaScalarToHarfBuzzPosition(SkScalar value) { | 168 static hb_position_t SkiaScalarToHarfBuzzPosition(SkScalar value) { |
| 169 // We treat HarfBuzz hb_position_t as 16.16 fixed-point. | 169 // We treat HarfBuzz hb_position_t as 16.16 fixed-point. |
| 170 static const int kHbPosition1 = 1 << 16; | 170 static const int kHbPosition1 = 1 << 16; |
| 171 return clampTo<int>(value * kHbPosition1); | 171 return clampTo<int>(value * kHbPosition1); |
| 172 } | 172 } |
| 173 | 173 |
| 174 static hb_bool_t harfBuzzGetGlyph(hb_font_t* hbFont, | 174 static hb_bool_t harfBuzzGetGlyph(hb_font_t* hbFont, |
| 175 void* fontData, | 175 void* fontData, |
| (...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 389 | 389 |
| 390 // TODO crbug.com/674879 - Connect variation axis parameters to future | 390 // TODO crbug.com/674879 - Connect variation axis parameters to future |
| 391 // HarfBuzz API here. | 391 // HarfBuzz API here. |
| 392 ASSERT(m_harfBuzzFontData->m_simpleFontData); | 392 ASSERT(m_harfBuzzFontData->m_simpleFontData); |
| 393 int scale = SkiaScalarToHarfBuzzPosition(m_platformData->size()); | 393 int scale = SkiaScalarToHarfBuzzPosition(m_platformData->size()); |
| 394 hb_font_set_scale(m_unscaledFont, scale, scale); | 394 hb_font_set_scale(m_unscaledFont, scale, scale); |
| 395 return m_unscaledFont; | 395 return m_unscaledFont; |
| 396 } | 396 } |
| 397 | 397 |
| 398 } // namespace blink | 398 } // namespace blink |
| OLD | NEW |