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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | experimental/ChromeUtils/SkBorder.cpp » ('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 /*
2 * Copyright 2013 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8
9 #ifndef SkBorder_DEFINED
10 #define SkBorder_DEFINED
11
12 #include "SkColor.h"
13 #include "SkPaint.h"
14 #include "SkScalar.h"
15 #include "SkTArray.h"
16
17 // This class provides a concise means of specifying all the geometry/shading
18 // associated with a CSS-style box/round-rect.
19 class SkBorder {
20 public:
21 enum BorderStyle {
22 /**
23 */
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
24 kNone_BorderStyle,
25 /**
26 */
27 kHidden_BorderStyle,
28 /**
29 */
30 kDotted_BorderStyle,
31 /**
32 */
33 kDashed_BorderStyle,
34 /**
35 */
36 kSolid_BorderStyle,
37 /**
38 */
39 kDouble_BorderStyle,
40 /**
41 */
42 kGroove_BorderStyle,
43 /**
44 */
45 kRidge_BorderStyle,
46 /**
47 */
48 kInset_BorderStyle,
49 /**
50 */
51 kOutset_BorderStyle,
52 };
53
54 enum BlurStyle {
55 kNormal_BlurStyle, //!< fuzzy inside and outside
56 kInner_BlurStyle, //!< fuzzy inside, nothing outside
57 };
58
59 struct ShadowInfo {
60 SkScalar fXOffset;
61 SkScalar fYOffset;
62 SkScalar fBlurSigma;
63 SkColor fColor;
64 BlurStyle fStyle;
65 };
66
67 SkBorder(SkPaint& p, SkScalar width, BorderStyle style);
68
69 SkBorder(const SkPaint paints[4], const SkScalar widths[4], const BorderStyl e styles[4]);
70
71 void setBackground(SkPaint* p) {
72 if (NULL == p) {
73 fBackground.reset();
74 fFlags &= ~kDrawBackground_Flag;
75 } else {
76 fBackground = *p;
77 fFlags |= kDrawBackground_Flag;
78 }
79 }
80
81 void addShadow(ShadowInfo& info) {
82 fShadows.push_back(info);
83 }
84
85 private:
86 enum Flags {
87 // One paint "fPaints[0]" is applied to all the borders
88 kOnePaint_Flag = 0x01,
89 // Use 'fBackground' to draw the background
90 kDrawBackground_Flag = 0x02,
91 };
92
93 // If kOnePaint_Flag is specified then fBorder[0] is applied to all sides.
94 // Otherwise the order is: left, top, right, bottom
95 SkPaint fPaints[4];
96 // Only valid if kDrawBackground_Flag is set.
97 SkPaint fBackground;
98 SkScalar fWidths[4];
99 BorderStyle fStyles[4];
100 SkTArray<ShadowInfo> fShadows;
101 uint32_t fFlags;
102 };
103
104
105
106
107 #endif
OLDNEW
« 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