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

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

Issue 327243005: Remove GlyphBufferAdvance abstraction. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: rebase again Created 6 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « Source/platform/fonts/GlyphBuffer.h ('k') | Source/platform/fonts/harfbuzz/FontHarfBuzz.cpp » ('j') | 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 * 4 *
5 * This library is free software; you can redistribute it and/or 5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public 6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either 7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version. 8 * version 2 of the License, or (at your option) any later version.
9 * 9 *
10 * This library is distributed in the hope that it will be useful, 10 * This library is distributed in the hope that it will be useful,
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 { 102 {
103 ASSERT(typesettingFeatures & (Kerning | Ligatures)); 103 ASSERT(typesettingFeatures & (Kerning | Ligatures));
104 104
105 if (!glyphBuffer) 105 if (!glyphBuffer)
106 return 0; 106 return 0;
107 107
108 unsigned glyphBufferSize = glyphBuffer->size(); 108 unsigned glyphBufferSize = glyphBuffer->size();
109 if (glyphBuffer->size() <= lastGlyphCount + 1) 109 if (glyphBuffer->size() <= lastGlyphCount + 1)
110 return 0; 110 return 0;
111 111
112 GlyphBufferAdvance* advances = glyphBuffer->advances(0); 112 FloatSize* advances = glyphBuffer->advances(0);
113 float widthDifference = 0; 113 float widthDifference = 0;
114 for (unsigned i = lastGlyphCount; i < glyphBufferSize; ++i) 114 for (unsigned i = lastGlyphCount; i < glyphBufferSize; ++i)
115 widthDifference -= advances[i].width(); 115 widthDifference -= advances[i].width();
116 116
117 for (size_t i = 0; i < charactersTreatedAsSpace.size(); ++i) { 117 for (size_t i = 0; i < charactersTreatedAsSpace.size(); ++i) {
118 int spaceOffset = charactersTreatedAsSpace[i].first; 118 int spaceOffset = charactersTreatedAsSpace[i].first;
119 const OriginalAdvancesForCharacterTreatedAsSpace& originalAdvances = cha ractersTreatedAsSpace[i].second; 119 const OriginalAdvancesForCharacterTreatedAsSpace& originalAdvances = cha ractersTreatedAsSpace[i].second;
120 if (spaceOffset && !originalAdvances.characterIsSpace) 120 if (spaceOffset && !originalAdvances.characterIsSpace)
121 glyphBuffer->advances(spaceOffset - 1)->setWidth(originalAdvances.ad vanceBeforeCharacter); 121 glyphBuffer->advances(spaceOffset - 1)->setWidth(originalAdvances.ad vanceBeforeCharacter);
122 glyphBuffer->advances(spaceOffset)->setWidth(originalAdvances.advanceAtC haracter); 122 glyphBuffer->advances(spaceOffset)->setWidth(originalAdvances.advanceAtC haracter);
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
331 unsigned oldSize = glyphBuffer.size(); 331 unsigned oldSize = glyphBuffer.size();
332 advance(m_currentCharacter + 1, &glyphBuffer); 332 advance(m_currentCharacter + 1, &glyphBuffer);
333 float w = 0; 333 float w = 0;
334 for (unsigned i = oldSize; i < glyphBuffer.size(); ++i) 334 for (unsigned i = oldSize; i < glyphBuffer.size(); ++i)
335 w += glyphBuffer.advanceAt(i).width(); 335 w += glyphBuffer.advanceAt(i).width();
336 width = w; 336 width = w;
337 return glyphBuffer.size() > oldSize; 337 return glyphBuffer.size() > oldSize;
338 } 338 }
339 339
340 } 340 }
OLDNEW
« no previous file with comments | « Source/platform/fonts/GlyphBuffer.h ('k') | Source/platform/fonts/harfbuzz/FontHarfBuzz.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698