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

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

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: Move table out of method so arraysize() works. 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 #include "chrome/browser/ui/libgtk2ui/skia_utils_gtk2.h" 5 #include "chrome/browser/ui/libgtk2ui/skia_utils_gtk2.h"
6 6
7 #include <gdk/gdk.h> 7 #include <gdk/gdk.h>
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
11 #include "third_party/skia/include/core/SkBitmap.h" 11 #include "third_party/skia/include/core/SkBitmap.h"
12 #include "third_party/skia/include/core/SkUnPreMultiply.h" 12 #include "third_party/skia/include/core/SkUnPreMultiply.h"
13 13
14 namespace libgtk2ui { 14 namespace libgtk2ui {
15 15
16 const int kSkiaToGDKMultiplier = 257;
17
18 // GDK_COLOR_RGB multiplies by 257 (= 0x10001) to distribute the bits evenly 16 // GDK_COLOR_RGB multiplies by 257 (= 0x10001) to distribute the bits evenly
19 // See: http://www.mindcontrol.org/~hplus/graphics/expand-bits.html 17 // See: http://www.mindcontrol.org/~hplus/graphics/expand-bits.html
20 // To get back, we can just right shift by eight 18 // To get back, we can just right shift by eight
21 // (or, formulated differently, i == (i*257)/256 for all i < 256). 19 // (or, formulated differently, i == (i*257)/256 for all i < 256).
22 20
23 SkColor GdkColorToSkColor(GdkColor color) { 21 SkColor GdkColorToSkColor(GdkColor color) {
24 return SkColorSetRGB(color.red >> 8, color.green >> 8, color.blue >> 8); 22 return SkColorSetRGB(color.red >> 8, color.green >> 8, color.blue >> 8);
25 } 23 }
26 24
27 GdkColor SkColorToGdkColor(SkColor color) { 25 GdkColor SkColorToGdkColor(SkColor color) {
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 divided[i + 3] = alpha; 126 divided[i + 3] = alpha;
129 } 127 }
130 i += kBytesPerPixel; 128 i += kBytesPerPixel;
131 } 129 }
132 } 130 }
133 131
134 return pixbuf; 132 return pixbuf;
135 } 133 }
136 134
137 } // namespace libgtk2ui 135 } // namespace libgtk2ui
OLDNEW
« no previous file with comments | « chrome/browser/ui/libgtk2ui/skia_utils_gtk2.h ('k') | chrome/browser/ui/views/omnibox/omnibox_result_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698