diff options
author | Steve Block <steveblock@google.com> | 2011-05-25 19:08:45 +0100 |
---|---|---|
committer | Steve Block <steveblock@google.com> | 2011-06-08 13:51:31 +0100 |
commit | 2bde8e466a4451c7319e3a072d118917957d6554 (patch) | |
tree | 28f4a1b869a513e565c7760d0e6a06e7cf1fe95a /Source/WebCore/platform/graphics/gtk/FontGtk.cpp | |
parent | 6939c99b71d9372d14a0c74a772108052e8c48c8 (diff) | |
download | external_webkit-2bde8e466a4451c7319e3a072d118917957d6554.zip external_webkit-2bde8e466a4451c7319e3a072d118917957d6554.tar.gz external_webkit-2bde8e466a4451c7319e3a072d118917957d6554.tar.bz2 |
Merge WebKit at r82507: Initial merge by git
Change-Id: I60ce9d780725b58b45e54165733a8ffee23b683e
Diffstat (limited to 'Source/WebCore/platform/graphics/gtk/FontGtk.cpp')
-rw-r--r-- | Source/WebCore/platform/graphics/gtk/FontGtk.cpp | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/Source/WebCore/platform/graphics/gtk/FontGtk.cpp b/Source/WebCore/platform/graphics/gtk/FontGtk.cpp index 216fb56..d14b052 100644 --- a/Source/WebCore/platform/graphics/gtk/FontGtk.cpp +++ b/Source/WebCore/platform/graphics/gtk/FontGtk.cpp @@ -35,6 +35,7 @@ #include "CairoUtilities.h" #include "ContextShadow.h" +#include "PlatformContextCairo.h" #include "GraphicsContext.h" #include "NotImplemented.h" #include "SimpleFontData.h" @@ -44,7 +45,7 @@ #include <pango/pango.h> #include <pango/pangocairo.h> -#if defined(USE_FREETYPE) +#if USE(FREETYPE) #include <pango/pangofc-fontmap.h> #endif @@ -171,13 +172,13 @@ static gchar* convertUniCharToUTF8(const UChar* characters, gint length, int fro static void setPangoAttributes(const Font* font, const TextRun& run, PangoLayout* layout) { -#if defined(USE_FREETYPE) +#if USE(FREETYPE) if (font->primaryFont()->platformData().m_pattern) { PangoFontDescription* desc = pango_fc_font_description_from_pattern(font->primaryFont()->platformData().m_pattern.get(), FALSE); pango_layout_set_font_description(layout, desc); pango_font_description_free(desc); } -#elif defined(USE_PANGO) +#elif USE(PANGO) if (font->primaryFont()->platformData().m_font) { PangoFontDescription* desc = pango_font_describe(font->primaryFont()->platformData().m_font); pango_layout_set_font_description(layout, desc); @@ -220,7 +221,7 @@ bool Font::canExpandAroundIdeographsInComplexText() return false; } -static void drawGlyphsShadow(GraphicsContext* graphicsContext, cairo_t* context, const FloatPoint& point, PangoLayoutLine* layoutLine, PangoRegionType renderRegion) +static void drawGlyphsShadow(GraphicsContext* graphicsContext, const FloatPoint& point, PangoLayoutLine* layoutLine, PangoRegionType renderRegion) { ContextShadow* shadow = graphicsContext->contextShadow(); ASSERT(shadow); @@ -232,6 +233,7 @@ static void drawGlyphsShadow(GraphicsContext* graphicsContext, cairo_t* context, // Optimize non-blurry shadows, by just drawing text without the ContextShadow. if (!shadow->mustUseContextShadow(graphicsContext)) { + cairo_t* context = graphicsContext->platformContext()->cr(); cairo_save(context); cairo_translate(context, totalOffset.x(), totalOffset.y()); @@ -255,6 +257,7 @@ static void drawGlyphsShadow(GraphicsContext* graphicsContext, cairo_t* context, // because we don't want any bits and pieces of characters out of range to be // drawn. Since ContextShadow expects a consistent transform, we have to undo the // translation before calling endShadowLayer as well. + cairo_t* context = graphicsContext->platformContext()->cr(); cairo_save(context); cairo_translate(context, totalOffset.x(), totalOffset.y()); gdk_cairo_region(context, renderRegion); @@ -268,14 +271,14 @@ static void drawGlyphsShadow(GraphicsContext* graphicsContext, cairo_t* context, void Font::drawComplexText(GraphicsContext* context, const TextRun& run, const FloatPoint& point, int from, int to) const { -#if defined(USE_FREETYPE) +#if USE(FREETYPE) if (!primaryFont()->platformData().m_pattern) { drawSimpleText(context, run, point, from, to); return; } #endif - cairo_t* cr = context->platformContext(); + cairo_t* cr = context->platformContext()->cr(); PangoLayout* layout = pango_cairo_create_layout(cr); setPangoAttributes(this, run, layout); @@ -294,7 +297,7 @@ void Font::drawComplexText(GraphicsContext* context, const TextRun& run, const F int ranges[] = {start - utf8, end - utf8}; partialRegion = gdk_pango_layout_line_get_clip_region(layoutLine, 0, 0, ranges, 1); - drawGlyphsShadow(context, cr, point, layoutLine, partialRegion); + drawGlyphsShadow(context, point, layoutLine, partialRegion); cairo_save(cr); cairo_translate(cr, point.x(), point.y()); @@ -348,7 +351,7 @@ static PangoLayout* getDefaultPangoLayout(const TextRun& run) float Font::floatWidthForComplexText(const TextRun& run, HashSet<const SimpleFontData*>* fallbackFonts, GlyphOverflow* overflow) const { -#if defined(USE_FREETYPE) +#if USE(FREETYPE) if (!primaryFont()->platformData().m_pattern) return floatWidthForSimpleText(run, 0, fallbackFonts, overflow); #endif @@ -373,7 +376,7 @@ float Font::floatWidthForComplexText(const TextRun& run, HashSet<const SimpleFon int Font::offsetForPositionForComplexText(const TextRun& run, float xFloat, bool includePartialGlyphs) const { -#if defined(USE_FREETYPE) +#if USE(FREETYPE) if (!primaryFont()->platformData().m_pattern) return offsetForPositionForSimpleText(run, xFloat, includePartialGlyphs); #endif @@ -401,7 +404,7 @@ int Font::offsetForPositionForComplexText(const TextRun& run, float xFloat, bool FloatRect Font::selectionRectForComplexText(const TextRun& run, const FloatPoint& point, int h, int from, int to) const { -#if defined(USE_FREETYPE) +#if USE(FREETYPE) if (!primaryFont()->platformData().m_pattern) return selectionRectForSimpleText(run, point, h, from, to); #endif |