Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006, 2009 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2009 Apple 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 | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * | 7 * |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 84 if (!pageNumber && m_filledPrimaryPage) | 84 if (!pageNumber && m_filledPrimaryPage) |
| 85 return &m_primaryPage; | 85 return &m_primaryPage; |
| 86 return locatePageSlowCase(pageNumber); | 86 return locatePageSlowCase(pageNumber); |
| 87 } | 87 } |
| 88 | 88 |
| 89 GlyphMetricsPage* locatePageSlowCase(unsigned pageNumber); | 89 GlyphMetricsPage* locatePageSlowCase(unsigned pageNumber); |
| 90 | 90 |
| 91 static T unknownMetrics(); | 91 static T unknownMetrics(); |
| 92 | 92 |
| 93 bool m_filledPrimaryPage; | 93 bool m_filledPrimaryPage; |
| 94 GlyphMetricsPage | 94 GlyphMetricsPage m_primaryPage; // We optimize for the page that contains |
| 95 m_primaryPage; // We optimize for the page that contains glyph indices 0- 255. | 95 // glyph indices 0-255. |
|
dcheng
2016/10/03 20:41:17
Nit: personal opinion strikes again: I think one l
Nico
2016/10/03 20:46:56
Done.
| |
| 96 std::unique_ptr<HashMap<int, std::unique_ptr<GlyphMetricsPage>>> m_pages; | 96 std::unique_ptr<HashMap<int, std::unique_ptr<GlyphMetricsPage>>> m_pages; |
| 97 }; | 97 }; |
| 98 | 98 |
| 99 template <> | 99 template <> |
| 100 inline float GlyphMetricsMap<float>::unknownMetrics() { | 100 inline float GlyphMetricsMap<float>::unknownMetrics() { |
| 101 return cGlyphSizeUnknown; | 101 return cGlyphSizeUnknown; |
| 102 } | 102 } |
| 103 | 103 |
| 104 template <> | 104 template <> |
| 105 inline FloatRect GlyphMetricsMap<FloatRect>::unknownMetrics() { | 105 inline FloatRect GlyphMetricsMap<FloatRect>::unknownMetrics() { |
| (...skipping 23 matching lines...) Expand all Loading... | |
| 129 // Fill in the whole page with the unknown glyph information. | 129 // Fill in the whole page with the unknown glyph information. |
| 130 for (unsigned i = 0; i < GlyphMetricsPage::size; i++) | 130 for (unsigned i = 0; i < GlyphMetricsPage::size; i++) |
| 131 page->setMetricsForIndex(i, unknownMetrics()); | 131 page->setMetricsForIndex(i, unknownMetrics()); |
| 132 | 132 |
| 133 return page; | 133 return page; |
| 134 } | 134 } |
| 135 | 135 |
| 136 } // namespace blink | 136 } // namespace blink |
| 137 | 137 |
| 138 #endif | 138 #endif |
| OLD | NEW |