summaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
authortfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-07 23:39:06 +0000
committertfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-07 23:39:06 +0000
commitd0da02d6602c55147baed1612540c07369a8d5ae (patch)
tree1623bc93f1c02dec68ca28c23ef162541bc9422d /ui
parentfa00fe8a856b2bb37fa28875313f8b1de6f905fb (diff)
downloadchromium_src-d0da02d6602c55147baed1612540c07369a8d5ae.zip
chromium_src-d0da02d6602c55147baed1612540c07369a8d5ae.tar.gz
chromium_src-d0da02d6602c55147baed1612540c07369a8d5ae.tar.bz2
ui/gfx: Move pango related functions to pango_util.{h,cc}.
R=xji@chromium.org Review URL: https://chromiumcodereview.appspot.com/9554016 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@125495 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui')
-rw-r--r--ui/gfx/gtk_util.cc8
-rw-r--r--ui/gfx/linux_util.cc21
-rw-r--r--ui/gfx/linux_util.h9
-rw-r--r--ui/gfx/pango_util.cc22
-rw-r--r--ui/gfx/pango_util.h11
5 files changed, 32 insertions, 39 deletions
diff --git a/ui/gfx/gtk_util.cc b/ui/gfx/gtk_util.cc
index b1f0dd7..9a2d986 100644
--- a/ui/gfx/gtk_util.cc
+++ b/ui/gfx/gtk_util.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -141,12 +141,6 @@ GdkCursor* GetCursor(int type) {
return impl.GetCursorImpl(static_cast<GdkCursorType>(type));
}
-#if !defined(USE_WAYLAND) && !defined(USE_AURA)
-PangoContext* GetPangoContext() {
- return gdk_pango_context_get();
-}
-#endif
-
void InitRCStyles() {
static const char kRCText[] =
// Make our dialogs styled like the GNOME HIG.
diff --git a/ui/gfx/linux_util.cc b/ui/gfx/linux_util.cc
index 284cd96..7e2e2ff 100644
--- a/ui/gfx/linux_util.cc
+++ b/ui/gfx/linux_util.cc
@@ -4,8 +4,6 @@
#include "ui/gfx/linux_util.h"
-#include <pango/pango.h>
-#include <pango/pangocairo.h>
#include <stdlib.h>
#include "base/basictypes.h"
@@ -51,25 +49,6 @@ std::string ConvertAmpersandsTo(const std::string& label,
namespace gfx {
-#if defined(USE_WAYLAND) || defined(USE_AURA)
-PangoContext* GetPangoContext() {
- PangoFontMap* font_map = pango_cairo_font_map_get_default();
- return pango_font_map_create_context(font_map);
-}
-#endif
-
-double GetPangoResolution() {
- static double resolution;
- static bool determined_resolution = false;
- if (!determined_resolution) {
- determined_resolution = true;
- PangoContext* default_context = GetPangoContext();
- resolution = pango_cairo_context_get_resolution(default_context);
- g_object_unref(default_context);
- }
- return resolution;
-}
-
std::string ConvertAcceleratorsFromWindowsStyle(const std::string& label) {
return ConvertAmpersandsTo(label, "_");
}
diff --git a/ui/gfx/linux_util.h b/ui/gfx/linux_util.h
index 3d61d07..4d5b10a 100644
--- a/ui/gfx/linux_util.h
+++ b/ui/gfx/linux_util.h
@@ -12,17 +12,8 @@
#include "ui/base/ui_export.h"
-typedef struct _PangoContext PangoContext;
-
namespace gfx {
-// Creates and returns a PangoContext. The caller owns the context.
-PangoContext* GetPangoContext();
-
-// Returns the resolution (DPI) used by pango. A negative values means the
-// resolution hasn't been set.
-double GetPangoResolution();
-
// Change windows accelerator style to GTK style. (GTK uses _ for
// accelerators. Windows uses & with && as an escape for &.)
UI_EXPORT std::string ConvertAcceleratorsFromWindowsStyle(
diff --git a/ui/gfx/pango_util.cc b/ui/gfx/pango_util.cc
index 6ef6720..461d451 100644
--- a/ui/gfx/pango_util.cc
+++ b/ui/gfx/pango_util.cc
@@ -16,6 +16,7 @@
#include "ui/gfx/rect.h"
#if !defined(USE_WAYLAND) && defined(TOOLKIT_USES_GTK)
+#include <gdk/gdk.h>
#include <gtk/gtk.h>
#include "ui/gfx/gtk_util.h"
#else
@@ -145,6 +146,27 @@ float GetPixelsInPoint() {
namespace gfx {
+PangoContext* GetPangoContext() {
+#if defined(USE_WAYLAND) || defined(USE_AURA)
+ PangoFontMap* font_map = pango_cairo_font_map_get_default();
+ return pango_font_map_create_context(font_map);
+#else
+ return gdk_pango_context_get();
+#endif
+}
+
+double GetPangoResolution() {
+ static double resolution;
+ static bool determined_resolution = false;
+ if (!determined_resolution) {
+ determined_resolution = true;
+ PangoContext* default_context = GetPangoContext();
+ resolution = pango_cairo_context_get_resolution(default_context);
+ g_object_unref(default_context);
+ }
+ return resolution;
+}
+
void DrawTextOntoCairoSurface(cairo_t* cr,
const string16& text,
const gfx::Font& font,
diff --git a/ui/gfx/pango_util.h b/ui/gfx/pango_util.h
index 544d21d..8466c3b 100644
--- a/ui/gfx/pango_util.h
+++ b/ui/gfx/pango_util.h
@@ -12,10 +12,10 @@
#include "base/i18n/rtl.h"
#include "base/string16.h"
-#include "ui/base/ui_export.h"
#include "third_party/skia/include/core/SkColor.h"
+#include "ui/base/ui_export.h"
-// TODO(xji): move other pango related functions from gtk_util to here.
+typedef struct _PangoContext PangoContext;
namespace gfx {
@@ -23,6 +23,13 @@ class Font;
class PlatformFontPango;
class Rect;
+// Creates and returns a PangoContext. The caller owns the context.
+PangoContext* GetPangoContext();
+
+// Returns the resolution (DPI) used by pango. A negative values means the
+// resolution hasn't been set.
+double GetPangoResolution();
+
// Uses Pango to draw text onto |cr|. This is the public method for d
void UI_EXPORT DrawTextOntoCairoSurface(cairo_t* cr,
const string16& text,