Changeset 80386 in webkit
- Timestamp:
- Mar 4, 2011 4:00:40 PM (13 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r80384 r80386 1 2011-03-04 Mike Reed <reed@google.com> 2 3 Reviewed by James Robinson. 4 5 Option to use skia's native text drawing APIs when drawing text 6 on Windows, rather than from outlines using drawPath(). This will 7 only have a significant effect when the skia-gpu backend is enabled. 8 https://bugs.webkit.org/show_bug.cgi?id=55609 9 10 No new tests. This is disabled by default. When enabled, it will draw 11 essentially the same, but with slightly different antialiased edges, due 12 to differences between the current scanconverter and GDI's font scaler. 13 When enabled, we will have to recalibrate layouttest image results. 14 15 * platform/graphics/skia/SkiaFontWin.cpp: 16 (WebCore::skiaDrawText): 17 (WebCore::setupPaintForFont): 18 (WebCore::paintSkiaText): 19 1 20 2011-03-04 Adrienne Walker <enne@google.com> 2 21 -
trunk/Source/WebCore/platform/graphics/skia/SkiaFontWin.cpp
r74463 r80386 39 39 #include "SkPaint.h" 40 40 #include "SkShader.h" 41 #include "SkTemplates.h" 42 #include "SkTypeface.h" 41 43 42 44 #include <wtf/ListHashSet.h> 43 45 #include <wtf/Vector.h> 46 47 #if ENABLE(SKIA_TEXT) 48 // FIXME: a future role of skia will have this in a proper header 49 extern SkTypeface* SkCreateTypefaceFromLOGFONT(const LOGFONT&); 50 #endif 44 51 45 52 namespace WebCore { … … 274 281 int numGlyphs) 275 282 { 283 #if ENABLE(SKIA_TEXT) 284 SkASSERT(sizeof(WORD) == sizeof(uint16_t)); 285 286 // Reserve space for 64 glyphs on the stack. If numGlyphs is larger, the array 287 // will dynamically allocate it space for numGlyph glyphs. 288 static const size_t kLocalGlyphMax = 64; 289 SkAutoSTArray<kLocalGlyphMax, SkPoint> posStorage(numGlyphs); 290 SkPoint* pos = posStorage.get(); 291 SkScalar x = point.fX; 292 SkScalar y = point.fY; 293 for (int i = 0; i < numGlyphs; i++) { 294 pos[i].set(x + (offsets ? offsets[i].du : 0), 295 y + (offsets ? offsets[i].dv : 0)); 296 x += SkIntToScalar(advances[i]); 297 } 298 canvas->drawPosText(glyphs, numGlyphs * sizeof(uint16_t), pos, *paint); 299 #else 276 300 float x = point.fX, y = point.fY; 277 301 … … 293 317 x += advances[i]; 294 318 } 295 319 #endif 296 320 return true; 297 321 } 322 323 #if ENABLE(SKIA_TEXT) 324 static void setupPaintForFont(HFONT hfont, SkPaint* paint) 325 { 326 // FIXME: 327 // Much of this logic could also happen in 328 // FontCustomPlatformData::fontPlatformData and be cached, 329 // allowing us to avoid talking to GDI at this point. 330 // 331 LOGFONT info; 332 GetObject(hfont, sizeof(info), &info); 333 int size = info.lfHeight; 334 if (size < 0) 335 size = -size; // We don't let GDI dpi-scale us (see SkFontHost_win.cpp). 336 paint->setTextSize(SkIntToScalar(size)); 337 338 SkTypeface* face = SkCreateTypefaceFromLOGFONT(info); 339 paint->setTypeface(face); 340 SkSafeUnref(face); 341 } 342 #endif 298 343 299 344 bool paintSkiaText(GraphicsContext* context, … … 315 360 platformContext->setupPaintForFilling(&paint); 316 361 paint.setFlags(SkPaint::kAntiAlias_Flag); 362 #if ENABLE(SKIA_TEXT) 363 paint.setTextEncoding(SkPaint::kGlyphID_TextEncoding); 364 setupPaintForFont(hfont, &paint); 365 #endif 317 366 bool didFill = false; 318 367
Note: See TracChangeset
for help on using the changeset viewer.