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

Side by Side Diff: ui/gfx/skia_utils_gtk.cc

Issue 8586044: GTK: Make the gtk port compile with GTK_DISABLE_SINGLE_INCLUDES. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Remove views/. Not our problem for gtk3 porting. Created 9 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
« no previous file with comments | « ui/gfx/insets.h ('k') | webkit/tools/test_shell/test_webview_delegate.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 #include "ui/gfx/skia_utils_gtk.h" 5 #include "ui/gfx/skia_utils_gtk.h"
6 6
7 #include <gdk/gdkcolor.h> 7 #include <gdk/gdk.h>
8 8
9 namespace gfx { 9 namespace gfx {
10 10
11 const int kSkiaToGDKMultiplier = 257; 11 const int kSkiaToGDKMultiplier = 257;
12 12
13 // GDK_COLOR_RGB multiplies by 257 (= 0x10001) to distribute the bits evenly 13 // GDK_COLOR_RGB multiplies by 257 (= 0x10001) to distribute the bits evenly
14 // See: http://www.mindcontrol.org/~hplus/graphics/expand-bits.html 14 // See: http://www.mindcontrol.org/~hplus/graphics/expand-bits.html
15 // To get back, we can just right shift by eight 15 // To get back, we can just right shift by eight
16 // (or, formulated differently, i == (i*257)/256 for all i < 256). 16 // (or, formulated differently, i == (i*257)/256 for all i < 256).
17 17
18 SkColor GdkColorToSkColor(GdkColor color) { 18 SkColor GdkColorToSkColor(GdkColor color) {
19 return SkColorSetRGB(color.red >> 8, color.green >> 8, color.blue >> 8); 19 return SkColorSetRGB(color.red >> 8, color.green >> 8, color.blue >> 8);
20 } 20 }
21 21
22 GdkColor SkColorToGdkColor(SkColor color) { 22 GdkColor SkColorToGdkColor(SkColor color) {
23 GdkColor gdk_color = { 23 GdkColor gdk_color = {
24 0, 24 0,
25 SkColorGetR(color) * kSkiaToGDKMultiplier, 25 SkColorGetR(color) * kSkiaToGDKMultiplier,
26 SkColorGetG(color) * kSkiaToGDKMultiplier, 26 SkColorGetG(color) * kSkiaToGDKMultiplier,
27 SkColorGetB(color) * kSkiaToGDKMultiplier 27 SkColorGetB(color) * kSkiaToGDKMultiplier
28 }; 28 };
29 return gdk_color; 29 return gdk_color;
30 } 30 }
31 31
32 } // namespace gfx 32 } // namespace gfx
OLDNEW
« no previous file with comments | « ui/gfx/insets.h ('k') | webkit/tools/test_shell/test_webview_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698