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

Side by Side Diff: chrome/browser/views/theme_helpers.cc

Issue 2862025: Canvas refactoring part 2.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 10 years, 6 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
« no previous file with comments | « chrome/browser/views/tabs/tab.cc ('k') | chrome/browser/views/toolbar_view.cc » ('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) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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/views/theme_helpers.h" 5 #include "chrome/browser/views/theme_helpers.h"
6 6
7 #include <atlbase.h> 7 #include <atlbase.h>
8 #include <atlapp.h> 8 #include <atlapp.h>
9 #include <atltheme.h> 9 #include <atltheme.h>
10 10
11 #include "base/logging.h" 11 #include "base/logging.h"
12 #include "gfx/canvas.h" 12 #include "gfx/canvas_skia.h"
13 #include "skia/ext/bitmap_platform_device_win.h" 13 #include "skia/ext/bitmap_platform_device_win.h"
14 #include "third_party/skia/include/effects/SkGradientShader.h" 14 #include "third_party/skia/include/effects/SkGradientShader.h"
15 15
16 void GetRebarGradientColors(int width, int x1, int x2, 16 void GetRebarGradientColors(int width, int x1, int x2,
17 SkColor* c1, SkColor* c2) { 17 SkColor* c1, SkColor* c2) {
18 DCHECK(c1 && c2) << 18 DCHECK(c1 && c2) <<
19 "ThemeHelpers::GetRebarGradientColors - c1 or c2 is NULL!"; 19 "ThemeHelpers::GetRebarGradientColors - c1 or c2 is NULL!";
20 20
21 // To get the colors we need, we draw a horizontal gradient using 21 // To get the colors we need, we draw a horizontal gradient using
22 // DrawThemeBackground, then extract the pixel values from and return 22 // DrawThemeBackground, then extract the pixel values from and return
23 // those so calling code can use them to create gradient brushes for use in 23 // those so calling code can use them to create gradient brushes for use in
24 // rendering in other directions. 24 // rendering in other directions.
25 25
26 gfx::Canvas canvas(width, 1, true); 26 gfx::CanvasSkia canvas(width, 1, true);
27 27
28 // Render the Rebar gradient into the DIB 28 // Render the Rebar gradient into the DIB
29 CTheme theme; 29 CTheme theme;
30 if (theme.IsThemingSupported()) 30 if (theme.IsThemingSupported())
31 theme.OpenThemeData(NULL, L"REBAR"); 31 theme.OpenThemeData(NULL, L"REBAR");
32 // On Windows XP+, if using a Theme, we can ask the theme to render the 32 // On Windows XP+, if using a Theme, we can ask the theme to render the
33 // gradient for us. 33 // gradient for us.
34 if (!theme.IsThemeNull()) { 34 if (!theme.IsThemeNull()) {
35 HDC dc = canvas.beginPlatformPaint(); 35 HDC dc = canvas.beginPlatformPaint();
36 RECT rect = { 0, 0, width, 1 }; 36 RECT rect = { 0, 0, width, 1 };
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 if (!theme.IsThemeNull()) { 83 if (!theme.IsThemeNull()) {
84 *dark_color = SkColorSetARGB(60, 0, 0, 0); 84 *dark_color = SkColorSetARGB(60, 0, 0, 0);
85 } else { 85 } else {
86 COLORREF shadow_ref = ::GetSysColor(COLOR_3DSHADOW); 86 COLORREF shadow_ref = ::GetSysColor(COLOR_3DSHADOW);
87 *dark_color = SkColorSetARGB(175, 87 *dark_color = SkColorSetARGB(175,
88 GetRValue(shadow_ref), 88 GetRValue(shadow_ref),
89 GetGValue(shadow_ref), 89 GetGValue(shadow_ref),
90 GetBValue(shadow_ref)); 90 GetBValue(shadow_ref));
91 } 91 }
92 } 92 }
OLDNEW
« no previous file with comments | « chrome/browser/views/tabs/tab.cc ('k') | chrome/browser/views/toolbar_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698