Add new certificateProvider extension API.
[chromium-blink-merge.git] / chrome / browser / ui / libgtk2ui / skia_utils_gtk2.h
blob4a39514e8d72d3d6a55b4b50af7e00452ec174c7
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_UI_LIBGTK2UI_SKIA_UTILS_GTK2_H_
6 #define CHROME_BROWSER_UI_LIBGTK2UI_SKIA_UTILS_GTK2_H_
8 #include "third_party/skia/include/core/SkColor.h"
10 typedef struct _GdkColor GdkColor;
11 typedef struct _GdkPixbuf GdkPixbuf;
13 class SkBitmap;
15 // Define a macro for creating GdkColors from RGB values. This is a macro to
16 // allow static construction of literals, etc. Use this like:
17 // GdkColor white = GDK_COLOR_RGB(0xff, 0xff, 0xff);
18 #define GDK_COLOR_RGB(r, g, b) {0, r * ::libgtk2ui::kSkiaToGDKMultiplier, \
19 g * ::libgtk2ui::kSkiaToGDKMultiplier, \
20 b * ::libgtk2ui::kSkiaToGDKMultiplier}
22 namespace libgtk2ui {
24 // Multiply uint8 color components by this.
25 const int kSkiaToGDKMultiplier = 257;
27 // Converts GdkColors to the ARGB layout Skia expects.
28 SkColor GdkColorToSkColor(GdkColor color);
30 // Converts ARGB to GdkColor.
31 GdkColor SkColorToGdkColor(SkColor color);
33 const SkBitmap GdkPixbufToImageSkia(GdkPixbuf* pixbuf);
35 // Convert and copy a SkBitmap to a GdkPixbuf. NOTE: this uses BGRAToRGBA, so
36 // it is an expensive operation. The returned GdkPixbuf will have a refcount of
37 // 1, and the caller is responsible for unrefing it when done.
38 GdkPixbuf* GdkPixbufFromSkBitmap(const SkBitmap& bitmap);
40 } // namespace libgtk2ui
42 #endif // CHROME_BROWSER_UI_LIBGTK2UI_SKIA_UTILS_GTK2_H_