| 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 <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 typedef struct _GdkColor GdkColor; | 10 typedef struct _GdkColor GdkColor; |
| 11 typedef struct _GdkPixbuf GdkPixbuf; | 11 typedef struct _GdkPixbuf GdkPixbuf; |
| 12 typedef struct _GdkRegion GdkRegion; | 12 typedef struct _GdkRegion GdkRegion; |
| 13 typedef struct _GtkWidget GtkWidget; | 13 typedef struct _GtkWidget GtkWidget; |
| 14 class SkBitmap; | 14 class SkBitmap; |
| 15 | 15 |
| 16 // Define a macro for creating GdkColors from RGB values. This is a macro to | 16 // Define a macro for creating GdkColors from RGB values. This is a macro to |
| 17 // allow static construction of literals, etc. Use this like: | 17 // allow static construction of literals, etc. Use this like: |
| 18 // GdkColor white = GDK_COLOR_RGB(0xff, 0xff, 0xff); | 18 // GdkColor white = GDK_COLOR_RGB(0xff, 0xff, 0xff); |
| 19 #define GDK_COLOR_RGB(r, g, b) {0, r * 257, g * 257, b * 257} | 19 #define GDK_COLOR_RGB(r, g, b) {0, r * 257, g * 257, b * 257} |
| 20 | 20 |
| 21 namespace gfx { | 21 namespace gfx { |
| 22 | 22 |
| 23 class Rect; | 23 class Rect; |
| 24 | 24 |
| 25 extern const GdkColor kGdkWhite; | 25 extern const GdkColor kGdkWhite; |
| 26 extern const GdkColor kGdkBlack; | 26 extern const GdkColor kGdkBlack; |
| 27 // Not const so users can allocate it against the system colormap. |
| 28 extern GdkColor kGdkSeafoamGreen; |
| 27 | 29 |
| 28 // Modify the given region by subtracting the given rectangles. | 30 // Modify the given region by subtracting the given rectangles. |
| 29 void SubtractRectanglesFromRegion(GdkRegion* region, | 31 void SubtractRectanglesFromRegion(GdkRegion* region, |
| 30 const std::vector<Rect>& cutouts); | 32 const std::vector<Rect>& cutouts); |
| 31 | 33 |
| 32 // Convert and copy a SkBitmap to a GdkPixbuf. NOTE: This is an expensive | 34 // Convert and copy a SkBitmap to a GdkPixbuf. NOTE: This is an expensive |
| 33 // operation, all of the pixels must be copied and their order swapped. | 35 // operation, all of the pixels must be copied and their order swapped. |
| 34 GdkPixbuf* GdkPixbufFromSkBitmap(const SkBitmap* bitmap); | 36 GdkPixbuf* GdkPixbufFromSkBitmap(const SkBitmap* bitmap); |
| 35 | 37 |
| 36 // Create a GtkBin with |child| as its child widget. This bin will paint a | 38 // Create a GtkBin with |child| as its child widget. This bin will paint a |
| 37 // border of color |color| with the sizes specified in pixels. | 39 // border of color |color| with the sizes specified in pixels. |
| 38 GtkWidget* CreateGtkBorderBin(GtkWidget* child, const GdkColor* color, | 40 GtkWidget* CreateGtkBorderBin(GtkWidget* child, const GdkColor* color, |
| 39 int top, int bottom, int left, int right); | 41 int top, int bottom, int left, int right); |
| 40 | 42 |
| 41 } // namespace gfx | 43 } // namespace gfx |
| 42 | 44 |
| 43 #endif // BASE_GFX_GTK_UTIL_H_ | 45 #endif // BASE_GFX_GTK_UTIL_H_ |
| OLD | NEW |