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

Unified Diff: ui/views/rendering/border.cc

Issue 6286013: V2 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/views/rendering/border.h ('k') | ui/views/rendering/border_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/rendering/border.cc
===================================================================
--- ui/views/rendering/border.cc (revision 0)
+++ ui/views/rendering/border.cc (revision 0)
@@ -0,0 +1,69 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "ui/views/rendering/border.h"
+
+#include "gfx/canvas.h"
+#include "ui/views/view.h"
+
+namespace ui {
+
+namespace internal {
+
+class SolidColorBorder : public Border {
+ public:
+ SolidColorBorder(int thickness, SkColor color) : color_(color) {
+ set_insets(gfx::Insets(thickness, thickness, thickness, thickness));
+ }
+ virtual ~SolidColorBorder() {
+ }
+
+ // Overridden from Border:
+ virtual void Paint(const View* view, gfx::Canvas* canvas) const {
+ canvas->FillRectInt(color_, 0, 0, view->width(), insets().top());
+ canvas->FillRectInt(color_, 0, 0, insets().left(), view->height());
+ canvas->FillRectInt(color_, 0, view->height() - insets().bottom(),
+ view->width(), insets().bottom());
+ canvas->FillRectInt(color_, view->width() - insets().right(), 0,
+ insets().right(), view->height());
+ }
+
+ private:
+ SkColor color_;
+
+ DISALLOW_COPY_AND_ASSIGN(SolidColorBorder);
+};
+
+}
+
+////////////////////////////////////////////////////////////////////////////////
+// Border, public:
+
+Border::~Border() {
+}
+
+// static
+Border* Border::CreateSolidBorder(int thickness, SkColor color) {
+ return new internal::SolidColorBorder(thickness, color);
+}
+
+// static
+Border* Border::CreateTransparentBorder(const gfx::Insets& insets) {
+ Border* b = new Border;
+ b->set_insets(insets);
+ return b;
+}
+
+void Border::Paint(const View* view, gfx::Canvas* canvas) const {
+ // Nothing to do.
+}
+
+////////////////////////////////////////////////////////////////////////////////
+// Border, private:
+
+Border::Border() {
+}
+
+} // namespace ui
+
Property changes on: ui\views\rendering\border.cc
___________________________________________________________________
Added: svn:eol-style
+ LF
« 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