summaryrefslogtreecommitdiffstats
path: root/skia/ext/skia_utils_gtk.cc
blob: 7989019c6fcccd8456654ce97a1c906630ccb817 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
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