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

Side by Side Diff: views/border.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) 2006-2008 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 "views/border.h" 5 #include "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 9
10 namespace views { 10 namespace views {
11 11
(...skipping 16 matching lines...) Expand all
28 }; 28 };
29 29
30 SolidBorder::SolidBorder(int thickness, SkColor color) 30 SolidBorder::SolidBorder(int thickness, SkColor color)
31 : thickness_(thickness), 31 : thickness_(thickness),
32 color_(color), 32 color_(color),
33 insets_(thickness, thickness, thickness, thickness) { 33 insets_(thickness, thickness, thickness, thickness) {
34 } 34 }
35 35
36 void SolidBorder::Paint(const View& view, gfx::Canvas* canvas) const { 36 void SolidBorder::Paint(const View& view, gfx::Canvas* canvas) const {
37 // Top border. 37 // Top border.
38 canvas->FillRectInt(color_, 0, 0, view.width(), insets_.top()); 38 canvas->FillRect(color_, gfx::Rect(0, 0, view.width(), insets_.top()));
39 // Left border. 39 // Left border.
40 canvas->FillRectInt(color_, 0, 0, insets_.left(), view.height()); 40 canvas->FillRect(color_, gfx::Rect(0, 0, insets_.left(), view.height()));
41 // Bottom border. 41 // Bottom border.
42 canvas->FillRectInt(color_, 0, view.height() - insets_.bottom(), 42 canvas->FillRect(color_, gfx::Rect(0, view.height() - insets_.bottom(),
43 view.width(), insets_.bottom()); 43 view.width(), insets_.bottom()));
44 // Right border. 44 // Right border.
45 canvas->FillRectInt(color_, view.width() - insets_.right(), 0, 45 canvas->FillRect(color_, gfx::Rect(view.width() - insets_.right(), 0,
46 insets_.right(), view.height()); 46 insets_.right(), view.height()));
47 } 47 }
48 48
49 void SolidBorder::GetInsets(gfx::Insets* insets) const { 49 void SolidBorder::GetInsets(gfx::Insets* insets) const {
50 DCHECK(insets); 50 DCHECK(insets);
51 insets->Set(insets_.top(), insets_.left(), insets_.bottom(), insets_.right()); 51 insets->Set(insets_.top(), insets_.left(), insets_.bottom(), insets_.right());
52 } 52 }
53 53
54 class EmptyBorder : public Border { 54 class EmptyBorder : public Border {
55 public: 55 public:
56 EmptyBorder(int top, int left, int bottom, int right) 56 EmptyBorder(int top, int left, int bottom, int right)
(...skipping 26 matching lines...) Expand all
83 Border* Border::CreateSolidBorder(int thickness, SkColor color) { 83 Border* Border::CreateSolidBorder(int thickness, SkColor color) {
84 return new SolidBorder(thickness, color); 84 return new SolidBorder(thickness, color);
85 } 85 }
86 86
87 // static 87 // static
88 Border* Border::CreateEmptyBorder(int top, int left, int bottom, int right) { 88 Border* Border::CreateEmptyBorder(int top, int left, int bottom, int right) {
89 return new EmptyBorder(top, left, bottom, right); 89 return new EmptyBorder(top, left, bottom, right);
90 } 90 }
91 91
92 } // namespace views 92 } // namespace views
OLDNEW
« no previous file with comments | « views/aura_desktop/aura_desktop_main.cc ('k') | views/controls/menu/menu_scroll_view_container.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698