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 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 template <> | 105 template <> |
106 inline FloatRect GlyphMetricsMap<FloatRect>::UnknownMetrics() { | 106 inline FloatRect GlyphMetricsMap<FloatRect>::UnknownMetrics() { |
107 return FloatRect(0, 0, kCGlyphSizeUnknown, kCGlyphSizeUnknown); | 107 return FloatRect(0, 0, kCGlyphSizeUnknown, kCGlyphSizeUnknown); |
108 } | 108 } |
109 | 109 |
110 template <class T> | 110 template <class T> |
111 typename GlyphMetricsMap<T>::GlyphMetricsPage* | 111 typename GlyphMetricsMap<T>::GlyphMetricsPage* |
112 GlyphMetricsMap<T>::LocatePageSlowCase(unsigned page_number) { | 112 GlyphMetricsMap<T>::LocatePageSlowCase(unsigned page_number) { |
113 GlyphMetricsPage* page; | 113 GlyphMetricsPage* page; |
114 if (!page_number) { | 114 if (!page_number) { |
115 ASSERT(!filled_primary_page_); | 115 DCHECK(!filled_primary_page_); |
116 page = &primary_page_; | 116 page = &primary_page_; |
117 filled_primary_page_ = true; | 117 filled_primary_page_ = true; |
118 } else { | 118 } else { |
119 if (pages_) { | 119 if (pages_) { |
120 page = pages_->at(page_number); | 120 page = pages_->at(page_number); |
121 if (page) | 121 if (page) |
122 return page; | 122 return page; |
123 } else { | 123 } else { |
124 pages_ = | 124 pages_ = |
125 WTF::WrapUnique(new HashMap<int, std::unique_ptr<GlyphMetricsPage>>); | 125 WTF::WrapUnique(new HashMap<int, std::unique_ptr<GlyphMetricsPage>>); |
126 } | 126 } |
127 page = new GlyphMetricsPage; | 127 page = new GlyphMetricsPage; |
128 pages_->Set(page_number, WTF::WrapUnique(page)); | 128 pages_->Set(page_number, WTF::WrapUnique(page)); |
129 } | 129 } |
130 | 130 |
131 // Fill in the whole page with the unknown glyph information. | 131 // Fill in the whole page with the unknown glyph information. |
132 for (unsigned i = 0; i < GlyphMetricsPage::kSize; i++) | 132 for (unsigned i = 0; i < GlyphMetricsPage::kSize; i++) |
133 page->SetMetricsForIndex(i, UnknownMetrics()); | 133 page->SetMetricsForIndex(i, UnknownMetrics()); |
134 | 134 |
135 return page; | 135 return page; |
136 } | 136 } |
137 | 137 |
138 } // namespace blink | 138 } // namespace blink |
139 | 139 |
140 #endif | 140 #endif |
OLD | NEW |