| 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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 class CanvasPattern; | 42 class CanvasPattern; |
| 43 class HTMLCanvasElement; | 43 class HTMLCanvasElement; |
| 44 | 44 |
| 45 class CanvasStyle final : public GarbageCollected<CanvasStyle> { | 45 class CanvasStyle final : public GarbageCollected<CanvasStyle> { |
| 46 public: | 46 public: |
| 47 static CanvasStyle* createFromRGBA(RGBA32 rgba) { return new CanvasStyle(rgb
a); } | 47 static CanvasStyle* createFromRGBA(RGBA32 rgba) { return new CanvasStyle(rgb
a); } |
| 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* getCanvasGradient() const { return m_gradient.get(); } |
| 53 CanvasPattern* canvasPattern() const { return m_pattern; } | 53 CanvasPattern* getCanvasPattern() 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 bool isEquivalentRGBA(RGBA32 rgba) const { return m_type == ColorRGBA && m_r
gba == rgba; } | 58 bool isEquivalentRGBA(RGBA32 rgba) const { return m_type == ColorRGBA && m_r
gba == rgba; } |
| 59 | 59 |
| 60 DECLARE_TRACE(); | 60 DECLARE_TRACE(); |
| 61 | 61 |
| 62 private: | 62 private: |
| 63 enum Type { ColorRGBA, Gradient, ImagePattern }; | 63 enum Type { ColorRGBA, Gradient, ImagePattern }; |
| 64 | 64 |
| 65 CanvasStyle(RGBA32); | 65 CanvasStyle(RGBA32); |
| 66 CanvasStyle(CanvasGradient*); | 66 CanvasStyle(CanvasGradient*); |
| 67 CanvasStyle(CanvasPattern*); | 67 CanvasStyle(CanvasPattern*); |
| 68 | 68 |
| 69 Type m_type; | 69 Type m_type; |
| 70 RGBA32 m_rgba; | 70 RGBA32 m_rgba; |
| 71 | 71 |
| 72 Member<CanvasGradient> m_gradient; | 72 Member<CanvasGradient> m_gradient; |
| 73 Member<CanvasPattern> m_pattern; | 73 Member<CanvasPattern> m_pattern; |
| 74 }; | 74 }; |
| 75 | 75 |
| 76 bool parseColorOrCurrentColor(Color& parsedColor, const String& colorString, HTM
LCanvasElement*); | 76 bool parseColorOrCurrentColor(Color& parsedColor, const String& colorString, HTM
LCanvasElement*); |
| 77 | 77 |
| 78 } // namespace blink | 78 } // namespace blink |
| 79 | 79 |
| 80 #endif | 80 #endif |
| OLD | NEW |