Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(14)

Side by Side Diff: gfx/gtk_util.h

Issue 4508004: gtk: refactor copy-pasted code (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 10 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 GFX_GTK_UTIL_H_ 5 #ifndef GFX_GTK_UTIL_H_
6 #define GFX_GTK_UTIL_H_ 6 #define GFX_GTK_UTIL_H_
7 #pragma once 7 #pragma once
8 8
9 #include <glib-object.h> 9 #include <glib-object.h>
10 #include <stdint.h> 10 #include <stdint.h>
11 11
12 #include <string> 12 #include <string>
13 #include <vector> 13 #include <vector>
14 14
15 #include "base/scoped_ptr.h" 15 #include "base/scoped_ptr.h"
16 16
17 typedef struct _GdkPixbuf GdkPixbuf; 17 typedef struct _GdkPixbuf GdkPixbuf;
18 typedef struct _GdkRegion GdkRegion; 18 typedef struct _GdkRegion GdkRegion;
19 19
20 class CommandLine;
20 class SkBitmap; 21 class SkBitmap;
21 22
22 namespace gfx { 23 namespace gfx {
23 24
24 class Rect; 25 class Rect;
25 26
27 // Call gtk_init() using the argc and argv from command_line.
28 // gtk_init() wants an argc and argv that it can mutate; we provide those,
29 // but leave the original CommandLine unaltered.
30 void GtkInitFromCommandLine(const CommandLine& command_line);
31
26 // Convert and copy a SkBitmap to a GdkPixbuf. NOTE: this uses BGRAToRGBA, so 32 // Convert and copy a SkBitmap to a GdkPixbuf. NOTE: this uses BGRAToRGBA, so
27 // it is an expensive operation. The returned GdkPixbuf will have a refcount of 33 // it is an expensive operation. The returned GdkPixbuf will have a refcount of
28 // 1, and the caller is responsible for unrefing it when done. 34 // 1, and the caller is responsible for unrefing it when done.
29 GdkPixbuf* GdkPixbufFromSkBitmap(const SkBitmap* bitmap); 35 GdkPixbuf* GdkPixbufFromSkBitmap(const SkBitmap* bitmap);
30 36
31 // Modify the given region by subtracting the given rectangles. 37 // Modify the given region by subtracting the given rectangles.
32 void SubtractRectanglesFromRegion(GdkRegion* region, 38 void SubtractRectanglesFromRegion(GdkRegion* region,
33 const std::vector<Rect>& cutouts); 39 const std::vector<Rect>& cutouts);
34 40
35 // Returns the resolution (DPI) used by pango. A negative values means the 41 // Returns the resolution (DPI) used by pango. A negative values means the
(...skipping 28 matching lines...) Expand all
64 70
65 // It's not legal C++ to have a templatized typedefs, so we wrap it in a 71 // It's not legal C++ to have a templatized typedefs, so we wrap it in a
66 // struct. When using this, you need to include ::Type. E.g., 72 // struct. When using this, you need to include ::Type. E.g.,
67 // ScopedGObject<GdkPixbufLoader>::Type loader(gdk_pixbuf_loader_new()); 73 // ScopedGObject<GdkPixbufLoader>::Type loader(gdk_pixbuf_loader_new());
68 template<class T> 74 template<class T>
69 struct ScopedGObject { 75 struct ScopedGObject {
70 typedef scoped_ptr_malloc<T, GObjectUnrefer<T> > Type; 76 typedef scoped_ptr_malloc<T, GObjectUnrefer<T> > Type;
71 }; 77 };
72 78
73 #endif // GFX_GTK_UTIL_H_ 79 #endif // GFX_GTK_UTIL_H_
OLDNEW
« no previous file with comments | « chrome/plugin/plugin_thread.cc ('k') | gfx/gtk_util.cc » ('j') | gfx/gtk_util.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698