OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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 UI_GFX_GTK_UTIL_H_ | 5 #ifndef UI_GFX_GTK_UTIL_H_ |
6 #define UI_GFX_GTK_UTIL_H_ | 6 #define UI_GFX_GTK_UTIL_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
11 #include "ui/gfx/gfx_export.h" | 11 #include "ui/gfx/gfx_export.h" |
12 | 12 |
13 typedef struct _GdkPixbuf GdkPixbuf; | 13 typedef struct _GdkPixbuf GdkPixbuf; |
14 typedef struct _GdkRegion GdkRegion; | 14 typedef struct _GdkRegion GdkRegion; |
15 typedef struct _GdkCursor GdkCursor; | 15 typedef struct _GdkCursor GdkCursor; |
16 | 16 |
| 17 class SkBitmap; |
| 18 |
| 19 namespace base { |
17 class CommandLine; | 20 class CommandLine; |
18 class SkBitmap; | 21 } |
19 | 22 |
20 namespace gfx { | 23 namespace gfx { |
21 | 24 |
22 class Rect; | 25 class Rect; |
23 | 26 |
24 // Call gtk_init() / gdk_init() using the argc and argv from command_line. | 27 // Call gtk_init() / gdk_init() using the argc and argv from command_line. |
25 // These init functions want an argc and argv that they can mutate; we provide | 28 // These init functions want an argc and argv that they can mutate; we provide |
26 // those, but leave the original CommandLine unaltered. | 29 // those, but leave the original CommandLine unaltered. |
27 GFX_EXPORT void GtkInitFromCommandLine(const CommandLine& command_line); | 30 GFX_EXPORT void GtkInitFromCommandLine(const base::CommandLine& command_line); |
28 GFX_EXPORT void GdkInitFromCommandLine(const CommandLine& command_line); | 31 GFX_EXPORT void GdkInitFromCommandLine(const base::CommandLine& command_line); |
29 | 32 |
30 // Convert and copy a SkBitmap to a GdkPixbuf. NOTE: this uses BGRAToRGBA, so | 33 // Convert and copy a SkBitmap to a GdkPixbuf. NOTE: this uses BGRAToRGBA, so |
31 // it is an expensive operation. The returned GdkPixbuf will have a refcount of | 34 // it is an expensive operation. The returned GdkPixbuf will have a refcount of |
32 // 1, and the caller is responsible for unrefing it when done. | 35 // 1, and the caller is responsible for unrefing it when done. |
33 GFX_EXPORT GdkPixbuf* GdkPixbufFromSkBitmap(const SkBitmap& bitmap); | 36 GFX_EXPORT GdkPixbuf* GdkPixbufFromSkBitmap(const SkBitmap& bitmap); |
34 | 37 |
35 // Modify the given region by subtracting the given rectangles. | 38 // Modify the given region by subtracting the given rectangles. |
36 GFX_EXPORT void SubtractRectanglesFromRegion(GdkRegion* region, | 39 GFX_EXPORT void SubtractRectanglesFromRegion(GdkRegion* region, |
37 const std::vector<Rect>& cutouts); | 40 const std::vector<Rect>& cutouts); |
38 | 41 |
39 // Returns a static instance of a GdkCursor* object, sharable across the | 42 // Returns a static instance of a GdkCursor* object, sharable across the |
40 // process. Caller must gdk_cursor_ref() it if they want to assume ownership. | 43 // process. Caller must gdk_cursor_ref() it if they want to assume ownership. |
41 GFX_EXPORT GdkCursor* GetCursor(int type); | 44 GFX_EXPORT GdkCursor* GetCursor(int type); |
42 | 45 |
43 // Initialize some GTK settings so that our dialogs are consistent. | 46 // Initialize some GTK settings so that our dialogs are consistent. |
44 GFX_EXPORT void InitRCStyles(); | 47 GFX_EXPORT void InitRCStyles(); |
45 | 48 |
46 // Queries GtkSettings for the cursor blink cycle time. Returns a 0 duration if | 49 // Queries GtkSettings for the cursor blink cycle time. Returns a 0 duration if |
47 // blinking is disabled. | 50 // blinking is disabled. |
48 GFX_EXPORT base::TimeDelta GetCursorBlinkCycle(); | 51 GFX_EXPORT base::TimeDelta GetCursorBlinkCycle(); |
49 | 52 |
50 } // namespace gfx | 53 } // namespace gfx |
51 | 54 |
52 #endif // UI_GFX_GTK_UTIL_H_ | 55 #endif // UI_GFX_GTK_UTIL_H_ |
OLD | NEW |