| OLD | NEW |
| (Empty) |
| 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. | |
| 4 | |
| 5 #ifndef CHROME_BROWSER_UI_LIBGTK2UI_SKIA_UTILS_GTK2_H_ | |
| 6 #define CHROME_BROWSER_UI_LIBGTK2UI_SKIA_UTILS_GTK2_H_ | |
| 7 | |
| 8 #include <stdint.h> | |
| 9 | |
| 10 #include "third_party/skia/include/core/SkColor.h" | |
| 11 | |
| 12 typedef struct _GdkColor GdkColor; | |
| 13 typedef struct _GdkPixbuf GdkPixbuf; | |
| 14 | |
| 15 class SkBitmap; | |
| 16 | |
| 17 // Define a macro for creating GdkColors from RGB values. This is a macro to | |
| 18 // allow static construction of literals, etc. Use this like: | |
| 19 // GdkColor white = GDK_COLOR_RGB(0xff, 0xff, 0xff); | |
| 20 #define GDK_COLOR_RGB(r, g, b) {0, r * ::libgtk2ui::kSkiaToGDKMultiplier, \ | |
| 21 g * ::libgtk2ui::kSkiaToGDKMultiplier, \ | |
| 22 b * ::libgtk2ui::kSkiaToGDKMultiplier} | |
| 23 | |
| 24 namespace libgtk2ui { | |
| 25 | |
| 26 // Multiply uint8_t color components by this. | |
| 27 const int kSkiaToGDKMultiplier = 257; | |
| 28 | |
| 29 // Converts GdkColors to the ARGB layout Skia expects. | |
| 30 SkColor GdkColorToSkColor(GdkColor color); | |
| 31 | |
| 32 // Converts ARGB to GdkColor. | |
| 33 GdkColor SkColorToGdkColor(SkColor color); | |
| 34 | |
| 35 const SkBitmap GdkPixbufToImageSkia(GdkPixbuf* pixbuf); | |
| 36 | |
| 37 // Convert and copy a SkBitmap to a GdkPixbuf. NOTE: this uses BGRAToRGBA, so | |
| 38 // it is an expensive operation. The returned GdkPixbuf will have a refcount of | |
| 39 // 1, and the caller is responsible for unrefing it when done. | |
| 40 GdkPixbuf* GdkPixbufFromSkBitmap(const SkBitmap& bitmap); | |
| 41 | |
| 42 } // namespace libgtk2ui | |
| 43 | |
| 44 #endif // CHROME_BROWSER_UI_LIBGTK2UI_SKIA_UTILS_GTK2_H_ | |
| OLD | NEW |