diff options
author | Steve Block <steveblock@google.com> | 2010-07-08 12:51:48 +0100 |
---|---|---|
committer | Steve Block <steveblock@google.com> | 2010-07-09 15:33:40 +0100 |
commit | ca9cb53ed1119a3fd98fafa0972ffeb56dee1c24 (patch) | |
tree | bb45155550ec013adc0ad10f4d7d354c6469b022 /WebCore/platform/graphics/gtk | |
parent | d4b24d9a829ed7de70381c8b99fb75a07ab40466 (diff) | |
download | external_webkit-ca9cb53ed1119a3fd98fafa0972ffeb56dee1c24.zip external_webkit-ca9cb53ed1119a3fd98fafa0972ffeb56dee1c24.tar.gz external_webkit-ca9cb53ed1119a3fd98fafa0972ffeb56dee1c24.tar.bz2 |
Merge WebKit at r62496: Initial merge by git
Change-Id: Ie3da0770eca22a70a632e3571f31cfabc80facb2
Diffstat (limited to 'WebCore/platform/graphics/gtk')
-rw-r--r-- | WebCore/platform/graphics/gtk/FontGtk.cpp | 37 |
1 files changed, 36 insertions, 1 deletions
diff --git a/WebCore/platform/graphics/gtk/FontGtk.cpp b/WebCore/platform/graphics/gtk/FontGtk.cpp index fae84cb..92f8816 100644 --- a/WebCore/platform/graphics/gtk/FontGtk.cpp +++ b/WebCore/platform/graphics/gtk/FontGtk.cpp @@ -181,6 +181,29 @@ bool Font::canReturnFallbackFontsForComplexText() return false; } +#ifndef GTK_API_VERSION_2 +static void cairo_region_shrink(cairo_region_t* region, int dx, int dy) +{ + int nRects = cairo_region_num_rectangles(region); + // Clear region. + cairo_region_subtract(region, region); + + for (int i = 0; i < nRects; i++) { + cairo_rectangle_int_t rect; + cairo_region_get_rectangle(region, i, &rect); + + if (rect.width <= 2 * dx || rect.height <= 2 * dy) + continue; + + rect.x += dx; + rect.y += dy; + rect.width -= 2 * dx; + rect.height -= 2 * dy; + cairo_region_union_rectangle(region, &rect); + } +} +#endif + void Font::drawComplexText(GraphicsContext* context, const TextRun& run, const FloatPoint& point, int from, int to) const { cairo_t* cr = context->platformContext(); @@ -196,14 +219,22 @@ void Font::drawComplexText(GraphicsContext* context, const TextRun& run, const F // Our layouts are single line PangoLayoutLine* layoutLine = pango_layout_get_line_readonly(layout, 0); - GdkRegion* partialRegion = NULL; +#ifdef GTK_API_VERSION_2 + GdkRegion* partialRegion = 0; +#else + cairo_region_t* partialRegion = 0; +#endif if (to - from != run.length()) { // Clip the region of the run to be rendered char* start = g_utf8_offset_to_pointer(utf8, from); char* end = g_utf8_offset_to_pointer(start, to - from); int ranges[] = {start - utf8, end - utf8}; partialRegion = gdk_pango_layout_line_get_clip_region(layoutLine, 0, 0, ranges, 1); +#ifdef GTK_API_VERSION_2 gdk_region_shrink(partialRegion, 0, -pixelSize()); +#else + cairo_region_shrink(partialRegion, 0, -pixelSize()); +#endif } Color fillColor = context->fillColor(); @@ -265,7 +296,11 @@ void Font::drawComplexText(GraphicsContext* context, const TextRun& run, const F cairo_new_path(cr); if (partialRegion) +#ifdef GTK_API_VERSION_2 gdk_region_destroy(partialRegion); +#else + cairo_region_destroy(partialRegion); +#endif g_free(utf8); g_object_unref(layout); |