Changeset 39206 in webkit
- Timestamp:
- Dec 11, 2008 6:14:46 AM (15 years ago)
- Location:
- trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/ChangeLog
r39204 r39206 1 2008-12-11 Holger Freyther <zecke@selfish.org> 2 3 Reviewed by Simon Hausmann. 4 5 https://bugs.webkit.org/show_bug.cgi?id=20953 6 7 For Qt it is not pratical to have a FontCache and GlyphPageTreeNode 8 implementation. This is one of the reasons why the Qt port is currently not 9 using WebCore/platform/graphics/Font.cpp. By allowing to not use 10 the simple/fast-path the Qt port will be able to use it. 11 12 Introduce USE(FONT_FAST_PATH) and define it for every port but the 13 Qt one. 14 15 * wtf/Platform.h: Enable USE(FONT_FAST_PATH) 16 1 17 2008-12-11 Gabor Loki <loki@inf.u-szeged.hu> 2 18 -
trunk/JavaScriptCore/wtf/Platform.h
r39115 r39206 462 462 #endif 463 463 464 #if !PLATFORM(QT) 465 #define WTF_USE_FONT_FAST_PATH 1 466 #endif 467 464 468 #endif /* WTF_Platform_h */ -
trunk/WebCore/ChangeLog
r39205 r39206 1 2008-12-11 Holger Freyther <zecke@selfish.org> 2 3 Reviewed by Simon Hausmann. 4 5 https://bugs.webkit.org/show_bug.cgi?id=20953 6 7 For Qt it is not pratical to have a FontCache and GlyphPageTreeNode 8 implementation. This is one of the reasons why the Qt port is currently not 9 using WebCore/platform/graphics/Font.cpp. By allowing to not use 10 the simple/fast-path the Qt port will be able to use it. 11 12 Introduce USE(FONT_FAST_PATH) and define it for every port but the 13 Qt one. 14 15 * platform/graphics/Font.cpp: 16 (WebCore::Font::drawText): 17 (WebCore::Font::floatWidth): 18 (WebCore::Font::selectionRectForText): 19 (WebCore::Font::offsetForPosition): 20 * platform/graphics/Font.h: 21 1 22 2008-12-11 Holger Hans Peter Freyther <zecke@selfish.org> 2 23 -
trunk/WebCore/platform/graphics/Font.cpp
r39205 r39206 38 38 namespace WebCore { 39 39 40 #if USE(FONT_FAST_PATH) 40 41 const uint8_t Font::gRoundingHackCharacterTable[256] = { 41 42 0, 0, 0, 0, 0, 0, 0, 0, 0, 1 /*\t*/, 1 /*\n*/, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, … … 50 51 51 52 Font::CodePath Font::s_codePath = Auto; 53 #endif 52 54 53 55 // ============================================================================================ … … 228 230 #endif 229 231 230 if (canUseGlyphCache(run)) 231 drawSimpleText(context, run, point, from, to); 232 else 233 drawComplexText(context, run, point, from, to); 232 #if USE(FONT_FAST_PATH) 233 if (canUseGlyphCache(run)) 234 return drawSimpleText(context, run, point, from, to); 235 #endif 236 237 return drawComplexText(context, run, point, from, to); 234 238 } 235 239 … … 241 245 #endif 242 246 247 #if USE(FONT_FAST_PATH) 243 248 if (canUseGlyphCache(run)) 244 249 return floatWidthForSimpleText(run, 0); 250 #endif 251 245 252 return floatWidthForComplexText(run); 246 253 } … … 255 262 charsConsumed = run.length(); 256 263 glyphName = ""; 264 265 #if ENABLE(FONT_FAST_PATH) 257 266 if (canUseGlyphCache(run)) 258 267 return floatWidthForSimpleText(run, 0); 268 #endif 269 259 270 return floatWidthForComplexText(run); 260 271 } … … 268 279 269 280 to = (to == -1 ? run.length() : to); 281 282 #if USE(FONT_FAST_PATH) 270 283 if (canUseGlyphCache(run)) 271 284 return selectionRectForSimpleText(run, point, h, from, to); 285 #endif 286 272 287 return selectionRectForComplexText(run, point, h, from, to); 273 288 } … … 280 295 #endif 281 296 297 #if USE(FONT_FAST_PATH) 282 298 if (canUseGlyphCache(run)) 283 299 return offsetForPositionForSimpleText(run, x, includePartialGlyphs); 300 #endif 301 284 302 return offsetForPositionForComplexText(run, x, includePartialGlyphs); 285 303 } -
trunk/WebCore/platform/graphics/Font.h
r38024 r39206 137 137 // Used for complex text, and does not utilize the glyph map cache. 138 138 const FontData* fontDataForCharacters(const UChar*, int length) const; 139 #endif 139 140 140 141 private: 141 bool canUseGlyphCache(const TextRun&) const;142 void drawSimpleText(GraphicsContext*, const TextRun&, const FloatPoint&, int from, int to) const;143 142 #if ENABLE(SVG_FONTS) 144 143 void drawTextUsingSVGFont(GraphicsContext*, const TextRun&, const FloatPoint&, int from, int to) const; … … 148 147 int offsetForPositionForTextUsingSVGFont(const TextRun&, int position, bool includePartialGlyphs) const; 149 148 #endif 149 150 #if USE(FONT_FAST_PATH) 151 bool canUseGlyphCache(const TextRun&) const; 152 void drawSimpleText(GraphicsContext*, const TextRun&, const FloatPoint&, int from, int to) const; 150 153 void drawGlyphs(GraphicsContext*, const SimpleFontData*, const GlyphBuffer&, int from, int to, const FloatPoint&) const; 151 154 void drawGlyphBuffer(GraphicsContext*, const GlyphBuffer&, const TextRun&, const FloatPoint&) const; 155 float floatWidthForSimpleText(const TextRun&, GlyphBuffer*) const; 156 int offsetForPositionForSimpleText(const TextRun&, int position, bool includePartialGlyphs) const; 157 FloatRect selectionRectForSimpleText(const TextRun&, const IntPoint&, int h, int from, int to) const; 158 #endif 159 152 160 void drawComplexText(GraphicsContext*, const TextRun&, const FloatPoint&, int from, int to) const; 153 float floatWidthForSimpleText(const TextRun&, GlyphBuffer*) const;154 161 float floatWidthForComplexText(const TextRun&) const; 155 int offsetForPositionForSimpleText(const TextRun&, int position, bool includePartialGlyphs) const;156 162 int offsetForPositionForComplexText(const TextRun&, int position, bool includePartialGlyphs) const; 157 FloatRect selectionRectForSimpleText(const TextRun&, const IntPoint&, int h, int from, int to) const;158 163 FloatRect selectionRectForComplexText(const TextRun&, const IntPoint&, int h, int from, int to) const; 159 164 void cachePrimaryFont() const; 160 #endif 165 161 166 friend struct WidthIterator; 162 167 … … 166 171 #else 167 172 // Useful for debugging the different font rendering code paths. 173 #if USE(FONT_FAST_PATH) 168 174 enum CodePath { Auto, Simple, Complex }; 169 175 static void setCodePath(CodePath); … … 176 182 return (((c & ~0xFF) == 0 && gRoundingHackCharacterTable[c])); 177 183 } 184 #endif 178 185 179 186 FontSelector* fontSelector() const;
Note: See TracChangeset
for help on using the changeset viewer.