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

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

Issue 1561633002: Relocate ShapeResult's GlyphBuffer helpers to ShapeResultBuffer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebased Created 4 years, 11 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 11 matching lines...) Expand all
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 */ 24 */
25 25
26 #include "platform/fonts/shaping/CachingWordShaper.h" 26 #include "platform/fonts/shaping/CachingWordShaper.h"
27 27
28 #include "platform/fonts/SimpleFontData.h" 28 #include "platform/fonts/SimpleFontData.h"
29 #include "platform/fonts/shaping/CachingWordShapeIterator.h" 29 #include "platform/fonts/shaping/CachingWordShapeIterator.h"
30 #include "platform/fonts/shaping/HarfBuzzShaper.h" 30 #include "platform/fonts/shaping/HarfBuzzShaper.h"
31 #include "platform/fonts/shaping/ShapeCache.h" 31 #include "platform/fonts/shaping/ShapeCache.h"
32 #include "platform/fonts/shaping/ShapeResultBuffer.h"
32 #include "wtf/text/CharacterNames.h" 33 #include "wtf/text/CharacterNames.h"
33 34
34 namespace blink { 35 namespace blink {
35 36
36 float CachingWordShaper::width(const Font* font, const TextRun& run, 37 float CachingWordShaper::width(const Font* font, const TextRun& run,
37 HashSet<const SimpleFontData*>* fallbackFonts, 38 HashSet<const SimpleFontData*>* fallbackFonts,
38 FloatRect* glyphBounds) 39 FloatRect* glyphBounds)
39 { 40 {
40 float width = 0; 41 float width = 0;
41 RefPtr<ShapeResult> wordResult; 42 RefPtr<ShapeResult> wordResult;
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 } 75 }
75 } 76 }
76 return totalWidth; 77 return totalWidth;
77 } 78 }
78 79
79 int CachingWordShaper::offsetForPosition(const Font* font, const TextRun& run, f loat targetX) 80 int CachingWordShaper::offsetForPosition(const Font* font, const TextRun& run, f loat targetX)
80 { 81 {
81 ShapeResultBuffer buffer; 82 ShapeResultBuffer buffer;
82 shapeResultsForRun(m_shapeCache, font, run, nullptr, &buffer); 83 shapeResultsForRun(m_shapeCache, font, run, nullptr, &buffer);
83 84
84 return ShapeResult::offsetForPosition(buffer, run, targetX); 85 return buffer.offsetForPosition(run, targetX);
85 } 86 }
86 87
87 float CachingWordShaper::fillGlyphBuffer(const Font* font, const TextRun& run, 88 float CachingWordShaper::fillGlyphBuffer(const Font* font, const TextRun& run,
88 HashSet<const SimpleFontData*>* fallbackFonts, 89 HashSet<const SimpleFontData*>* fallbackFonts,
89 GlyphBuffer* glyphBuffer, unsigned from, unsigned to) 90 GlyphBuffer* glyphBuffer, unsigned from, unsigned to)
90 { 91 {
91 ShapeResultBuffer buffer; 92 ShapeResultBuffer buffer;
92 shapeResultsForRun(m_shapeCache, font, run, fallbackFonts, &buffer); 93 shapeResultsForRun(m_shapeCache, font, run, fallbackFonts, &buffer);
93 94
94 return ShapeResult::fillGlyphBuffer(buffer, glyphBuffer, run, from, to); 95 return buffer.fillGlyphBuffer(glyphBuffer, run, from, to);
95 } 96 }
96 97
97 float CachingWordShaper::fillGlyphBufferForTextEmphasis(const Font* font, 98 float CachingWordShaper::fillGlyphBufferForTextEmphasis(const Font* font,
98 const TextRun& run, const GlyphData* emphasisData, GlyphBuffer* glyphBuffer, 99 const TextRun& run, const GlyphData* emphasisData, GlyphBuffer* glyphBuffer,
99 unsigned from, unsigned to) 100 unsigned from, unsigned to)
100 { 101 {
101 ShapeResultBuffer buffer; 102 ShapeResultBuffer buffer;
102 shapeResultsForRun(m_shapeCache, font, run, nullptr, &buffer); 103 shapeResultsForRun(m_shapeCache, font, run, nullptr, &buffer);
103 104
104 return ShapeResult::fillGlyphBufferForTextEmphasis(buffer, glyphBuffer, 105 return buffer.fillGlyphBufferForTextEmphasis(glyphBuffer, run, emphasisData, from, to);
105 run, emphasisData, from, to);
106 } 106 }
107 107
108 FloatRect CachingWordShaper::selectionRect(const Font* font, const TextRun& run, 108 FloatRect CachingWordShaper::selectionRect(const Font* font, const TextRun& run,
109 const FloatPoint& point, int height, unsigned from, unsigned to) 109 const FloatPoint& point, int height, unsigned from, unsigned to)
110 { 110 {
111 ShapeResultBuffer buffer; 111 ShapeResultBuffer buffer;
112 float totalWidth = shapeResultsForRun(m_shapeCache, font, run, nullptr, 112 float totalWidth = shapeResultsForRun(m_shapeCache, font, run, nullptr,
113 &buffer); 113 &buffer);
114 114
115 return ShapeResult::selectionRect(buffer, run.direction(), totalWidth, 115 return buffer.selectionRect(run.direction(), totalWidth, point, height, from , to);
116 point, height, from, to);
117 } 116 }
118 117
119 }; // namespace blink 118 }; // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/platform/blink_platform.gypi ('k') | third_party/WebKit/Source/platform/fonts/shaping/ShapeResult.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698