OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006, 2009, 2011 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2009, 2011 Apple Inc. All rights reserved. |
3 * Copyright (C) 2007-2008 Torch Mobile Inc. | 3 * Copyright (C) 2007-2008 Torch Mobile Inc. |
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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 float yOffsetAt(unsigned index) const { | 89 float yOffsetAt(unsigned index) const { |
90 ASSERT(index < size()); | 90 ASSERT(index < size()); |
91 ASSERT(hasVerticalOffsets()); | 91 ASSERT(hasVerticalOffsets()); |
92 return m_offsets[index * 2 + 1]; | 92 return m_offsets[index * 2 + 1]; |
93 } | 93 } |
94 | 94 |
95 void add(Glyph glyph, const SimpleFontData* font, float x) { | 95 void add(Glyph glyph, const SimpleFontData* font, float x) { |
96 // cannot mix x-only/xy offsets | 96 // cannot mix x-only/xy offsets |
97 ASSERT(!hasVerticalOffsets()); | 97 ASSERT(!hasVerticalOffsets()); |
98 | 98 |
99 m_fontData.append(font); | 99 m_fontData.push_back(font); |
100 m_glyphs.append(glyph); | 100 m_glyphs.push_back(glyph); |
101 m_offsets.append(x); | 101 m_offsets.push_back(x); |
102 } | 102 } |
103 | 103 |
104 void add(Glyph glyph, const SimpleFontData* font, const FloatPoint& offset) { | 104 void add(Glyph glyph, const SimpleFontData* font, const FloatPoint& offset) { |
105 // cannot mix x-only/xy offsets | 105 // cannot mix x-only/xy offsets |
106 ASSERT(isEmpty() || hasVerticalOffsets()); | 106 ASSERT(isEmpty() || hasVerticalOffsets()); |
107 | 107 |
108 m_fontData.append(font); | 108 m_fontData.push_back(font); |
109 m_glyphs.append(glyph); | 109 m_glyphs.push_back(glyph); |
110 m_offsets.append(offset.x()); | 110 m_offsets.push_back(offset.x()); |
111 m_offsets.append(offset.y()); | 111 m_offsets.push_back(offset.y()); |
112 } | 112 } |
113 | 113 |
114 void reverseForSimpleRTL(float afterOffset, float totalWidth) { | 114 void reverseForSimpleRTL(float afterOffset, float totalWidth) { |
115 ASSERT(!hasVerticalOffsets()); | 115 ASSERT(!hasVerticalOffsets()); |
116 | 116 |
117 if (isEmpty()) | 117 if (isEmpty()) |
118 return; | 118 return; |
119 | 119 |
120 m_fontData.reverse(); | 120 m_fontData.reverse(); |
121 m_glyphs.reverse(); | 121 m_glyphs.reverse(); |
(...skipping 28 matching lines...) Expand all Loading... |
150 bool isSkipInkException(unsigned index) const { | 150 bool isSkipInkException(unsigned index) const { |
151 if (!m_skipInkExceptions) | 151 if (!m_skipInkExceptions) |
152 return false; | 152 return false; |
153 DCHECK_EQ(m_skipInkExceptions->size(), m_offsets.size()); | 153 DCHECK_EQ(m_skipInkExceptions->size(), m_offsets.size()); |
154 return (*m_skipInkExceptions)[index]; | 154 return (*m_skipInkExceptions)[index]; |
155 } | 155 } |
156 | 156 |
157 void addIsSkipInkException(bool value) { | 157 void addIsSkipInkException(bool value) { |
158 DCHECK(hasSkipInkExceptions()); | 158 DCHECK(hasSkipInkExceptions()); |
159 DCHECK_EQ(m_skipInkExceptions->size(), m_offsets.size() - 1); | 159 DCHECK_EQ(m_skipInkExceptions->size(), m_offsets.size() - 1); |
160 m_skipInkExceptions->append(value); | 160 m_skipInkExceptions->push_back(value); |
161 } | 161 } |
162 | 162 |
163 protected: | 163 protected: |
164 Vector<const SimpleFontData*, 2048> m_fontData; | 164 Vector<const SimpleFontData*, 2048> m_fontData; |
165 Vector<Glyph, 2048> m_glyphs; | 165 Vector<Glyph, 2048> m_glyphs; |
166 | 166 |
167 // Glyph positioning: either x-only offsets, or interleaved x,y offsets | 167 // Glyph positioning: either x-only offsets, or interleaved x,y offsets |
168 // (depending on the buffer-wide positioning mode). This matches the | 168 // (depending on the buffer-wide positioning mode). This matches the |
169 // glyph positioning format used by Skia. | 169 // glyph positioning format used by Skia. |
170 Vector<float, 2048> m_offsets; | 170 Vector<float, 2048> m_offsets; |
171 | 171 |
172 // Flag vector of identical size to m_offset, true when glyph is to be | 172 // Flag vector of identical size to m_offset, true when glyph is to be |
173 // exempted from ink skipping, false otherwise. | 173 // exempted from ink skipping, false otherwise. |
174 std::unique_ptr<Vector<bool, 2048>> m_skipInkExceptions; | 174 std::unique_ptr<Vector<bool, 2048>> m_skipInkExceptions; |
175 }; | 175 }; |
176 | 176 |
177 } // namespace blink | 177 } // namespace blink |
178 | 178 |
179 #endif | 179 #endif |
OLD | NEW |