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

Side by Side Diff: third_party/WebKit/Source/platform/fonts/shaping/CachingWordShaper.cpp

Issue 1773403002: Update SVG text layout to use shaped glyph data & go fast (O(n^2)->O(n)) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@1773353003
Patch Set: Minor cleanup of comments and tests Created 4 years, 9 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2015 Google Inc. All rights reserved. 2 * Copyright (C) 2015 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 CharacterRange CachingWordShaper::getCharacterRange(const Font* font, 109 CharacterRange CachingWordShaper::getCharacterRange(const Font* font,
110 const TextRun& run, unsigned from, unsigned to) 110 const TextRun& run, unsigned from, unsigned to)
111 { 111 {
112 ShapeResultBuffer buffer; 112 ShapeResultBuffer buffer;
113 float totalWidth = shapeResultsForRun(m_shapeCache, font, run, nullptr, 113 float totalWidth = shapeResultsForRun(m_shapeCache, font, run, nullptr,
114 &buffer); 114 &buffer);
115 115
116 return buffer.getCharacterRange(run.direction(), totalWidth, from, to); 116 return buffer.getCharacterRange(run.direction(), totalWidth, from, to);
117 } 117 }
118 118
119 Vector<CharacterRange> CachingWordShaper::individualCharacterRanges(
120 const Font* font, const TextRun& run, unsigned from, unsigned to)
121 {
122 ShapeResultBuffer buffer;
123 float totalWidth = shapeResultsForRun(m_shapeCache, font, run, nullptr,
124 &buffer);
125
126 Vector<CharacterRange> allExtents;
127 for (unsigned position = from; position <= to; position++) {
128 allExtents.append(buffer.getCharacterRange(run.direction(), totalWidth,
129 position, position + 1));
130 }
131
132 return allExtents;
133 }
134
119 }; // namespace blink 135 }; // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698