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 * | |
211 * Base class implementation returns NULL. | |
210 */ | 212 */ |
211 virtual Context* createContext(const SkBitmap& device, | 213 virtual Context* createContext(const SkBitmap& device, |
212 const SkPaint& paint, | 214 const SkPaint& paint, |
213 const SkMatrix& matrix, | 215 const SkMatrix& matrix, |
214 void* storage) const = 0; | 216 void* storage) const; |
215 | 217 |
216 /** | 218 /** |
217 * Return the size of a Context returned by createContext. | 219 * Return the size of a Context returned by createContext. |
220 * | |
221 * Base class implementation returns 0. | |
scroggo
2014/04/30 18:52:02
Due to a requirement in SkSmallAllocator (which co
| |
218 */ | 222 */ |
219 virtual size_t contextSize() const = 0; | 223 virtual size_t contextSize() const; |
scroggo
2014/04/30 18:52:02
I like pure virtual function, because if someone w
| |
220 | 224 |
221 /** | 225 /** |
222 * Helper to check the flags to know if it is legal to call shadeSpan16() | 226 * Helper to check the flags to know if it is legal to call shadeSpan16() |
223 */ | 227 */ |
224 static bool CanCallShadeSpan16(uint32_t flags) { | 228 static bool CanCallShadeSpan16(uint32_t flags) { |
225 return (flags & kHasSpan16_Flag) != 0; | 229 return (flags & kHasSpan16_Flag) != 0; |
226 } | 230 } |
227 | 231 |
228 /** | 232 /** |
229 Gives method bitmap should be read to implement a shader. | 233 Gives method bitmap should be read to implement a shader. |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
396 | 400 |
397 private: | 401 private: |
398 SkMatrix fLocalMatrix; | 402 SkMatrix fLocalMatrix; |
399 | 403 |
400 bool computeTotalInverse(const SkMatrix& matrix, SkMatrix* totalInverse) con st; | 404 bool computeTotalInverse(const SkMatrix& matrix, SkMatrix* totalInverse) con st; |
401 | 405 |
402 typedef SkFlattenable INHERITED; | 406 typedef SkFlattenable INHERITED; |
403 }; | 407 }; |
404 | 408 |
405 #endif | 409 #endif |
OLD | NEW |