OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2003, 2006, 2008, 2009, 2010, 2011 Apple Inc. All rights reserv
ed. | 2 * Copyright (C) 2003, 2006, 2008, 2009, 2010, 2011 Apple Inc. All rights reserv
ed. |
3 * Copyright (C) 2008 Holger Hans Peter Freyther | 3 * Copyright (C) 2008 Holger Hans Peter Freyther |
4 * Copyright (C) 2014 Google Inc. All rights reserved. | 4 * Copyright (C) 2014 Google Inc. All rights reserved. |
5 * | 5 * |
6 * This library is free software; you can redistribute it and/or | 6 * This library is free software; you can redistribute it and/or |
7 * modify it under the terms of the GNU Library General Public | 7 * modify it under the terms of the GNU Library General Public |
8 * License as published by the Free Software Foundation; either | 8 * License as published by the Free Software Foundation; either |
9 * version 2 of the License, or (at your option) any later version. | 9 * version 2 of the License, or (at your option) any later version. |
10 * | 10 * |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
188 textIterator.advance(); | 188 textIterator.advance(); |
189 m_runWidthSoFar += width; | 189 m_runWidthSoFar += width; |
190 } | 190 } |
191 | 191 |
192 unsigned consumedCharacters = textIterator.offset() - m_currentCharacter; | 192 unsigned consumedCharacters = textIterator.offset() - m_currentCharacter; |
193 m_currentCharacter = textIterator.offset(); | 193 m_currentCharacter = textIterator.offset(); |
194 | 194 |
195 return consumedCharacters; | 195 return consumedCharacters; |
196 } | 196 } |
197 | 197 |
198 unsigned SimpleShaper::advance(unsigned offset, GlyphBuffer* glyphBuffer) | 198 unsigned SimpleShaper::advance(int offset, GlyphBuffer* glyphBuffer) |
199 { | 199 { |
200 unsigned length = m_textRun.length(); | 200 int length = m_textRun.length(); |
201 | 201 |
202 if (offset > length) | 202 if (offset > length) |
203 offset = length; | 203 offset = length; |
204 | 204 |
205 if (m_currentCharacter >= offset) | 205 if (m_currentCharacter >= static_cast<unsigned>(offset)) |
206 return 0; | 206 return 0; |
207 | 207 |
208 if (m_textRun.is8Bit()) { | 208 if (m_textRun.is8Bit()) { |
209 Latin1TextIterator textIterator(m_textRun.data8(m_currentCharacter), m_c
urrentCharacter, offset); | 209 Latin1TextIterator textIterator(m_textRun.data8(m_currentCharacter), m_c
urrentCharacter, offset); |
210 return advanceInternal(textIterator, glyphBuffer); | 210 return advanceInternal(textIterator, glyphBuffer); |
211 } | 211 } |
212 | 212 |
213 UTF16TextIterator textIterator(m_textRun.data16(m_currentCharacter), m_curre
ntCharacter, offset, length); | 213 UTF16TextIterator textIterator(m_textRun.data16(m_currentCharacter), m_curre
ntCharacter, offset, length); |
214 return advanceInternal(textIterator, glyphBuffer); | 214 return advanceInternal(textIterator, glyphBuffer); |
215 } | 215 } |
216 | 216 |
217 bool SimpleShaper::advanceOneCharacter(float& width) | 217 bool SimpleShaper::advanceOneCharacter(float& width) |
218 { | 218 { |
219 float initialWidth = m_runWidthSoFar; | 219 float initialWidth = m_runWidthSoFar; |
220 | 220 |
221 if (!advance(m_currentCharacter + 1)) | 221 if (!advance(m_currentCharacter + 1)) |
222 return false; | 222 return false; |
223 | 223 |
224 width = m_runWidthSoFar - initialWidth; | 224 width = m_runWidthSoFar - initialWidth; |
225 return true; | 225 return true; |
226 } | 226 } |
227 | 227 |
228 } // namespace blink | 228 } // namespace blink |
OLD | NEW |