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

Side by Side Diff: ui/views/border.cc

Issue 9021046: Pass const gfx::Rect& as the first parameter to FillRect. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: one more fix Created 8 years, 10 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/gfx/render_text.cc ('k') | ui/views/controls/menu/menu_scroll_view_container.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) 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/border.h" 5 #include "ui/views/border.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "ui/gfx/canvas.h" 8 #include "ui/gfx/canvas.h"
9 #include "ui/views/painter.h" 9 #include "ui/views/painter.h"
10 10
(...skipping 18 matching lines...) Expand all
29 }; 29 };
30 30
31 SolidBorder::SolidBorder(int thickness, SkColor color) 31 SolidBorder::SolidBorder(int thickness, SkColor color)
32 : thickness_(thickness), 32 : thickness_(thickness),
33 color_(color), 33 color_(color),
34 insets_(thickness, thickness, thickness, thickness) { 34 insets_(thickness, thickness, thickness, thickness) {
35 } 35 }
36 36
37 void SolidBorder::Paint(const View& view, gfx::Canvas* canvas) const { 37 void SolidBorder::Paint(const View& view, gfx::Canvas* canvas) const {
38 // Top border. 38 // Top border.
39 canvas->FillRect(color_, gfx::Rect(0, 0, view.width(), insets_.top())); 39 canvas->FillRect(gfx::Rect(0, 0, view.width(), insets_.top()), color_);
40 // Left border. 40 // Left border.
41 canvas->FillRect(color_, gfx::Rect(0, 0, insets_.left(), view.height())); 41 canvas->FillRect(gfx::Rect(0, 0, insets_.left(), view.height()), color_);
42 // Bottom border. 42 // Bottom border.
43 canvas->FillRect(color_, gfx::Rect(0, view.height() - insets_.bottom(), 43 canvas->FillRect(gfx::Rect(0, view.height() - insets_.bottom(), view.width(),
44 view.width(), insets_.bottom())); 44 insets_.bottom()), color_);
45 // Right border. 45 // Right border.
46 canvas->FillRect(color_, gfx::Rect(view.width() - insets_.right(), 0, 46 canvas->FillRect(gfx::Rect(view.width() - insets_.right(), 0, insets_.right(),
47 insets_.right(), view.height())); 47 view.height()), color_);
48 } 48 }
49 49
50 void SolidBorder::GetInsets(gfx::Insets* insets) const { 50 void SolidBorder::GetInsets(gfx::Insets* insets) const {
51 DCHECK(insets); 51 DCHECK(insets);
52 insets->Set(insets_.top(), insets_.left(), insets_.bottom(), insets_.right()); 52 insets->Set(insets_.top(), insets_.left(), insets_.bottom(), insets_.right());
53 } 53 }
54 54
55 class EmptyBorder : public Border { 55 class EmptyBorder : public Border {
56 public: 56 public:
57 EmptyBorder(int top, int left, int bottom, int right) 57 EmptyBorder(int top, int left, int bottom, int right)
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 Border* Border::CreateEmptyBorder(int top, int left, int bottom, int right) { 117 Border* Border::CreateEmptyBorder(int top, int left, int bottom, int right) {
118 return new EmptyBorder(top, left, bottom, right); 118 return new EmptyBorder(top, left, bottom, right);
119 } 119 }
120 120
121 //static 121 //static
122 Border* Border::CreateBorderPainter(Painter* painter) { 122 Border* Border::CreateBorderPainter(Painter* painter) {
123 return new BorderPainter(painter); 123 return new BorderPainter(painter);
124 } 124 }
125 125
126 } // namespace views 126 } // namespace views
OLDNEW
« no previous file with comments | « ui/gfx/render_text.cc ('k') | ui/views/controls/menu/menu_scroll_view_container.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698