| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef BASE_GFX_GTK_UTIL_H_ | 5 #ifndef BASE_GFX_GTK_UTIL_H_ |
| 6 #define BASE_GFX_GTK_UTIL_H_ | 6 #define BASE_GFX_GTK_UTIL_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include <glib-object.h> | 11 #include <glib-object.h> |
| 12 | 12 |
| 13 #include "base/scoped_ptr.h" | 13 #include "base/scoped_ptr.h" |
| 14 | 14 |
| 15 typedef struct _GdkColor GdkColor; | 15 typedef struct _GdkColor GdkColor; |
| 16 typedef struct _GdkPixbuf GdkPixbuf; | 16 typedef struct _GdkPixbuf GdkPixbuf; |
| 17 typedef struct _GdkRegion GdkRegion; | 17 typedef struct _GdkRegion GdkRegion; |
| 18 | 18 |
| 19 class SkBitmap; | 19 class SkBitmap; |
| 20 | 20 |
| 21 const int kSkiaToGDKMultiplier = 257; |
| 22 |
| 21 // Define a macro for creating GdkColors from RGB values. This is a macro to | 23 // Define a macro for creating GdkColors from RGB values. This is a macro to |
| 22 // allow static construction of literals, etc. Use this like: | 24 // allow static construction of literals, etc. Use this like: |
| 23 // GdkColor white = GDK_COLOR_RGB(0xff, 0xff, 0xff); | 25 // GdkColor white = GDK_COLOR_RGB(0xff, 0xff, 0xff); |
| 24 #define GDK_COLOR_RGB(r, g, b) {0, r * 257, g * 257, b * 257} | 26 #define GDK_COLOR_RGB(r, g, b) {0, r * kSkiaToGDKMultiplier, \ |
| 27 g * kSkiaToGDKMultiplier, b * kSkiaToGDKMultiplier} |
| 25 | 28 |
| 26 namespace gfx { | 29 namespace gfx { |
| 27 | 30 |
| 28 class Rect; | 31 class Rect; |
| 29 | 32 |
| 30 extern const GdkColor kGdkWhite; | 33 extern const GdkColor kGdkWhite; |
| 31 extern const GdkColor kGdkBlack; | 34 extern const GdkColor kGdkBlack; |
| 32 extern const GdkColor kGdkGreen; | 35 extern const GdkColor kGdkGreen; |
| 33 | 36 |
| 34 // Convert and copy a SkBitmap to a GdkPixbuf. NOTE: this uses BGRAToRGBA, so | 37 // Convert and copy a SkBitmap to a GdkPixbuf. NOTE: this uses BGRAToRGBA, so |
| (...skipping 20 matching lines...) Expand all Loading... |
| 55 | 58 |
| 56 // It's not legal C++ to have a templatized typedefs, so we wrap it in a | 59 // It's not legal C++ to have a templatized typedefs, so we wrap it in a |
| 57 // struct. When using this, you need to include ::Type. E.g., | 60 // struct. When using this, you need to include ::Type. E.g., |
| 58 // ScopedGObject<GdkPixbufLoader>::Type loader(gdk_pixbuf_loader_new()); | 61 // ScopedGObject<GdkPixbufLoader>::Type loader(gdk_pixbuf_loader_new()); |
| 59 template<class T> | 62 template<class T> |
| 60 struct ScopedGObject { | 63 struct ScopedGObject { |
| 61 typedef scoped_ptr_malloc<T, GObjectUnrefer<T> > Type; | 64 typedef scoped_ptr_malloc<T, GObjectUnrefer<T> > Type; |
| 62 }; | 65 }; |
| 63 | 66 |
| 64 #endif // BASE_GFX_GTK_UTIL_H_ | 67 #endif // BASE_GFX_GTK_UTIL_H_ |
| OLD | NEW |