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 16 matching lines...) Expand all Loading... |
27 */ | 27 */ |
28 | 28 |
29 #ifndef Gradient_h | 29 #ifndef Gradient_h |
30 #define Gradient_h | 30 #define Gradient_h |
31 | 31 |
32 #include "platform/PlatformExport.h" | 32 #include "platform/PlatformExport.h" |
33 #include "platform/geometry/FloatPoint.h" | 33 #include "platform/geometry/FloatPoint.h" |
34 #include "platform/graphics/Color.h" | 34 #include "platform/graphics/Color.h" |
35 #include "platform/graphics/GraphicsTypes.h" | 35 #include "platform/graphics/GraphicsTypes.h" |
36 #include "platform/transforms/AffineTransform.h" | 36 #include "platform/transforms/AffineTransform.h" |
| 37 #include "third_party/skia/include/core/SkRefCnt.h" |
37 #include "wtf/Noncopyable.h" | 38 #include "wtf/Noncopyable.h" |
38 #include "wtf/PassRefPtr.h" | 39 #include "wtf/PassRefPtr.h" |
39 #include "wtf/RefCounted.h" | 40 #include "wtf/RefCounted.h" |
40 #include "wtf/RefPtr.h" | |
41 #include "wtf/Vector.h" | 41 #include "wtf/Vector.h" |
42 | 42 |
43 class SkPaint; | 43 class SkPaint; |
44 class SkShader; | 44 class SkShader; |
45 | 45 |
46 namespace blink { | 46 namespace blink { |
47 | 47 |
48 class PLATFORM_EXPORT Gradient : public RefCounted<Gradient> { | 48 class PLATFORM_EXPORT Gradient : public RefCounted<Gradient> { |
49 WTF_MAKE_NONCOPYABLE(Gradient); | 49 WTF_MAKE_NONCOPYABLE(Gradient); |
50 public: | 50 public: |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 | 119 |
120 void setSpreadMethod(GradientSpreadMethod); | 120 void setSpreadMethod(GradientSpreadMethod); |
121 GradientSpreadMethod spreadMethod() const { return m_spreadMethod; } | 121 GradientSpreadMethod spreadMethod() const { return m_spreadMethod; } |
122 void setGradientSpaceTransform(const AffineTransform& gradientSpaceTransform
ation); | 122 void setGradientSpaceTransform(const AffineTransform& gradientSpaceTransform
ation); |
123 AffineTransform gradientSpaceTransform() { return m_gradientSpaceTransformat
ion; } | 123 AffineTransform gradientSpaceTransform() { return m_gradientSpaceTransformat
ion; } |
124 | 124 |
125 private: | 125 private: |
126 Gradient(const FloatPoint& p0, const FloatPoint& p1); | 126 Gradient(const FloatPoint& p0, const FloatPoint& p1); |
127 Gradient(const FloatPoint& p0, float r0, const FloatPoint& p1, float r1, flo
at aspectRatio); | 127 Gradient(const FloatPoint& p0, float r0, const FloatPoint& p1, float r1, flo
at aspectRatio); |
128 | 128 |
129 SkShader* shader(); | 129 sk_sp<SkShader> shader(); |
130 void destroyShader(); | 130 void destroyShader(); |
131 | 131 |
132 void sortStopsIfNecessary(); | 132 void sortStopsIfNecessary(); |
133 | 133 |
134 FloatPoint m_p0; | 134 FloatPoint m_p0; |
135 FloatPoint m_p1; | 135 FloatPoint m_p1; |
136 float m_r0; | 136 float m_r0; |
137 float m_r1; | 137 float m_r1; |
138 float m_aspectRatio; // For elliptical gradient, width / height. | 138 float m_aspectRatio; // For elliptical gradient, width / height. |
139 Vector<ColorStop, 2> m_stops; | 139 Vector<ColorStop, 2> m_stops; |
140 bool m_radial; | 140 bool m_radial; |
141 bool m_stopsSorted; | 141 bool m_stopsSorted; |
142 bool m_drawInPMColorSpace; | 142 bool m_drawInPMColorSpace; |
143 GradientSpreadMethod m_spreadMethod; | 143 GradientSpreadMethod m_spreadMethod; |
144 AffineTransform m_gradientSpaceTransformation; | 144 AffineTransform m_gradientSpaceTransformation; |
145 | 145 |
146 RefPtr<SkShader> m_gradient; | 146 sk_sp<SkShader> m_gradient; |
147 }; | 147 }; |
148 | 148 |
149 } // namespace blink | 149 } // namespace blink |
150 | 150 |
151 #endif | 151 #endif |
OLD | NEW |