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 462 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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(); } | 481 void preroll() const { this->onPreroll(); } |
482 | 482 |
483 SK_TO_STRING_VIRT() | 483 SK_TO_STRING_PUREVIRT() |
484 SK_DEFINE_FLATTENABLE_TYPE(SkShader) | 484 SK_DEFINE_FLATTENABLE_TYPE(SkShader) |
485 | 485 |
486 protected: | 486 protected: |
487 void flatten(SkWriteBuffer&) const SK_OVERRIDE; | 487 void flatten(SkWriteBuffer&) const SK_OVERRIDE; |
488 | 488 |
489 bool computeTotalInverse(const ContextRec&, SkMatrix* totalInverse) const; | 489 bool computeTotalInverse(const ContextRec&, SkMatrix* totalInverse) const; |
490 | 490 |
491 /** | 491 /** |
492 * Your subclass must also override contextSize() if it overrides onCreateC
ontext(). | 492 * Your subclass must also override contextSize() if it overrides onCreateC
ontext(). |
493 * Base class impl returns NULL. | 493 * Base class impl returns NULL. |
494 */ | 494 */ |
495 virtual Context* onCreateContext(const ContextRec&, void* storage) const; | 495 virtual Context* onCreateContext(const ContextRec&, void* storage) const; |
496 | 496 |
497 virtual void onPreroll() const {} | 497 virtual void onPreroll() const {} |
498 virtual bool onAsLuminanceColor(SkColor*) const { | 498 virtual bool onAsLuminanceColor(SkColor*) const { |
499 return false; | 499 return false; |
500 } | 500 } |
501 private: | 501 private: |
502 // 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 |
503 // constructors. | 503 // constructors. |
504 SkMatrix fLocalMatrix; | 504 SkMatrix fLocalMatrix; |
505 | 505 |
506 // So the SkLocalMatrixShader can whack fLocalMatrix in its SkReadBuffer con
structor. | 506 // So the SkLocalMatrixShader can whack fLocalMatrix in its SkReadBuffer con
structor. |
507 friend class SkLocalMatrixShader; | 507 friend class SkLocalMatrixShader; |
508 | 508 |
509 typedef SkFlattenable INHERITED; | 509 typedef SkFlattenable INHERITED; |
510 }; | 510 }; |
511 | 511 |
512 #endif | 512 #endif |
OLD | NEW |