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

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

Issue 6286013: V2 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 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/views/rendering/border.h ('k') | ui/views/rendering/border_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Property Changes:
Added: svn:eol-style
+ LF
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "ui/views/rendering/border.h"
6
7 #include "gfx/canvas.h"
8 #include "ui/views/view.h"
9
10 namespace ui {
11
12 namespace internal {
13
14 class SolidColorBorder : public Border {
15 public:
16 SolidColorBorder(int thickness, SkColor color) : color_(color) {
17 set_insets(gfx::Insets(thickness, thickness, thickness, thickness));
18 }
19 virtual ~SolidColorBorder() {
20 }
21
22 // Overridden from Border:
23 virtual void Paint(const View* view, gfx::Canvas* canvas) const {
24 canvas->FillRectInt(color_, 0, 0, view->width(), insets().top());
25 canvas->FillRectInt(color_, 0, 0, insets().left(), view->height());
26 canvas->FillRectInt(color_, 0, view->height() - insets().bottom(),
27 view->width(), insets().bottom());
28 canvas->FillRectInt(color_, view->width() - insets().right(), 0,
29 insets().right(), view->height());
30 }
31
32 private:
33 SkColor color_;
34
35 DISALLOW_COPY_AND_ASSIGN(SolidColorBorder);
36 };
37
38 }
39
40 ////////////////////////////////////////////////////////////////////////////////
41 // Border, public:
42
43 Border::~Border() {
44 }
45
46 // static
47 Border* Border::CreateSolidBorder(int thickness, SkColor color) {
48 return new internal::SolidColorBorder(thickness, color);
49 }
50
51 // static
52 Border* Border::CreateTransparentBorder(const gfx::Insets& insets) {
53 Border* b = new Border;
54 b->set_insets(insets);
55 return b;
56 }
57
58 void Border::Paint(const View* view, gfx::Canvas* canvas) const {
59 // Nothing to do.
60 }
61
62 ////////////////////////////////////////////////////////////////////////////////
63 // Border, private:
64
65 Border::Border() {
66 }
67
68 } // namespace ui
69
OLDNEW
« no previous file with comments | « ui/views/rendering/border.h ('k') | ui/views/rendering/border_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698