Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(75)

Side by Side Diff: Source/platform/fonts/SimpleShaper.cpp

Issue 608413002: Change SimpleShaper::advance to take unsigned (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Source/platform/fonts/SimpleShaper.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 if (glyphBuffer) 226 if (glyphBuffer)
227 glyphBuffer->add(glyph, fontData, width); 227 glyphBuffer->add(glyph, fontData, width);
228 } 228 }
229 229
230 unsigned consumedCharacters = textIterator.currentCharacter() - m_currentCha racter; 230 unsigned consumedCharacters = textIterator.currentCharacter() - m_currentCha racter;
231 m_currentCharacter = textIterator.currentCharacter(); 231 m_currentCharacter = textIterator.currentCharacter();
232 232
233 return consumedCharacters; 233 return consumedCharacters;
234 } 234 }
235 235
236 unsigned SimpleShaper::advance(int offset, GlyphBuffer* glyphBuffer) 236 unsigned SimpleShaper::advance(unsigned offset, GlyphBuffer* glyphBuffer)
237 { 237 {
238 int length = m_run.length(); 238 unsigned length = m_run.length();
239 239
240 if (offset > length) 240 if (offset > length)
241 offset = length; 241 offset = length;
242 242
243 if (m_currentCharacter >= static_cast<unsigned>(offset)) 243 if (m_currentCharacter >= offset)
244 return 0; 244 return 0;
245 245
246 if (m_run.is8Bit()) { 246 if (m_run.is8Bit()) {
247 Latin1TextIterator textIterator(m_run.data8(m_currentCharacter), m_curre ntCharacter, offset, length); 247 Latin1TextIterator textIterator(m_run.data8(m_currentCharacter), m_curre ntCharacter, offset, length);
248 return advanceInternal(textIterator, glyphBuffer); 248 return advanceInternal(textIterator, glyphBuffer);
249 } 249 }
250 250
251 SurrogatePairAwareTextIterator textIterator(m_run.data16(m_currentCharacter) , m_currentCharacter, offset, length); 251 SurrogatePairAwareTextIterator textIterator(m_run.data16(m_currentCharacter) , m_currentCharacter, offset, length);
252 return advanceInternal(textIterator, glyphBuffer); 252 return advanceInternal(textIterator, glyphBuffer);
253 } 253 }
254 254
255 bool SimpleShaper::advanceOneCharacter(float& width) 255 bool SimpleShaper::advanceOneCharacter(float& width)
256 { 256 {
257 float initialWidth = m_runWidthSoFar; 257 float initialWidth = m_runWidthSoFar;
258 258
259 if (!advance(m_currentCharacter + 1)) 259 if (!advance(m_currentCharacter + 1))
260 return false; 260 return false;
261 261
262 width = m_runWidthSoFar - initialWidth; 262 width = m_runWidthSoFar - initialWidth;
263 return true; 263 return true;
264 } 264 }
265 265
266 } // namespace blink 266 } // namespace blink
OLDNEW
« no previous file with comments | « Source/platform/fonts/SimpleShaper.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698