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: Source/core/platform/graphics/mac/FontComplexTextMac.cpp

Issue 14160005: Track the region where text is painted. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: fixed build on win and mac Created 7 years, 7 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2007, 2008, 2009 Apple 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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 85
86 if (run.rtl()) { 86 if (run.rtl()) {
87 initialAdvance = controller.totalWidth() + controller.finalRoundingWidth () - afterWidth; 87 initialAdvance = controller.totalWidth() + controller.finalRoundingWidth () - afterWidth;
88 glyphBuffer.reverse(0, glyphBuffer.size()); 88 glyphBuffer.reverse(0, glyphBuffer.size());
89 } else 89 } else
90 initialAdvance = beforeWidth; 90 initialAdvance = beforeWidth;
91 91
92 return initialAdvance; 92 return initialAdvance;
93 } 93 }
94 94
95 void Font::drawComplexText(GraphicsContext* context, const TextRun& run, const F loatPoint& point, int from, int to) const 95 void Font::drawComplexText(GraphicsContext* context, const TextRunPaintInfo& run Info, const FloatPoint& point) const
96 { 96 {
97 if (preferHarfBuzz(this)) { 97 if (preferHarfBuzz(this)) {
98 GlyphBuffer glyphBuffer; 98 GlyphBuffer glyphBuffer;
99 HarfBuzzShaper shaper(this, run); 99 HarfBuzzShaper shaper(this, runInfo.run);
100 shaper.setDrawRange(from, to); 100 shaper.setDrawRange(runInfo.from, runInfo.to);
101 if (shaper.shape(&glyphBuffer)) { 101 if (shaper.shape(&glyphBuffer)) {
102 drawGlyphBuffer(context, run, glyphBuffer, point); 102 drawGlyphBuffer(context, runInfo, glyphBuffer, point);
103 return; 103 return;
104 } 104 }
105 } 105 }
106 // This glyph buffer holds our glyphs + advances + font data for each glyph. 106 // This glyph buffer holds our glyphs + advances + font data for each glyph.
107 GlyphBuffer glyphBuffer; 107 GlyphBuffer glyphBuffer;
108 108
109 float startX = point.x() + getGlyphsAndAdvancesForComplexText(run, from, to, glyphBuffer); 109 float startX = point.x() + getGlyphsAndAdvancesForComplexText(runInfo.run, r unInfo.from, runInfo.to, glyphBuffer);
110 110
111 // We couldn't generate any glyphs for the run. Give up. 111 // We couldn't generate any glyphs for the run. Give up.
112 if (glyphBuffer.isEmpty()) 112 if (glyphBuffer.isEmpty())
113 return; 113 return;
114 114
115 // Draw the glyph buffer now at the starting point returned in startX. 115 // Draw the glyph buffer now at the starting point returned in startX.
116 FloatPoint startPoint(startX, point.y()); 116 FloatPoint startPoint(startX, point.y());
117 drawGlyphBuffer(context, run, glyphBuffer, startPoint); 117 drawGlyphBuffer(context, runInfo, glyphBuffer, startPoint);
118 } 118 }
119 119
120 void Font::drawEmphasisMarksForComplexText(GraphicsContext* context, const TextR un& run, const AtomicString& mark, const FloatPoint& point, int from, int to) co nst 120 void Font::drawEmphasisMarksForComplexText(GraphicsContext* context, const TextR unPaintInfo& runInfo, const AtomicString& mark, const FloatPoint& point) const
121 { 121 {
122 GlyphBuffer glyphBuffer; 122 GlyphBuffer glyphBuffer;
123 float initialAdvance = getGlyphsAndAdvancesForComplexText(run, from, to, gly phBuffer, ForTextEmphasis); 123 float initialAdvance = getGlyphsAndAdvancesForComplexText(runInfo.run, runIn fo.from, runInfo.to, glyphBuffer, ForTextEmphasis);
124 124
125 if (glyphBuffer.isEmpty()) 125 if (glyphBuffer.isEmpty())
126 return; 126 return;
127 127
128 drawEmphasisMarks(context, run, glyphBuffer, mark, FloatPoint(point.x() + in itialAdvance, point.y())); 128 drawEmphasisMarks(context, runInfo, glyphBuffer, mark, FloatPoint(point.x() + initialAdvance, point.y()));
129 } 129 }
130 130
131 float Font::floatWidthForComplexText(const TextRun& run, HashSet<const SimpleFon tData*>* fallbackFonts, GlyphOverflow* glyphOverflow) const 131 float Font::floatWidthForComplexText(const TextRun& run, HashSet<const SimpleFon tData*>* fallbackFonts, GlyphOverflow* glyphOverflow) const
132 { 132 {
133 if (preferHarfBuzz(this)) { 133 if (preferHarfBuzz(this)) {
134 HarfBuzzShaper shaper(this, run); 134 HarfBuzzShaper shaper(this, run);
135 if (shaper.shape()) 135 if (shaper.shape())
136 return shaper.totalWidth(); 136 return shaper.totalWidth();
137 } 137 }
138 ComplexTextController controller(this, run, true, fallbackFonts); 138 ComplexTextController controller(this, run, true, fallbackFonts);
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 return simpleFontData; 204 return simpleFontData;
205 } 205 }
206 206
207 if (!triedBaseCharacterFontData && baseCharacterGlyphData.fontData && baseCh aracterGlyphData.fontData->canRenderCombiningCharacterSequence(characters, lengt h)) 207 if (!triedBaseCharacterFontData && baseCharacterGlyphData.fontData && baseCh aracterGlyphData.fontData->canRenderCombiningCharacterSequence(characters, lengt h))
208 return baseCharacterGlyphData.fontData; 208 return baseCharacterGlyphData.fontData;
209 209
210 return SimpleFontData::systemFallback(); 210 return SimpleFontData::systemFallback();
211 } 211 }
212 212
213 } // namespace WebCore 213 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/platform/graphics/harfbuzz/FontHarfBuzz.cpp ('k') | Source/core/platform/graphics/mac/FontMac.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698