| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006, 2007, 2008, 2013 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2007, 2008, 2013 Apple Inc. All rights reserved. |
| 3 * Copyright (C) Research In Motion Limited 2011. All rights reserved. | 3 * Copyright (C) Research In Motion Limited 2011. All rights reserved. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
| 7 * are met: | 7 * are met: |
| 8 * | 8 * |
| 9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 else { | 91 else { |
| 92 for (size_t i = 0; i < GlyphPage::size; ++i) { | 92 for (size_t i = 0; i < GlyphPage::size; ++i) { |
| 93 page->m_perGlyphFontData[i] = m_glyphs[i] ? m_fontDataForAllGlyp
hs : 0; | 93 page->m_perGlyphFontData[i] = m_glyphs[i] ? m_fontDataForAllGlyp
hs : 0; |
| 94 } | 94 } |
| 95 } | 95 } |
| 96 return page.release(); | 96 return page.release(); |
| 97 } | 97 } |
| 98 | 98 |
| 99 ~GlyphPage() { } | 99 ~GlyphPage() { } |
| 100 | 100 |
| 101 static const size_t size = 256; // Covers Latin-1 in a single page. | 101 static const unsigned char sizeBits = 8; |
| 102 static unsigned indexForCharacter(UChar32 c) { return c % GlyphPage::size; } | 102 static const size_t size = (1 << GlyphPage::sizeBits); // Covers Latin-1 in
a single page. |
| 103 static unsigned indexForCharacter(UChar32 c) { return c & 0xFF; } |
| 103 | 104 |
| 104 ALWAYS_INLINE GlyphData glyphDataForCharacter(UChar32 c) const | 105 ALWAYS_INLINE GlyphData glyphDataForCharacter(UChar32 c) const |
| 105 { | 106 { |
| 106 return glyphDataForIndex(indexForCharacter(c)); | 107 return glyphDataForIndex(indexForCharacter(c)); |
| 107 } | 108 } |
| 108 | 109 |
| 109 ALWAYS_INLINE GlyphData glyphDataForIndex(unsigned index) const | 110 ALWAYS_INLINE GlyphData glyphDataForIndex(unsigned index) const |
| 110 { | 111 { |
| 111 ASSERT_WITH_SECURITY_IMPLICATION(index < size); | 112 ASSERT_WITH_SECURITY_IMPLICATION(index < size); |
| 112 Glyph glyph = m_glyphs[index]; | 113 Glyph glyph = m_glyphs[index]; |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 196 const SimpleFontData* m_perGlyphFontData[0]; | 197 const SimpleFontData* m_perGlyphFontData[0]; |
| 197 }; | 198 }; |
| 198 | 199 |
| 199 #if COMPILER(MSVC) | 200 #if COMPILER(MSVC) |
| 200 #pragma warning(pop) | 201 #pragma warning(pop) |
| 201 #endif | 202 #endif |
| 202 | 203 |
| 203 } // namespace WebCore | 204 } // namespace WebCore |
| 204 | 205 |
| 205 #endif // GlyphPage_h | 206 #endif // GlyphPage_h |
| OLD | NEW |