summaryrefslogtreecommitdiffstats
path: root/views/background.cc
diff options
context:
space:
mode:
authorpkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-09-25 16:49:26 +0000
committerpkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-09-25 16:49:26 +0000
commit28065f66296d0d012aa5b02c147f4f77ef8a771e (patch)
tree9fc2567cd9a4edaf09a322e2465b8540787c118c /views/background.cc
parent120e1f1b2728ae5d1d4fed21bddb3533b921fdba (diff)
downloadchromium_src-28065f66296d0d012aa5b02c147f4f77ef8a771e.zip
chromium_src-28065f66296d0d012aa5b02c147f4f77ef8a771e.tar.gz
chromium_src-28065f66296d0d012aa5b02c147f4f77ef8a771e.tar.bz2
Use the system WINDOWTEXT color for labels, instead of black. Also use the system WINDOW color for InfoBubbles, not white. Several places are made to explicitly use black labels where that's correct or respecting system colors is a non-trivial fix (bugs filed for most).
Also, apparently I didn't get all my cleanup changes in the last patch, oops. BUG=92,21027 TEST=Set theme to high-contrast black on white, check that most pieces of chrome UI have readable text Review URL: http://codereview.chromium.org/237005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@27196 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views/background.cc')
-rw-r--r--views/background.cc31
1 files changed, 14 insertions, 17 deletions
diff --git a/views/background.cc b/views/background.cc
index 5206349..333b011 100644
--- a/views/background.cc
+++ b/views/background.cc
@@ -1,10 +1,11 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// Copyright (c) 2009 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "views/background.h"
#include "app/gfx/canvas.h"
+#include "app/gfx/color_utils.h"
#include "base/logging.h"
#include "skia/ext/skia_utils_win.h"
#include "third_party/skia/include/core/SkPaint.h"
@@ -17,21 +18,18 @@ namespace views {
// background in a solid color.
class SolidBackground : public Background {
public:
- explicit SolidBackground(const SkColor& color) :
- color_(color) {
- SetNativeControlColor(color_);
+ explicit SolidBackground(const SkColor& color) {
+ SetNativeControlColor(color);
}
void Paint(gfx::Canvas* canvas, View* view) const {
// Fill the background. Note that we don't constrain to the bounds as
// canvas is already clipped for us.
- canvas->drawColor(color_);
+ canvas->drawColor(get_color());
}
private:
- const SkColor color_;
-
- DISALLOW_EVIL_CONSTRUCTORS(SolidBackground);
+ DISALLOW_COPY_AND_ASSIGN(SolidBackground);
};
class BackgroundPainter : public Background {
@@ -56,12 +54,13 @@ class BackgroundPainter : public Background {
bool owns_painter_;
Painter* painter_;
- DISALLOW_EVIL_CONSTRUCTORS(BackgroundPainter);
+ DISALLOW_COPY_AND_ASSIGN(BackgroundPainter);
};
Background::Background()
+ : color_(SK_ColorWHITE)
#if defined(OS_WIN)
- : native_control_brush_(NULL)
+ , native_control_brush_(NULL)
#endif
{
}
@@ -73,6 +72,7 @@ Background::~Background() {
}
void Background::SetNativeControlColor(SkColor color) {
+ color_ = color;
#if defined(OS_WIN)
DeleteObject(native_control_brush_);
native_control_brush_ = CreateSolidBrush(skia::SkColorToCOLORREF(color));
@@ -93,13 +93,10 @@ Background* Background::CreateStandardPanelBackground() {
//static
Background* Background::CreateVerticalGradientBackground(
const SkColor& color1, const SkColor& color2) {
- Background *background =
- CreateBackgroundPainter(true, Painter::CreateVerticalGradient(color1,
- color2));
- background->SetNativeControlColor( // 50% blend of colors 1 & 2
- SkColorSetRGB((SkColorGetR(color1) + SkColorGetR(color2)) / 2,
- (SkColorGetG(color1) + SkColorGetG(color2)) / 2,
- (SkColorGetB(color1) + SkColorGetB(color2)) / 2));
+ Background* background = CreateBackgroundPainter(
+ true, Painter::CreateVerticalGradient(color1, color2));
+ background->SetNativeControlColor(
+ color_utils::AlphaBlend(color1, color2, 128));
return background;
}