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