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 #ifndef SkShader_DEFINED | 8 #ifndef SkShader_DEFINED |
9 #define SkShader_DEFINED | 9 #define SkShader_DEFINED |
10 | 10 |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
185 }; | 185 }; |
186 | 186 |
187 /** | 187 /** |
188 * Create the actual object that does the shading. | 188 * Create the actual object that does the shading. |
189 * Size of storage must be >= contextSize. | 189 * Size of storage must be >= contextSize. |
190 */ | 190 */ |
191 Context* createContext(const ContextRec&, void* storage) const; | 191 Context* createContext(const ContextRec&, void* storage) const; |
192 | 192 |
193 /** | 193 /** |
194 * Return the size of a Context returned by createContext. | 194 * Return the size of a Context returned by createContext. |
| 195 * |
| 196 * Override this if your subclass overrides createContext, to return the co
rrect size of |
| 197 * your subclass' context. |
195 */ | 198 */ |
196 size_t contextSize(const ContextRec&) const; | 199 virtual size_t contextSize(const ContextRec&) const; |
197 | 200 |
198 /** | 201 /** |
199 * Returns true if this shader is just a bitmap, and if not null, returns t
he bitmap, | 202 * Returns true if this shader is just a bitmap, and if not null, returns t
he bitmap, |
200 * localMatrix, and tilemodes. If this is not a bitmap, returns false and i
gnores the | 203 * localMatrix, and tilemodes. If this is not a bitmap, returns false and i
gnores the |
201 * out-parameters. | 204 * out-parameters. |
202 */ | 205 */ |
203 bool isABitmap(SkBitmap* outTexture, SkMatrix* outMatrix, TileMode xy[2]) co
nst { | 206 bool isABitmap(SkBitmap* outTexture, SkMatrix* outMatrix, TileMode xy[2]) co
nst { |
204 return this->onIsABitmap(outTexture, outMatrix, xy); | 207 return this->onIsABitmap(outTexture, outMatrix, xy); |
205 } | 208 } |
206 | 209 |
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
410 void flatten(SkWriteBuffer&) const override; | 413 void flatten(SkWriteBuffer&) const override; |
411 | 414 |
412 bool computeTotalInverse(const ContextRec&, SkMatrix* totalInverse) const; | 415 bool computeTotalInverse(const ContextRec&, SkMatrix* totalInverse) const; |
413 | 416 |
414 /** | 417 /** |
415 * Your subclass must also override contextSize() if it overrides onCreateC
ontext(). | 418 * Your subclass must also override contextSize() if it overrides onCreateC
ontext(). |
416 * Base class impl returns NULL. | 419 * Base class impl returns NULL. |
417 */ | 420 */ |
418 virtual Context* onCreateContext(const ContextRec&, void* storage) const; | 421 virtual Context* onCreateContext(const ContextRec&, void* storage) const; |
419 | 422 |
420 /** | |
421 * Override this if your subclass overrides createContext, to return the co
rrect size of | |
422 * your subclass' context. | |
423 */ | |
424 virtual size_t onContextSize(const ContextRec&) const; | |
425 | |
426 virtual bool onAsLuminanceColor(SkColor*) const { | 423 virtual bool onAsLuminanceColor(SkColor*) const { |
427 return false; | 424 return false; |
428 } | 425 } |
429 | 426 |
430 virtual bool onIsABitmap(SkBitmap*, SkMatrix*, TileMode[2]) const { | 427 virtual bool onIsABitmap(SkBitmap*, SkMatrix*, TileMode[2]) const { |
431 return false; | 428 return false; |
432 } | 429 } |
433 | 430 |
434 private: | 431 private: |
435 // This is essentially const, but not officially so it can be modified in | 432 // This is essentially const, but not officially so it can be modified in |
436 // constructors. | 433 // constructors. |
437 SkMatrix fLocalMatrix; | 434 SkMatrix fLocalMatrix; |
438 | 435 |
439 // So the SkLocalMatrixShader can whack fLocalMatrix in its SkReadBuffer con
structor. | 436 // So the SkLocalMatrixShader can whack fLocalMatrix in its SkReadBuffer con
structor. |
440 friend class SkLocalMatrixShader; | 437 friend class SkLocalMatrixShader; |
441 friend class SkBitmapProcShader; // for computeTotalInverse() | 438 friend class SkBitmapProcShader; // for computeTotalInverse() |
442 | 439 |
443 typedef SkFlattenable INHERITED; | 440 typedef SkFlattenable INHERITED; |
444 }; | 441 }; |
445 | 442 |
446 #endif | 443 #endif |
OLD | NEW |