| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006, 2007 Apple Computer, Inc. | 2 * Copyright (C) 2006, 2007 Apple Computer, Inc. |
| 3 * Copyright (c) 2006, 2007, 2008, 2009, Google Inc. All rights reserved. | 3 * Copyright (c) 2006, 2007, 2008, 2009, Google Inc. All rights reserved. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions are | 6 * modification, are permitted provided that the following conditions are |
| 7 * met: | 7 * met: |
| 8 * | 8 * |
| 9 * * Redistributions of source code must retain the above copyright | 9 * * Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 436 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 447 const GlyphBuffer& glyphBuffer, | 447 const GlyphBuffer& glyphBuffer, |
| 448 int from, | 448 int from, |
| 449 int numGlyphs, | 449 int numGlyphs, |
| 450 const FloatPoint& point) const | 450 const FloatPoint& point) const |
| 451 { | 451 { |
| 452 SkColor color = graphicsContext->platformContext()->effectiveFillColor(); | 452 SkColor color = graphicsContext->platformContext()->effectiveFillColor(); |
| 453 unsigned char alpha = SkColorGetA(color); | 453 unsigned char alpha = SkColorGetA(color); |
| 454 // Skip 100% transparent text; no need to draw anything. | 454 // Skip 100% transparent text; no need to draw anything. |
| 455 if (!alpha && graphicsContext->platformContext()->getStrokeStyle() == NoStro
ke && !graphicsContext->hasShadow()) | 455 if (!alpha && graphicsContext->platformContext()->getStrokeStyle() == NoStro
ke && !graphicsContext->hasShadow()) |
| 456 return; | 456 return; |
| 457 if (!alpha || windowsCanHandleDrawTextShadow(graphicsContext) || !windowsCan
HandleTextDrawingWithoutShadow(graphicsContext)) { | 457 |
| 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->fillColor
Space()); | |
| 465 drawGlyphsWin(graphicsContext, font, glyphBuffer, from, numGlyphs, point); | 458 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, shadowColo
rSpace); | |
| 473 graphicsContext->setShadow(shadowOffset, shadowBlur, Color::transparent, sha
dowColorSpace); | |
| 474 drawGlyphsWin(graphicsContext, font, glyphBuffer, from, numGlyphs, point); | |
| 475 graphicsContext->setShadow(shadowOffset, shadowBlur, shadowColor, shadowColo
rSpace); | |
| 476 } | 459 } |
| 477 | 460 |
| 478 FloatRect Font::selectionRectForComplexText(const TextRun& run, | 461 FloatRect Font::selectionRectForComplexText(const TextRun& run, |
| 479 const FloatPoint& point, | 462 const FloatPoint& point, |
| 480 int h, | 463 int h, |
| 481 int from, | 464 int from, |
| 482 int to) const | 465 int to) const |
| 483 { | 466 { |
| 484 UniscribeHelperTextRun state(run, *this); | 467 UniscribeHelperTextRun state(run, *this); |
| 485 float left = static_cast<float>(point.x() + state.characterToX(from)); | 468 float left = static_cast<float>(point.x() + state.characterToX(from)); |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 569 int charIndex = state.xToCharacter(x); | 552 int charIndex = state.xToCharacter(x); |
| 570 | 553 |
| 571 // XToCharacter will return -1 if the position is before the first | 554 // XToCharacter will return -1 if the position is before the first |
| 572 // character (we get called like this sometimes). | 555 // character (we get called like this sometimes). |
| 573 if (charIndex < 0) | 556 if (charIndex < 0) |
| 574 charIndex = 0; | 557 charIndex = 0; |
| 575 return charIndex; | 558 return charIndex; |
| 576 } | 559 } |
| 577 | 560 |
| 578 } // namespace WebCore | 561 } // namespace WebCore |
| OLD | NEW |