summaryrefslogtreecommitdiffstats
path: root/skia
diff options
context:
space:
mode:
authorjcampan@chromium.org <jcampan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-09-01 16:57:53 +0000
committerjcampan@chromium.org <jcampan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-09-01 16:57:53 +0000
commitb9e562e475b17f6c07a46de7afabdfa3164eafbf (patch)
tree4e83a5209bd2607113139c2c2356d9605be56132 /skia
parenta9b1f17f3ba502396dbc41d42a795d6672f8b750 (diff)
downloadchromium_src-b9e562e475b17f6c07a46de7afabdfa3164eafbf.zip
chromium_src-b9e562e475b17f6c07a46de7afabdfa3164eafbf.tar.gz
chromium_src-b9e562e475b17f6c07a46de7afabdfa3164eafbf.tar.bz2
Adding a skia utils for Gtk.
BUG=None TEST=None See original review: http://codereview.chromium.org/179048/show Review URL: http://codereview.chromium.org/177053 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@25042 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'skia')
-rw-r--r--skia/ext/skia_utils_gtk.cc27
-rw-r--r--skia/ext/skia_utils_gtk.h22
-rw-r--r--skia/skia.gyp4
3 files changed, 52 insertions, 1 deletions
diff --git a/skia/ext/skia_utils_gtk.cc b/skia/ext/skia_utils_gtk.cc
new file mode 100644
index 0000000..7989019
--- /dev/null
+++ b/skia/ext/skia_utils_gtk.cc
@@ -0,0 +1,27 @@
+// Copyright (c) 2009 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.
+
+#include "skia/ext/skia_utils_gtk.h"
+
+#include <gdk/gdkcolor.h>
+
+namespace skia {
+
+const int kSkiaToGDKMultiplier = 257;
+
+SkColor GdkColorToSkColor(GdkColor color) {
+ return SkColorSetRGB(color.red, color.green, color.blue);
+}
+
+GdkColor SkColorToGdkColor(SkColor color) {
+ GdkColor gdk_color = {
+ 0,
+ SkColorGetR(color) * kSkiaToGDKMultiplier,
+ SkColorGetG(color) * kSkiaToGDKMultiplier,
+ SkColorGetB(color) * kSkiaToGDKMultiplier
+ };
+ return gdk_color;
+}
+
+} // namespace
diff --git a/skia/ext/skia_utils_gtk.h b/skia/ext/skia_utils_gtk.h
new file mode 100644
index 0000000..c9e993d
--- /dev/null
+++ b/skia/ext/skia_utils_gtk.h
@@ -0,0 +1,22 @@
+// Copyright (c) 2009 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.
+
+#ifndef SKIA_EXT_SKIA_UTILS_GTK_H_
+#define SKIA_EXT_SKIA_UTILS_GTK_H_
+
+#include "third_party/skia/include/core/SkColor.h"
+
+typedef struct _GdkColor GdkColor;
+
+namespace skia {
+
+// Converts GdkColors to the ARGB layout Skia expects.
+SkColor GdkColorToSkColor(GdkColor color);
+
+// Converts ARGB to GdkColor.
+GdkColor SkColorToGdkColor(SkColor color);
+
+} // namespace skia
+
+#endif // SKIA_EXT_SKIA_UTILS_GTK_H_
diff --git a/skia/skia.gyp b/skia/skia.gyp
index 63cac887..f90bd28 100644
--- a/skia/skia.gyp
+++ b/skia/skia.gyp
@@ -525,6 +525,8 @@
'ext/SkMemory_new_handler.cpp',
'ext/skia_utils.cc',
'ext/skia_utils.h',
+ 'ext/skia_utils_gtk.cc',
+ 'ext/skia_utils_gtk.h',
'ext/skia_utils_mac.mm',
'ext/skia_utils_mac.h',
'ext/skia_utils_win.cc',
@@ -566,7 +568,7 @@
['exclude', '/mac/'] ],
}],
[ 'OS != "linux"', {
- 'sources/': [ ['exclude', '_linux\\.(cc|cpp)$'] ],
+ 'sources/': [ ['exclude', '_(linux|gtk)\\.(cc|cpp)$'] ],
'sources!': [
'../third_party/skia/src/ports/SkFontHost_FreeType.cpp',
'../third_party/skia/src/ports/SkFontHost_TryeType_Tables.cpp',