OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2006 The Android Open Source Project | 2 * Copyright 2006 The Android Open Source Project |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 | 8 |
9 #ifndef SkShader_DEFINED | 9 #ifndef SkShader_DEFINED |
10 #define SkShader_DEFINED | 10 #define SkShader_DEFINED |
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 * Subclasses should be sure to call their INHERITED::validContext() if | 200 * Subclasses should be sure to call their INHERITED::validContext() if |
201 * they override this method. | 201 * they override this method. |
202 */ | 202 */ |
203 virtual bool validContext(const SkBitmap& device, const SkPaint& paint, | 203 virtual bool validContext(const SkBitmap& device, const SkPaint& paint, |
204 const SkMatrix& matrix, SkMatrix* totalInverse = N
ULL) const; | 204 const SkMatrix& matrix, SkMatrix* totalInverse = N
ULL) const; |
205 | 205 |
206 /** | 206 /** |
207 * Create the actual object that does the shading. | 207 * Create the actual object that does the shading. |
208 * Returns NULL if validContext() returns false. | 208 * Returns NULL if validContext() returns false. |
209 * Size of storage must be >= contextSize. | 209 * Size of storage must be >= contextSize. |
| 210 * Your subclass must also override contextSize() if it overrides createCon
text(). |
| 211 * |
| 212 * Base class implementation returns NULL. |
210 */ | 213 */ |
211 virtual Context* createContext(const SkBitmap& device, | 214 virtual Context* createContext(const SkBitmap& device, |
212 const SkPaint& paint, | 215 const SkPaint& paint, |
213 const SkMatrix& matrix, | 216 const SkMatrix& matrix, |
214 void* storage) const = 0; | 217 void* storage) const; |
215 | 218 |
216 /** | 219 /** |
217 * Return the size of a Context returned by createContext. | 220 * Return the size of a Context returned by createContext. |
| 221 * |
| 222 * Override this if your subclass overrides createContext, to return the co
rrect size of |
| 223 * your subclass' context. |
218 */ | 224 */ |
219 virtual size_t contextSize() const = 0; | 225 virtual size_t contextSize() const; |
220 | 226 |
221 /** | 227 /** |
222 * Helper to check the flags to know if it is legal to call shadeSpan16() | 228 * Helper to check the flags to know if it is legal to call shadeSpan16() |
223 */ | 229 */ |
224 static bool CanCallShadeSpan16(uint32_t flags) { | 230 static bool CanCallShadeSpan16(uint32_t flags) { |
225 return (flags & kHasSpan16_Flag) != 0; | 231 return (flags & kHasSpan16_Flag) != 0; |
226 } | 232 } |
227 | 233 |
228 /** | 234 /** |
229 Gives method bitmap should be read to implement a shader. | 235 Gives method bitmap should be read to implement a shader. |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
396 | 402 |
397 private: | 403 private: |
398 SkMatrix fLocalMatrix; | 404 SkMatrix fLocalMatrix; |
399 | 405 |
400 bool computeTotalInverse(const SkMatrix& matrix, SkMatrix* totalInverse) con
st; | 406 bool computeTotalInverse(const SkMatrix& matrix, SkMatrix* totalInverse) con
st; |
401 | 407 |
402 typedef SkFlattenable INHERITED; | 408 typedef SkFlattenable INHERITED; |
403 }; | 409 }; |
404 | 410 |
405 #endif | 411 #endif |
OLD | NEW |