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

Side by Side Diff: chrome/browser/ui/views/wrench_menu.cc

Issue 8405002: ui/gfx: Convert Canvas::FillRectInt() to use gfx::Rect. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: save some vertical space, interactive_ui_tests are fixed by Peter's fix Created 9 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/views/wrench_menu.h" 5 #include "chrome/browser/ui/views/wrench_menu.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cmath> 8 #include <cmath>
9 #include <set> 9 #include <set>
10 10
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 } 136 }
137 137
138 virtual void Paint(gfx::Canvas* canvas, View* view) const { 138 virtual void Paint(gfx::Canvas* canvas, View* view) const {
139 CustomButton::ButtonState state = 139 CustomButton::ButtonState state =
140 (view->GetClassName() == views::Label::kViewClassName) ? 140 (view->GetClassName() == views::Label::kViewClassName) ?
141 CustomButton::BS_NORMAL : static_cast<CustomButton*>(view)->state(); 141 CustomButton::BS_NORMAL : static_cast<CustomButton*>(view)->state();
142 int w = view->width(); 142 int w = view->width();
143 int h = view->height(); 143 int h = view->height();
144 switch (TypeAdjustedForRTL()) { 144 switch (TypeAdjustedForRTL()) {
145 case LEFT_BUTTON: 145 case LEFT_BUTTON:
146 canvas->FillRectInt(background_color(state), 1, 1, w, h - 2); 146 canvas->FillRect(background_color(state), gfx::Rect(1, 1, w, h - 2));
147 canvas->FillRectInt(border_color(state), 2, 0, w, 1); 147 canvas->FillRect(border_color(state), gfx::Rect(2, 0, w, 1));
148 canvas->FillRectInt(border_color(state), 1, 1, 1, 1); 148 canvas->FillRect(border_color(state), gfx::Rect(1, 1, 1, 1));
149 canvas->FillRectInt(border_color(state), 0, 2, 1, h - 4); 149 canvas->FillRect(border_color(state), gfx::Rect(0, 2, 1, h - 4));
150 canvas->FillRectInt(border_color(state), 1, h - 2, 1, 1); 150 canvas->FillRect(border_color(state), gfx::Rect(1, h - 2, 1, 1));
151 canvas->FillRectInt(border_color(state), 2, h - 1, w, 1); 151 canvas->FillRect(border_color(state), gfx::Rect(2, h - 1, w, 1));
152 break; 152 break;
153 153
154 case CENTER_BUTTON: { 154 case CENTER_BUTTON: {
155 canvas->FillRectInt(background_color(state), 1, 1, w - 2, h - 2); 155 canvas->FillRect(background_color(state),
156 gfx::Rect(1, 1, w - 2, h - 2));
156 SkColor left_color = state != CustomButton::BS_NORMAL ? 157 SkColor left_color = state != CustomButton::BS_NORMAL ?
157 border_color(state) : border_color(left_button_->state()); 158 border_color(state) : border_color(left_button_->state());
158 canvas->FillRectInt(left_color, 0, 0, 1, h); 159 canvas->FillRect(left_color, gfx::Rect(0, 0, 1, h));
159 canvas->FillRectInt(border_color(state), 1, 0, w - 2, 1); 160 canvas->FillRect(border_color(state), gfx::Rect(1, 0, w - 2, 1));
160 canvas->FillRectInt(border_color(state), 1, h - 1, w - 2, 1); 161 canvas->FillRect(border_color(state), gfx::Rect(1, h - 1, w - 2, 1));
161 SkColor right_color = state != CustomButton::BS_NORMAL ? 162 SkColor right_color = state != CustomButton::BS_NORMAL ?
162 border_color(state) : border_color(right_button_->state()); 163 border_color(state) : border_color(right_button_->state());
163 canvas->FillRectInt(right_color, w - 1, 0, 1, h); 164 canvas->FillRect(right_color, gfx::Rect(w - 1, 0, 1, h));
164 break; 165 break;
165 } 166 }
166 167
167 case RIGHT_BUTTON: 168 case RIGHT_BUTTON:
168 canvas->FillRectInt(background_color(state), 0, 1, w - 1, h - 2); 169 canvas->FillRect(background_color(state),
169 canvas->FillRectInt(border_color(state), 0, 0, w - 2, 1); 170 gfx::Rect(0, 1, w - 1, h - 2));
170 canvas->FillRectInt(border_color(state), w - 2, 1, 1, 1); 171 canvas->FillRect(border_color(state), gfx::Rect(0, 0, w - 2, 1));
171 canvas->FillRectInt(border_color(state), w - 1, 2, 1, h - 4); 172 canvas->FillRect(border_color(state), gfx::Rect(w - 2, 1, 1, 1));
172 canvas->FillRectInt(border_color(state), w - 2, h - 2, 1, 1); 173 canvas->FillRect(border_color(state), gfx::Rect(w - 1, 2, 1, h - 4));
173 canvas->FillRectInt(border_color(state), 0, h - 1, w - 2, 1); 174 canvas->FillRect(border_color(state), gfx::Rect(w - 2, h - 2, 1, 1));
175 canvas->FillRect(border_color(state), gfx::Rect(0, h - 1, w - 2, 1));
174 break; 176 break;
175 177
176 case SINGLE_BUTTON: 178 case SINGLE_BUTTON:
177 canvas->FillRectInt(background_color(state), 1, 1, w - 2, h - 2); 179 canvas->FillRect(background_color(state),
178 canvas->FillRectInt(border_color(state), 2, 0, w - 4, 1); 180 gfx::Rect(1, 1, w - 2, h - 2));
179 canvas->FillRectInt(border_color(state), 1, 1, 1, 1); 181 canvas->FillRect(border_color(state), gfx::Rect(2, 0, w - 4, 1));
180 canvas->FillRectInt(border_color(state), 0, 2, 1, h - 4); 182 canvas->FillRect(border_color(state), gfx::Rect(1, 1, 1, 1));
181 canvas->FillRectInt(border_color(state), 1, h - 2, 1, 1); 183 canvas->FillRect(border_color(state), gfx::Rect(0, 2, 1, h - 4));
182 canvas->FillRectInt(border_color(state), 2, h - 1, w - 4, 1); 184 canvas->FillRect(border_color(state), gfx::Rect(1, h - 2, 1, 1));
183 canvas->FillRectInt(border_color(state), w - 2, 1, 1, 1); 185 canvas->FillRect(border_color(state), gfx::Rect(2, h - 1, w - 4, 1));
184 canvas->FillRectInt(border_color(state), w - 1, 2, 1, h - 4); 186 canvas->FillRect(border_color(state), gfx::Rect(w - 2, 1, 1, 1));
185 canvas->FillRectInt(border_color(state), w - 2, h - 2, 1, 1); 187 canvas->FillRect(border_color(state), gfx::Rect(w - 1, 2, 1, h - 4));
188 canvas->FillRect(border_color(state), gfx::Rect(w - 2, h - 2, 1, 1));
186 break; 189 break;
187 190
188 default: 191 default:
189 NOTREACHED(); 192 NOTREACHED();
190 break; 193 break;
191 } 194 }
192 } 195 }
193 196
194 private: 197 private:
195 static SkColor border_color(CustomButton::ButtonState state) { 198 static SkColor border_color(CustomButton::ButtonState state) {
(...skipping 686 matching lines...) Expand 10 before | Expand all | Expand 10 after
882 bookmark_menu_delegate_.reset( 885 bookmark_menu_delegate_.reset(
883 new BookmarkMenuDelegate(browser_->profile(), 886 new BookmarkMenuDelegate(browser_->profile(),
884 NULL, 887 NULL,
885 parent, 888 parent,
886 first_bookmark_command_id_)); 889 first_bookmark_command_id_));
887 bookmark_menu_delegate_->Init( 890 bookmark_menu_delegate_->Init(
888 this, bookmark_menu_, model->bookmark_bar_node(), 0, 891 this, bookmark_menu_, model->bookmark_bar_node(), 0,
889 BookmarkMenuDelegate::SHOW_OTHER_FOLDER, 892 BookmarkMenuDelegate::SHOW_OTHER_FOLDER,
890 bookmark_utils::LAUNCH_WRENCH_MENU); 893 bookmark_utils::LAUNCH_WRENCH_MENU);
891 } 894 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/toolbar_view.cc ('k') | content/browser/renderer_host/render_widget_host_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698