diff options
author | Steve Block <steveblock@google.com> | 2009-12-15 10:12:09 +0000 |
---|---|---|
committer | Steve Block <steveblock@google.com> | 2009-12-17 17:41:10 +0000 |
commit | 643ca7872b450ea4efacab6188849e5aac2ba161 (patch) | |
tree | 6982576c228bcd1a7efe98afed544d840751094c /WebCore/platform/graphics/cairo/FontCairo.cpp | |
parent | d026980fde6eb3b01c1fe49441174e89cd1be298 (diff) | |
download | external_webkit-643ca7872b450ea4efacab6188849e5aac2ba161.zip external_webkit-643ca7872b450ea4efacab6188849e5aac2ba161.tar.gz external_webkit-643ca7872b450ea4efacab6188849e5aac2ba161.tar.bz2 |
Merge webkit.org at r51976 : Initial merge by git.
Change-Id: Ib0e7e2f0fb4bee5a186610272edf3186f0986b43
Diffstat (limited to 'WebCore/platform/graphics/cairo/FontCairo.cpp')
-rw-r--r-- | WebCore/platform/graphics/cairo/FontCairo.cpp | 32 |
1 files changed, 31 insertions, 1 deletions
diff --git a/WebCore/platform/graphics/cairo/FontCairo.cpp b/WebCore/platform/graphics/cairo/FontCairo.cpp index 1a951c2..3bfa8f3 100644 --- a/WebCore/platform/graphics/cairo/FontCairo.cpp +++ b/WebCore/platform/graphics/cairo/FontCairo.cpp @@ -32,6 +32,7 @@ #include "GlyphBuffer.h" #include "Gradient.h" #include "GraphicsContext.h" +#include "ImageBuffer.h" #include "Pattern.h" #include "SimpleFontData.h" #include "TransformationMatrix.h" @@ -85,6 +86,34 @@ void Font::drawGlyphs(GraphicsContext* context, const SimpleFontData* font, cons shadowFillColor.getRGBA(red, green, blue, alpha); cairo_set_source_rgba(cr, red, green, blue, alpha); +#if ENABLE(FILTERS) + cairo_text_extents_t extents; + cairo_scaled_font_glyph_extents(font->platformData().scaledFont(), glyphs, numGlyphs, &extents); + + FloatRect rect(FloatPoint(), FloatSize(extents.width, extents.height)); + IntSize shadowBufferSize; + FloatRect shadowRect; + float kernelSize = 0.f; + GraphicsContext::calculateShadowBufferDimensions(shadowBufferSize, shadowRect, kernelSize, rect, shadowSize, shadowBlur); + + // Draw shadow into a new ImageBuffer + OwnPtr<ImageBuffer> shadowBuffer = ImageBuffer::create(shadowBufferSize); + GraphicsContext* shadowContext = shadowBuffer->context(); + cairo_t* shadowCr = shadowContext->platformContext(); + + cairo_translate(shadowCr, kernelSize, extents.height + kernelSize); + + cairo_set_scaled_font(shadowCr, font->platformData().scaledFont()); + cairo_show_glyphs(shadowCr, glyphs, numGlyphs); + if (font->syntheticBoldOffset()) { + cairo_save(shadowCr); + cairo_translate(shadowCr, font->syntheticBoldOffset(), 0); + cairo_show_glyphs(shadowCr, glyphs, numGlyphs); + cairo_restore(shadowCr); + } + cairo_translate(cr, 0.0, -extents.height); + context->createPlatformShadow(shadowBuffer.release(), shadowColor, shadowRect, kernelSize); +#else cairo_translate(cr, shadowSize.width(), shadowSize.height()); cairo_show_glyphs(cr, glyphs, numGlyphs); if (font->syntheticBoldOffset()) { @@ -93,6 +122,7 @@ void Font::drawGlyphs(GraphicsContext* context, const SimpleFontData* font, cons cairo_show_glyphs(cr, glyphs, numGlyphs); cairo_restore(cr); } +#endif cairo_restore(cr); } @@ -156,7 +186,7 @@ void Font::drawGlyphs(GraphicsContext* context, const SimpleFontData* font, cons // Re-enable the platform shadow we disabled earlier if (hasShadow) - context->setShadow(shadowSize, shadowBlur, shadowColor); + context->setShadow(shadowSize, shadowBlur, shadowColor, DeviceColorSpace); cairo_restore(cr); } |