| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006, 2007, 2008, 2011 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2007, 2008, 2011 Apple Inc. All rights reserved. |
| 3 * Copyright (C) 2007 Alp Toker <alp@atoker.com> | 3 * Copyright (C) 2007 Alp Toker <alp@atoker.com> |
| 4 * Copyright (C) 2008 Torch Mobile, Inc. | 4 * Copyright (C) 2008 Torch Mobile, Inc. |
| 5 * Copyright (C) 2013 Google Inc. All rights reserved. | 5 * Copyright (C) 2013 Google Inc. All rights reserved. |
| 6 * | 6 * |
| 7 * Redistribution and use in source and binary forms, with or without | 7 * Redistribution and use in source and binary forms, with or without |
| 8 * modification, are permitted provided that the following conditions | 8 * modification, are permitted provided that the following conditions |
| 9 * are met: | 9 * are met: |
| 10 * 1. Redistributions of source code must retain the above copyright | 10 * 1. Redistributions of source code must retain the above copyright |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 class SkShader; | 44 class SkShader; |
| 45 | 45 |
| 46 namespace blink { | 46 namespace blink { |
| 47 | 47 |
| 48 class FloatPoint; | 48 class FloatPoint; |
| 49 | 49 |
| 50 class PLATFORM_EXPORT Gradient : public RefCounted<Gradient> { | 50 class PLATFORM_EXPORT Gradient : public RefCounted<Gradient> { |
| 51 WTF_MAKE_NONCOPYABLE(Gradient); | 51 WTF_MAKE_NONCOPYABLE(Gradient); |
| 52 | 52 |
| 53 public: | 53 public: |
| 54 enum class Type { Linear, Radial }; | 54 enum class Type { Linear, Radial, Conic }; |
| 55 | 55 |
| 56 enum class ColorInterpolation { | 56 enum class ColorInterpolation { |
| 57 Premultiplied, | 57 Premultiplied, |
| 58 Unpremultiplied, | 58 Unpremultiplied, |
| 59 }; | 59 }; |
| 60 | 60 |
| 61 static PassRefPtr<Gradient> createLinear( | 61 static PassRefPtr<Gradient> createLinear( |
| 62 const FloatPoint& p0, | 62 const FloatPoint& p0, |
| 63 const FloatPoint& p1, | 63 const FloatPoint& p1, |
| 64 GradientSpreadMethod = SpreadMethodPad, | 64 GradientSpreadMethod = SpreadMethodPad, |
| 65 ColorInterpolation = ColorInterpolation::Unpremultiplied); | 65 ColorInterpolation = ColorInterpolation::Unpremultiplied); |
| 66 | 66 |
| 67 static PassRefPtr<Gradient> createRadial( | 67 static PassRefPtr<Gradient> createRadial( |
| 68 const FloatPoint& p0, | 68 const FloatPoint& p0, |
| 69 float r0, | 69 float r0, |
| 70 const FloatPoint& p1, | 70 const FloatPoint& p1, |
| 71 float r1, | 71 float r1, |
| 72 float aspectRatio = 1, | 72 float aspectRatio = 1, |
| 73 GradientSpreadMethod = SpreadMethodPad, | 73 GradientSpreadMethod = SpreadMethodPad, |
| 74 ColorInterpolation = ColorInterpolation::Unpremultiplied); | 74 ColorInterpolation = ColorInterpolation::Unpremultiplied); |
| 75 | 75 |
| 76 static PassRefPtr<Gradient> createConic( |
| 77 const FloatPoint& position, |
| 78 float angle, |
| 79 GradientSpreadMethod = SpreadMethodPad, |
| 80 ColorInterpolation = ColorInterpolation::Unpremultiplied); |
| 81 |
| 76 virtual ~Gradient(); | 82 virtual ~Gradient(); |
| 77 | 83 |
| 78 Type getType() const { return m_type; } | 84 Type getType() const { return m_type; } |
| 79 | 85 |
| 80 struct ColorStop { | 86 struct ColorStop { |
| 81 DISALLOW_NEW_EXCEPT_PLACEMENT_NEW(); | 87 DISALLOW_NEW_EXCEPT_PLACEMENT_NEW(); |
| 82 float stop; | 88 float stop; |
| 83 Color color; | 89 Color color; |
| 84 | 90 |
| 85 ColorStop(float s, const Color& c) : stop(s), color(c) {} | 91 ColorStop(float s, const Color& c) : stop(s), color(c) {} |
| (...skipping 29 matching lines...) Expand all Loading... |
| 115 | 121 |
| 116 Vector<ColorStop, 2> m_stops; | 122 Vector<ColorStop, 2> m_stops; |
| 117 bool m_stopsSorted; | 123 bool m_stopsSorted; |
| 118 | 124 |
| 119 mutable sk_sp<PaintShader> m_cachedShader; | 125 mutable sk_sp<PaintShader> m_cachedShader; |
| 120 }; | 126 }; |
| 121 | 127 |
| 122 } // namespace blink | 128 } // namespace blink |
| 123 | 129 |
| 124 #endif | 130 #endif |
| OLD | NEW |