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

Unified Diff: ui/views/shadow_border.h

Issue 18003003: Message center re-organized (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Border caching added Created 7 years, 5 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
Index: ui/views/shadow_border.h
diff --git a/ui/views/shadow_border.h b/ui/views/shadow_border.h
new file mode 100644
index 0000000000000000000000000000000000000000..a3cceac6a180e82e7a966e99f965bedc08e9a074
--- /dev/null
+++ b/ui/views/shadow_border.h
@@ -0,0 +1,54 @@
+// Copyright (c) 2013 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.
+
+#ifndef UI_VIEWS_SHADOW_BORDER_H_
+#define UI_VIEWS_SHADOW_BORDER_H_
+
+#include "third_party/skia/include/core/SkColor.h"
+#include "ui/views/border.h"
+#include "ui/views/views_export.h"
+
+namespace views {
+
+// Creates a css box-shadow like border which fades into SK_ColorTRANSPARENT.
+class VIEWS_EXPORT ShadowBorder : public views::Border {
+ public:
+ ShadowBorder(int blur,
+ SkColor color,
+ int vertical_offset,
+ int horizontal_offset);
+ virtual ~ShadowBorder();
+
+ protected:
+ // Overridden from views::Border:
+ virtual void Paint(const views::View& view, gfx::Canvas* canvas) OVERRIDE;
+ virtual gfx::Insets GetInsets() const OVERRIDE;
+
+ private:
+ // Blur amount of the shadow in pixels. For details on how blur is defined see
+ // comments for blur_ in class ShadowValue.
+ int blur_;
+
+ // Shadow color.
+ SkColor color_;
+
+ // Number of pixels to shift shaodw to bottom.
+ int vertical_offset_;
+
+ // Number of pixels to shift shaodw to right.
+ int horizontal_offset_;
+
+ // Bounds of the view when the cached border was created. If the bounds change
+ // the cached border can no longer be used.
+ gfx::Rect cache_bounds_;
+
+ // The cached border.
+ scoped_ptr<gfx::ImageSkia> cached_border_;
+
+ DISALLOW_COPY_AND_ASSIGN(ShadowBorder);
+};
+
+} // namespace views
+
+#endif // UI_VIEWS_SHADOW_BORDER_H_

Powered by Google App Engine
This is Rietveld 408576698