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

Side by Side Diff: chrome/browser/ui/libgtkui/skia_utils_gtk.h

Issue 2453243002: Gtk3 UI: Rename files in libgtkui containing gtk2 in their name (Closed)
Patch Set: Fix git cl format mistake Created 4 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
OLDNEW
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 CHROME_BROWSER_UI_LIBGTKUI_SKIA_UTILS_GTK2_H_ 5 #ifndef CHROME_BROWSER_UI_LIBGTKUI_SKIA_UTILS_GTK_H_
6 #define CHROME_BROWSER_UI_LIBGTKUI_SKIA_UTILS_GTK2_H_ 6 #define CHROME_BROWSER_UI_LIBGTKUI_SKIA_UTILS_GTK_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include "third_party/skia/include/core/SkColor.h" 10 #include "third_party/skia/include/core/SkColor.h"
11 11
12 typedef struct _GdkColor GdkColor; 12 typedef struct _GdkColor GdkColor;
13 typedef struct _GdkPixbuf GdkPixbuf; 13 typedef struct _GdkPixbuf GdkPixbuf;
14 14
15 class SkBitmap; 15 class SkBitmap;
16 16
17 // Define a macro for creating GdkColors from RGB values. This is a macro to 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: 18 // allow static construction of literals, etc. Use this like:
19 // GdkColor white = GDK_COLOR_RGB(0xff, 0xff, 0xff); 19 // GdkColor white = GDK_COLOR_RGB(0xff, 0xff, 0xff);
20 #define GDK_COLOR_RGB(r, g, b) {0, r * ::libgtkui::kSkiaToGDKMultiplier, \ 20 #define GDK_COLOR_RGB(r, g, b) \
21 g * ::libgtkui::kSkiaToGDKMultiplier, \ 21 { \
22 b * ::libgtkui::kSkiaToGDKMultiplier} 22 0, \
23 r * ::libgtkui::kSkiaToGDKMultiplier, \
24 g * ::libgtkui::kSkiaToGDKMultiplier, \
25 b * ::libgtkui::kSkiaToGDKMultiplier, \
26 }
23 27
24 namespace libgtkui { 28 namespace libgtkui {
25 29
26 // Multiply uint8_t color components by this. 30 // Multiply uint8_t color components by this.
27 const int kSkiaToGDKMultiplier = 257; 31 const int kSkiaToGDKMultiplier = 257;
28 32
29 // Converts GdkColors to the ARGB layout Skia expects. 33 // Converts GdkColors to the ARGB layout Skia expects.
30 SkColor GdkColorToSkColor(GdkColor color); 34 SkColor GdkColorToSkColor(GdkColor color);
31 35
32 // Converts ARGB to GdkColor. 36 // Converts ARGB to GdkColor.
33 GdkColor SkColorToGdkColor(SkColor color); 37 GdkColor SkColorToGdkColor(SkColor color);
34 38
35 const SkBitmap GdkPixbufToImageSkia(GdkPixbuf* pixbuf); 39 const SkBitmap GdkPixbufToImageSkia(GdkPixbuf* pixbuf);
36 40
37 // Convert and copy a SkBitmap to a GdkPixbuf. NOTE: this uses BGRAToRGBA, so 41 // 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 42 // 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. 43 // 1, and the caller is responsible for unrefing it when done.
40 GdkPixbuf* GdkPixbufFromSkBitmap(const SkBitmap& bitmap); 44 GdkPixbuf* GdkPixbufFromSkBitmap(const SkBitmap& bitmap);
41 45
42 } // namespace libgtkui 46 } // namespace libgtkui
43 47
44 #endif // CHROME_BROWSER_UI_LIBGTKUI_SKIA_UTILS_GTK2_H_ 48 #endif // CHROME_BROWSER_UI_LIBGTKUI_SKIA_UTILS_GTK_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/libgtkui/select_file_dialog_interactive_uitest.cc ('k') | chrome/browser/ui/libgtkui/skia_utils_gtk.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698