Changeset 83541 in webkit
- Timestamp:
- Apr 11, 2011 5:31:31 PM (13 years ago)
- Location:
- trunk
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r83536 r83541 1 2011-04-11 Justin Novosad <junov@chromium.org> 2 3 Reviewed by Kenneth Russell. 4 5 [Chromium] Text anti-aliasing fails when rendering text with shadow 6 https://bugs.webkit.org/show_bug.cgi?id=57584 7 8 * platform/chromium/test_expectations.txt: 9 Tempoaray test failures that will need to be rebaselined 10 1 11 2011-04-11 Jian Li <jianli@chromium.org> 2 12 -
trunk/LayoutTests/platform/chromium/test_expectations.txt
r83536 r83541 690 690 BUGCR3273 MAC : platform/mac/editing/input/firstrectforcharacterrange-plain.html = FAIL PASS 691 691 BUGCR3273 MAC : platform/mac/editing/input/range-for-empty-document.html = FAIL PASS 692 693 // Need rebaseline 694 BUGWK57584 WIN : fast/multicol/shadow-breaking.html = IMAGE 695 BUGWK57584 WIN : fast/text/shadow-translucent-fill.html = IMAGE 696 BUGWK57584 WIN : fast/transforms/shadows.html = IMAGE 697 BUGWK57584 WIN : svg/css/shadow-changes.svg = IMAGE 698 BUGWK57584 WIN : transitions/svg-text-shadow-transition.html = IMAGE 699 BUGWK57584 WIN : svg/css/composite-shadow-text.svg = IMAGE 700 BUGWK57584 WIN : svg/css/group-with-shadow.svg = IMAGE 701 BUGWK57584 WIN : svg/css/text-shadow-multiple.xhtml = IMAGE 692 702 693 703 // These tests also use firstRectForCharacterRange, but they generate slightly -
trunk/Source/WebCore/ChangeLog
r83540 r83541 1 2011-04-11 Justin Novosad <junov@chromium.org> 2 3 Reviewed by Kenneth Russell. 4 5 [Chromium] Text anti-aliasing fails when rendering text with shadow 6 https://bugs.webkit.org/show_bug.cgi?id=57584 7 8 * platform/graphics/chromium/FontChromiumWin.cpp: 9 (WebCore::drawGlyphsWin): new static function, code factored-out 10 from WebCore::Font::drawGlyphs 11 (WebCore::Font::drawGlyphs): may separate font rendering into two 12 passes to allow foreground glyphs to be rendered with GDI when Skia 13 is required for rendering shadows 14 * platform/graphics/skia/SkiaFontWin.cpp: 15 (WebCore::windowsCanHandleDrawTextShadow): 16 Modified method so that it does not assume a shadow is present, and 17 returns true if there is no shadow (GDI can draw 'no shadow') 18 (WebCore::windowsCanHandleTextDrawing): 19 Factored out into sub methods so that the the shadow and foregound 20 glyph properties can be tested separately independently. 21 (WebCore::windowsCanHandleTextDrawingWithoutShadow): 22 New method returns true if the foreground glyph only has effect 23 that can be draw with GDI 24 (WebCore::paintSkiaText): 25 * platform/graphics/skia/SkiaFontWin.h: 26 1 27 2011-04-11 Ryosuke Niwa <rniwa@webkit.org> 2 28 -
trunk/Source/WebCore/platform/graphics/chromium/FontChromiumWin.cpp
r83013 r83541 375 375 } 376 376 377 void Font::drawGlyphs(GraphicsContext* graphicsContext, 378 const SimpleFontData* font, 379 const GlyphBuffer& glyphBuffer, 380 int from, 381 int numGlyphs, 382 const FloatPoint& point) const 383 { 377 static void drawGlyphsWin(GraphicsContext* graphicsContext, 378 const SimpleFontData* font, 379 const GlyphBuffer& glyphBuffer, 380 int from, 381 int numGlyphs, 382 const FloatPoint& point) { 384 383 graphicsContext->platformContext()->prepareForSoftwareDraw(); 385 386 SkColor color = graphicsContext->platformContext()->effectiveFillColor();387 unsigned char alpha = SkColorGetA(color);388 // Skip 100% transparent text; no need to draw anything.389 if (!alpha && graphicsContext->platformContext()->getStrokeStyle() == NoStroke)390 return;391 384 392 385 TransparencyAwareGlyphPainter painter(graphicsContext, font, glyphBuffer, from, numGlyphs, point); … … 450 443 } 451 444 445 void Font::drawGlyphs(GraphicsContext* graphicsContext, 446 const SimpleFontData* font, 447 const GlyphBuffer& glyphBuffer, 448 int from, 449 int numGlyphs, 450 const FloatPoint& point) const 451 { 452 SkColor color = graphicsContext->platformContext()->effectiveFillColor(); 453 unsigned char alpha = SkColorGetA(color); 454 // Skip 100% transparent text; no need to draw anything. 455 if (!alpha && graphicsContext->platformContext()->getStrokeStyle() == NoStroke && !graphicsContext->hasShadow()) 456 return; 457 if (!alpha || windowsCanHandleDrawTextShadow(graphicsContext) || !windowsCanHandleTextDrawingWithoutShadow(graphicsContext)) { 458 drawGlyphsWin(graphicsContext, font, glyphBuffer, from, numGlyphs, point); 459 return; 460 } 461 // Draw in two passes: skia for the shadow, GDI for foreground text 462 // pass1: shadow (will use skia) 463 graphicsContext->save(); 464 graphicsContext->setFillColor(Color::transparent, graphicsContext->fillColorSpace()); 465 drawGlyphsWin(graphicsContext, font, glyphBuffer, from, numGlyphs, point); 466 graphicsContext->restore(); 467 // pass2: foreground text (will use GDI) 468 FloatSize shadowOffset; 469 float shadowBlur; 470 Color shadowColor; 471 ColorSpace shadowColorSpace; 472 graphicsContext->getShadow(shadowOffset, shadowBlur, shadowColor, shadowColorSpace); 473 graphicsContext->setShadow(shadowOffset, shadowBlur, Color::transparent, shadowColorSpace); 474 drawGlyphsWin(graphicsContext, font, glyphBuffer, from, numGlyphs, point); 475 graphicsContext->setShadow(shadowOffset, shadowBlur, shadowColor, shadowColorSpace); 476 } 477 452 478 FloatRect Font::selectionRectForComplexText(const TextRun& run, 453 479 const FloatPoint& point, -
trunk/Source/WebCore/platform/graphics/skia/SkiaFontWin.cpp
r83329 r83541 231 231 232 232 bool hasShadow = context->getShadow(shadowOffset, shadowBlur, shadowColor, shadowColorSpace); 233 return (hasShadow && (shadowBlur == 0)&& (shadowColor.alpha() == 255) && (context->fillColor().alpha() == 255));233 return !hasShadow || (!shadowBlur && (shadowColor.alpha() == 255) && (context->fillColor().alpha() == 255)); 234 234 } 235 235 236 236 bool windowsCanHandleTextDrawing(GraphicsContext* context) 237 { 238 if (!windowsCanHandleTextDrawingWithoutShadow(context)) 239 return false; 240 241 // Check for shadow effects. 242 if (!windowsCanHandleDrawTextShadow(context)) 243 return false; 244 245 return true; 246 } 247 248 bool windowsCanHandleTextDrawingWithoutShadow(GraphicsContext* context) 237 249 { 238 250 // Check for non-translation transforms. Sometimes zooms will look better in … … 255 267 // Check for patterns. 256 268 if (context->fillPattern() || context->strokePattern()) 257 return false;258 259 // Check for shadow effects.260 if (context->platformContext()->getDrawLooper() && (!windowsCanHandleDrawTextShadow(context)))261 269 return false; 262 270 … … 363 371 bool didFill = false; 364 372 365 if ((textMode & TextModeFill) && SkColorGetA(paint.getColor())) {373 if ((textMode & TextModeFill) && (SkColorGetA(paint.getColor()) || paint.getLooper())) { 366 374 if (!skiaDrawText(hfont, dc, platformContext, *origin, &paint, 367 375 &glyphs[0], &advances[0], &offsets[0], numGlyphs)) -
trunk/Source/WebCore/platform/graphics/skia/SkiaFontWin.h
r64584 r83541 77 77 bool windowsCanHandleTextDrawing(GraphicsContext*); 78 78 79 // Returns true if advanced font rendering is recommended if shadows are 80 // disregarded. 81 bool windowsCanHandleTextDrawingWithoutShadow(GraphicsContext*); 82 79 83 // Note that the offsets parameter is optional. If not NULL it represents a 80 84 // per glyph offset (such as returned by ScriptPlace Windows API function).
Note: See TracChangeset
for help on using the changeset viewer.