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 460 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
471 | 471 |
472 /** | 472 /** |
473 * If this shader can be represented by another shader + a localMatrix, ret
urn that shader | 473 * If this shader can be represented by another shader + a localMatrix, ret
urn that shader |
474 * and, if not NULL, the localMatrix. If not, return NULL and ignore the lo
calMatrix parameter. | 474 * and, if not NULL, the localMatrix. If not, return NULL and ignore the lo
calMatrix parameter. |
475 * | 475 * |
476 * Note: the returned shader (if not NULL) will have been ref'd, and it is
the responsibility | 476 * Note: the returned shader (if not NULL) will have been ref'd, and it is
the responsibility |
477 * of the caller to balance that with unref() when they are done. | 477 * of the caller to balance that with unref() when they are done. |
478 */ | 478 */ |
479 virtual SkShader* refAsALocalMatrixShader(SkMatrix* localMatrix) const; | 479 virtual SkShader* refAsALocalMatrixShader(SkMatrix* localMatrix) const; |
480 | 480 |
| 481 void preroll() const { this->onPreroll(); } |
| 482 |
481 SK_TO_STRING_VIRT() | 483 SK_TO_STRING_VIRT() |
482 SK_DEFINE_FLATTENABLE_TYPE(SkShader) | 484 SK_DEFINE_FLATTENABLE_TYPE(SkShader) |
483 | 485 |
484 protected: | 486 protected: |
485 void flatten(SkWriteBuffer&) const SK_OVERRIDE; | 487 void flatten(SkWriteBuffer&) const SK_OVERRIDE; |
486 | 488 |
487 bool computeTotalInverse(const ContextRec&, SkMatrix* totalInverse) const; | 489 bool computeTotalInverse(const ContextRec&, SkMatrix* totalInverse) const; |
488 | 490 |
489 /** | 491 /** |
490 * Your subclass must also override contextSize() if it overrides onCreateC
ontext(). | 492 * Your subclass must also override contextSize() if it overrides onCreateC
ontext(). |
491 * Base class impl returns NULL. | 493 * Base class impl returns NULL. |
492 */ | 494 */ |
493 virtual Context* onCreateContext(const ContextRec&, void* storage) const; | 495 virtual Context* onCreateContext(const ContextRec&, void* storage) const; |
494 | 496 |
| 497 virtual void onPreroll() const {} |
495 virtual bool onAsLuminanceColor(SkColor*) const { | 498 virtual bool onAsLuminanceColor(SkColor*) const { |
496 return false; | 499 return false; |
497 } | 500 } |
498 private: | 501 private: |
499 // This is essentially const, but not officially so it can be modified in | 502 // This is essentially const, but not officially so it can be modified in |
500 // constructors. | 503 // constructors. |
501 SkMatrix fLocalMatrix; | 504 SkMatrix fLocalMatrix; |
502 | 505 |
503 // So the SkLocalMatrixShader can whack fLocalMatrix in its SkReadBuffer con
structor. | 506 // So the SkLocalMatrixShader can whack fLocalMatrix in its SkReadBuffer con
structor. |
504 friend class SkLocalMatrixShader; | 507 friend class SkLocalMatrixShader; |
505 | 508 |
506 typedef SkFlattenable INHERITED; | 509 typedef SkFlattenable INHERITED; |
507 }; | 510 }; |
508 | 511 |
509 #endif | 512 #endif |
OLD | NEW |