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 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 SkShader* shader(); |
130 void destroyShader(); | 130 void destroyShader(); |
131 | 131 |
132 void sortStopsIfNecessary(); | 132 void sortStopsIfNecessary(); |
133 | 133 |
| 134 void applyShaderToPaintInternal(SkShader* shader, SkPaint& paint) |
| 135 { |
| 136 paint.setShader(shader); |
| 137 // Legacy behavior: gradients are always dithered. |
| 138 paint.setDither(true); |
| 139 } |
| 140 |
134 FloatPoint m_p0; | 141 FloatPoint m_p0; |
135 FloatPoint m_p1; | 142 FloatPoint m_p1; |
136 float m_r0; | 143 float m_r0; |
137 float m_r1; | 144 float m_r1; |
138 float m_aspectRatio; // For elliptical gradient, width / height. | 145 float m_aspectRatio; // For elliptical gradient, width / height. |
139 Vector<ColorStop, 2> m_stops; | 146 Vector<ColorStop, 2> m_stops; |
140 bool m_radial; | 147 bool m_radial; |
141 bool m_stopsSorted; | 148 bool m_stopsSorted; |
142 bool m_drawInPMColorSpace; | 149 bool m_drawInPMColorSpace; |
143 GradientSpreadMethod m_spreadMethod; | 150 GradientSpreadMethod m_spreadMethod; |
144 AffineTransform m_gradientSpaceTransformation; | 151 AffineTransform m_gradientSpaceTransformation; |
145 | 152 |
146 RefPtr<SkShader> m_gradient; | 153 RefPtr<SkShader> m_gradient; |
147 }; | 154 }; |
148 | 155 |
149 } // namespace blink | 156 } // namespace blink |
150 | 157 |
151 #endif | 158 #endif |
OLD | NEW |