OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006, 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2008 Apple Inc. All rights reserved. |
3 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) | 3 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 static CanvasStyle* createFromGradient(CanvasGradient*); | 48 static CanvasStyle* createFromGradient(CanvasGradient*); |
49 static CanvasStyle* createFromPattern(CanvasPattern*); | 49 static CanvasStyle* createFromPattern(CanvasPattern*); |
50 | 50 |
51 String color() const { ASSERT(m_type == ColorRGBA); return Color(m_rgba).ser
ialized(); } | 51 String color() const { ASSERT(m_type == ColorRGBA); return Color(m_rgba).ser
ialized(); } |
52 CanvasGradient* canvasGradient() const { return m_gradient.get(); } | 52 CanvasGradient* canvasGradient() const { return m_gradient.get(); } |
53 CanvasPattern* canvasPattern() const { return m_pattern; } | 53 CanvasPattern* canvasPattern() const { return m_pattern; } |
54 | 54 |
55 void applyToPaint(SkPaint&) const; | 55 void applyToPaint(SkPaint&) const; |
56 RGBA32 paintColor() const; | 56 RGBA32 paintColor() const; |
57 | 57 |
| 58 PassRefPtr<SkShader> asShader() const; |
| 59 |
58 bool isEquivalentRGBA(RGBA32 rgba) const { return m_type == ColorRGBA && m_r
gba == rgba; } | 60 bool isEquivalentRGBA(RGBA32 rgba) const { return m_type == ColorRGBA && m_r
gba == rgba; } |
59 | 61 |
60 DECLARE_TRACE(); | 62 DECLARE_TRACE(); |
61 | 63 |
62 private: | 64 private: |
63 enum Type { ColorRGBA, Gradient, ImagePattern }; | 65 enum Type { ColorRGBA, Gradient, ImagePattern }; |
64 | 66 |
65 CanvasStyle(RGBA32); | 67 CanvasStyle(RGBA32); |
66 CanvasStyle(CanvasGradient*); | 68 CanvasStyle(CanvasGradient*); |
67 CanvasStyle(CanvasPattern*); | 69 CanvasStyle(CanvasPattern*); |
68 | 70 |
69 Type m_type; | 71 Type m_type; |
70 RGBA32 m_rgba; | 72 RGBA32 m_rgba; |
71 | 73 |
72 Member<CanvasGradient> m_gradient; | 74 Member<CanvasGradient> m_gradient; |
73 Member<CanvasPattern> m_pattern; | 75 Member<CanvasPattern> m_pattern; |
74 }; | 76 }; |
75 | 77 |
76 bool parseColorOrCurrentColor(Color& parsedColor, const String& colorString, HTM
LCanvasElement*); | 78 bool parseColorOrCurrentColor(Color& parsedColor, const String& colorString, HTM
LCanvasElement*); |
77 | 79 |
78 } // namespace blink | 80 } // namespace blink |
79 | 81 |
80 #endif | 82 #endif |
OLD | NEW |