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

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

Issue 2449243002: Gtk3 ui: Add libgtk3ui as a separate build component (Closed)
Patch Set: Add theme_properties dep to //chrome/browser/ui 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 #include "chrome/browser/ui/libgtk2ui/skia_utils_gtk2.h" 5 #include "chrome/browser/ui/libgtkui/skia_utils_gtk2.h"
6 6
7 #include <gdk/gdk.h> 7 #include <gdk/gdk.h>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "third_party/skia/include/core/SkBitmap.h" 10 #include "third_party/skia/include/core/SkBitmap.h"
11 #include "third_party/skia/include/core/SkUnPreMultiply.h" 11 #include "third_party/skia/include/core/SkUnPreMultiply.h"
12 12
13 namespace libgtk2ui { 13 namespace libgtkui {
14 14
15 // GDK_COLOR_RGB multiplies by 257 (= 0x10001) to distribute the bits evenly 15 // GDK_COLOR_RGB multiplies by 257 (= 0x10001) to distribute the bits evenly
16 // See: http://www.mindcontrol.org/~hplus/graphics/expand-bits.html 16 // See: http://www.mindcontrol.org/~hplus/graphics/expand-bits.html
17 // To get back, we can just right shift by eight 17 // To get back, we can just right shift by eight
18 // (or, formulated differently, i == (i*257)/256 for all i < 256). 18 // (or, formulated differently, i == (i*257)/256 for all i < 256).
19 19
20 SkColor GdkColorToSkColor(GdkColor color) { 20 SkColor GdkColorToSkColor(GdkColor color) {
21 return SkColorSetRGB(color.red >> 8, color.green >> 8, color.blue >> 8); 21 return SkColorSetRGB(color.red >> 8, color.green >> 8, color.blue >> 8);
22 } 22 }
23 23
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 divided[i + 2] = SkColorGetB(pixel); 123 divided[i + 2] = SkColorGetB(pixel);
124 divided[i + 3] = alpha; 124 divided[i + 3] = alpha;
125 } 125 }
126 i += kBytesPerPixel; 126 i += kBytesPerPixel;
127 } 127 }
128 } 128 }
129 129
130 return pixbuf; 130 return pixbuf;
131 } 131 }
132 132
133 } // namespace libgtk2ui 133 } // namespace libgtkui
OLDNEW
« no previous file with comments | « chrome/browser/ui/libgtkui/skia_utils_gtk2.h ('k') | chrome/browser/ui/libgtkui/unity_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698