| 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 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 HbFaceUniquePtr face(createFace()); | 151 HbFaceUniquePtr face(createFace()); |
| 152 result.storedValue->value = createHbFontCacheEntry(face.get()); | 152 result.storedValue->value = createHbFontCacheEntry(face.get()); |
| 153 } | 153 } |
| 154 result.storedValue->value->ref(); | 154 result.storedValue->value->ref(); |
| 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 ASSERT_WITH_SECURITY_IMPLICATION(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()->remove(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); |
| (...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 386 m_harfBuzzFontData->m_paint.setTextEncoding(SkPaint::kGlyphID_TextEncoding); | 386 m_harfBuzzFontData->m_paint.setTextEncoding(SkPaint::kGlyphID_TextEncoding); |
| 387 m_harfBuzzFontData->m_rangeSet = rangeSet; | 387 m_harfBuzzFontData->m_rangeSet = rangeSet; |
| 388 m_harfBuzzFontData->updateSimpleFontData(m_platformData); | 388 m_harfBuzzFontData->updateSimpleFontData(m_platformData); |
| 389 ASSERT(m_harfBuzzFontData->m_simpleFontData); | 389 ASSERT(m_harfBuzzFontData->m_simpleFontData); |
| 390 int scale = SkiaScalarToHarfBuzzPosition(m_platformData->size()); | 390 int scale = SkiaScalarToHarfBuzzPosition(m_platformData->size()); |
| 391 hb_font_set_scale(m_unscaledFont, scale, scale); | 391 hb_font_set_scale(m_unscaledFont, scale, scale); |
| 392 return m_unscaledFont; | 392 return m_unscaledFont; |
| 393 } | 393 } |
| 394 | 394 |
| 395 } // namespace blink | 395 } // namespace blink |
| OLD | NEW |