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

Side by Side Diff: ui/views/controls/button/label_button_border.cc

Issue 120823003: [Views] Only paint background of text portion of LabelButton in inverted color theme. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 6 years, 11 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 | « ui/views/controls/button/label_button.cc ('k') | no next file » | 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) 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 "ui/views/controls/button/label_button_border.h" 5 #include "ui/views/controls/button/label_button_border.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "grit/ui_resources.h" 8 #include "grit/ui_resources.h"
9 #include "third_party/skia/include/core/SkPaint.h" 9 #include "third_party/skia/include/core/SkPaint.h"
10 #include "third_party/skia/include/effects/SkLerpXfermode.h" 10 #include "third_party/skia/include/effects/SkLerpXfermode.h"
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 paint.setXfermode(sk_lerp_xfer.get()); 135 paint.setXfermode(sk_lerp_xfer.get());
136 canvas->sk_canvas()->saveLayer(&sk_rect, &paint); 136 canvas->sk_canvas()->saveLayer(&sk_rect, &paint);
137 state = native_theme_delegate->GetForegroundThemeState(&extra); 137 state = native_theme_delegate->GetForegroundThemeState(&extra);
138 PaintHelper(this, canvas, theme, part, state, rect, extra); 138 PaintHelper(this, canvas, theme, part, state, rect, extra);
139 canvas->sk_canvas()->restore(); 139 canvas->sk_canvas()->restore();
140 140
141 canvas->sk_canvas()->restore(); 141 canvas->sk_canvas()->restore();
142 } else { 142 } else {
143 PaintHelper(this, canvas, theme, part, state, rect, extra); 143 PaintHelper(this, canvas, theme, part, state, rect, extra);
144 } 144 }
145
146 // For inverted color schemes, draw a solid fill with the button color.
147 if (gfx::IsInvertedColorScheme()) {
148 rect.Inset(insets_);
149 canvas->FillRect(rect, extra.button.background_color);
150 }
151 } 145 }
152 146
153 gfx::Insets LabelButtonBorder::GetInsets() const { 147 gfx::Insets LabelButtonBorder::GetInsets() const {
154 return insets_; 148 return insets_;
155 } 149 }
156 150
157 gfx::Size LabelButtonBorder::GetMinimumSize() const { 151 gfx::Size LabelButtonBorder::GetMinimumSize() const {
158 gfx::Size minimum_size; 152 gfx::Size minimum_size;
159 for (int i = 0; i < 2; ++i) { 153 for (int i = 0; i < 2; ++i) {
160 for (int j = 0; j < Button::STATE_COUNT; ++j) { 154 for (int j = 0; j < Button::STATE_COUNT; ++j) {
161 if (painters_[i][j]) 155 if (painters_[i][j])
162 minimum_size.SetToMax(painters_[i][j]->GetMinimumSize()); 156 minimum_size.SetToMax(painters_[i][j]->GetMinimumSize());
163 } 157 }
164 } 158 }
165 return minimum_size; 159 return minimum_size;
166 } 160 }
167 161
168 Painter* LabelButtonBorder::GetPainter(bool focused, 162 Painter* LabelButtonBorder::GetPainter(bool focused,
169 Button::ButtonState state) { 163 Button::ButtonState state) {
170 return painters_[focused ? 1 : 0][state].get(); 164 return painters_[focused ? 1 : 0][state].get();
171 } 165 }
172 166
173 void LabelButtonBorder::SetPainter(bool focused, 167 void LabelButtonBorder::SetPainter(bool focused,
174 Button::ButtonState state, 168 Button::ButtonState state,
175 Painter* painter) { 169 Painter* painter) {
176 painters_[focused ? 1 : 0][state].reset(painter); 170 painters_[focused ? 1 : 0][state].reset(painter);
177 } 171 }
178 172
179 } // namespace views 173 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/controls/button/label_button.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698