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

Unified Diff: experimental/ChromeUtils/SkBorder.h

Issue 86263003: New Composite CSS border object (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Moved to experimental Created 7 years 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 | « no previous file | experimental/ChromeUtils/SkBorder.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: experimental/ChromeUtils/SkBorder.h
===================================================================
--- experimental/ChromeUtils/SkBorder.h (revision 0)
+++ experimental/ChromeUtils/SkBorder.h (revision 0)
@@ -0,0 +1,107 @@
+/*
+ * Copyright 2013 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+
+#ifndef SkBorder_DEFINED
+#define SkBorder_DEFINED
+
+#include "SkColor.h"
+#include "SkPaint.h"
+#include "SkScalar.h"
+#include "SkTArray.h"
+
+// This class provides a concise means of specifying all the geometry/shading
+// associated with a CSS-style box/round-rect.
+class SkBorder {
+public:
+ enum BorderStyle {
+ /**
+ */
bsalomon 2013/12/09 16:19:53 I'm wondering if we want to bite all of these off
robertphillips 2013/12/09 16:25:56 My plan was to initially duplicate all the Blink c
+ kNone_BorderStyle,
+ /**
+ */
+ kHidden_BorderStyle,
+ /**
+ */
+ kDotted_BorderStyle,
+ /**
+ */
+ kDashed_BorderStyle,
+ /**
+ */
+ kSolid_BorderStyle,
+ /**
+ */
+ kDouble_BorderStyle,
+ /**
+ */
+ kGroove_BorderStyle,
+ /**
+ */
+ kRidge_BorderStyle,
+ /**
+ */
+ kInset_BorderStyle,
+ /**
+ */
+ kOutset_BorderStyle,
+ };
+
+ enum BlurStyle {
+ kNormal_BlurStyle, //!< fuzzy inside and outside
+ kInner_BlurStyle, //!< fuzzy inside, nothing outside
+ };
+
+ struct ShadowInfo {
+ SkScalar fXOffset;
+ SkScalar fYOffset;
+ SkScalar fBlurSigma;
+ SkColor fColor;
+ BlurStyle fStyle;
+ };
+
+ SkBorder(SkPaint& p, SkScalar width, BorderStyle style);
+
+ SkBorder(const SkPaint paints[4], const SkScalar widths[4], const BorderStyle styles[4]);
+
+ void setBackground(SkPaint* p) {
+ if (NULL == p) {
+ fBackground.reset();
+ fFlags &= ~kDrawBackground_Flag;
+ } else {
+ fBackground = *p;
+ fFlags |= kDrawBackground_Flag;
+ }
+ }
+
+ void addShadow(ShadowInfo& info) {
+ fShadows.push_back(info);
+ }
+
+private:
+ enum Flags {
+ // One paint "fPaints[0]" is applied to all the borders
+ kOnePaint_Flag = 0x01,
+ // Use 'fBackground' to draw the background
+ kDrawBackground_Flag = 0x02,
+ };
+
+ // If kOnePaint_Flag is specified then fBorder[0] is applied to all sides.
+ // Otherwise the order is: left, top, right, bottom
+ SkPaint fPaints[4];
+ // Only valid if kDrawBackground_Flag is set.
+ SkPaint fBackground;
+ SkScalar fWidths[4];
+ BorderStyle fStyles[4];
+ SkTArray<ShadowInfo> fShadows;
+ uint32_t fFlags;
+};
+
+
+
+
+#endif
Property changes on: experimental\ChromeUtils\SkBorder.h
___________________________________________________________________
Added: svn:eol-style
+ LF
« no previous file with comments | « no previous file | experimental/ChromeUtils/SkBorder.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698