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

Side by Side Diff: chrome/browser/ui/libgtk2ui/skia_utils_gtk2.h

Issue 222613005: views: Fix linux omnibox colors by refactoring omnibox_result_view.cc. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix indentation on the table. Created 6 years, 8 months 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) 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_LIBGTK2UI_SKIA_UTILS_GTK2_H_ 5 #ifndef CHROME_BROWSER_UI_LIBGTK2UI_SKIA_UTILS_GTK2_H_
6 #define CHROME_BROWSER_UI_LIBGTK2UI_SKIA_UTILS_GTK2_H_ 6 #define CHROME_BROWSER_UI_LIBGTK2UI_SKIA_UTILS_GTK2_H_
7 7
8 #include "third_party/skia/include/core/SkColor.h" 8 #include "third_party/skia/include/core/SkColor.h"
9 9
10 typedef struct _GdkColor GdkColor; 10 typedef struct _GdkColor GdkColor;
11 typedef struct _GdkPixbuf GdkPixbuf; 11 typedef struct _GdkPixbuf GdkPixbuf;
12 12
13 class SkBitmap; 13 class SkBitmap;
14 14
15 // Define a macro for creating GdkColors from RGB values. This is a macro to
16 // allow static construction of literals, etc. Use this like:
17 // GdkColor white = GDK_COLOR_RGB(0xff, 0xff, 0xff);
18 #define GDK_COLOR_RGB(r, g, b) {0, r * ::libgtk2ui::kSkiaToGDKMultiplier, \
19 g * ::libgtk2ui::kSkiaToGDKMultiplier, \
20 b * ::libgtk2ui::kSkiaToGDKMultiplier}
21
15 namespace libgtk2ui { 22 namespace libgtk2ui {
16 23
24 // Multiply uint8 color components by this.
25 const int kSkiaToGDKMultiplier = 257;
26
17 // Converts GdkColors to the ARGB layout Skia expects. 27 // Converts GdkColors to the ARGB layout Skia expects.
18 SkColor GdkColorToSkColor(GdkColor color); 28 SkColor GdkColorToSkColor(GdkColor color);
19 29
20 // Converts ARGB to GdkColor. 30 // Converts ARGB to GdkColor.
21 GdkColor SkColorToGdkColor(SkColor color); 31 GdkColor SkColorToGdkColor(SkColor color);
22 32
23 const SkBitmap GdkPixbufToImageSkia(GdkPixbuf* pixbuf); 33 const SkBitmap GdkPixbufToImageSkia(GdkPixbuf* pixbuf);
24 34
25 // Convert and copy a SkBitmap to a GdkPixbuf. NOTE: this uses BGRAToRGBA, so 35 // Convert and copy a SkBitmap to a GdkPixbuf. NOTE: this uses BGRAToRGBA, so
26 // it is an expensive operation. The returned GdkPixbuf will have a refcount of 36 // it is an expensive operation. The returned GdkPixbuf will have a refcount of
27 // 1, and the caller is responsible for unrefing it when done. 37 // 1, and the caller is responsible for unrefing it when done.
28 GdkPixbuf* GdkPixbufFromSkBitmap(const SkBitmap& bitmap); 38 GdkPixbuf* GdkPixbufFromSkBitmap(const SkBitmap& bitmap);
29 39
30 } // namespace libgtk2ui 40 } // namespace libgtk2ui
31 41
32 #endif // CHROME_BROWSER_UI_LIBGTK2UI_SKIA_UTILS_GTK2_H_ 42 #endif // CHROME_BROWSER_UI_LIBGTK2UI_SKIA_UTILS_GTK2_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698