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 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
394 * is incremented). The SkPicture must not be changed after | 394 * is incremented). The SkPicture must not be changed after |
395 * successfully creating a picture shader. | 395 * successfully creating a picture shader. |
396 * FIXME: src cannot be const due to SkCanvas::drawPicture | 396 * FIXME: src cannot be const due to SkCanvas::drawPicture |
397 * @param tmx The tiling mode to use when sampling the bitmap in the x-dir
ection. | 397 * @param tmx The tiling mode to use when sampling the bitmap in the x-dir
ection. |
398 * @param tmy The tiling mode to use when sampling the bitmap in the y-dir
ection. | 398 * @param tmy The tiling mode to use when sampling the bitmap in the y-dir
ection. |
399 * @return Returns a new shader object. Note: this function never retur
ns null. | 399 * @return Returns a new shader object. Note: this function never retur
ns null. |
400 */ | 400 */ |
401 static SkShader* CreatePictureShader(SkPicture* src, TileMode tmx, TileMode
tmy, | 401 static SkShader* CreatePictureShader(SkPicture* src, TileMode tmx, TileMode
tmy, |
402 const SkMatrix* localMatrix = NULL); | 402 const SkMatrix* localMatrix = NULL); |
403 | 403 |
| 404 /** |
| 405 * Return a shader that will apply the specified localMatrix to the proxy s
hader. |
| 406 * The specified matrix will be applied before any matrix associated with t
he proxy. |
| 407 * |
| 408 * Note: ownership of the proxy is not transferred (though a ref is taken). |
| 409 */ |
| 410 static SkShader* CreateLocalMatrixShader(SkShader* proxy, const SkMatrix& lo
calMatrix); |
| 411 |
| 412 /** |
| 413 * If this shader can be represented by another shader + a localMatrix, ret
urn that shader |
| 414 * and, if not NULL, the localMatrix. If not, return NULL and ignore the lo
calMatrix parameter. |
| 415 * |
| 416 * Note: the returned shader (if not NULL) will have been ref'd, and it is
the responsibility |
| 417 * of the caller to balance that with unref() when they are done. |
| 418 */ |
| 419 virtual SkShader* refAsALocalMatrixShader(SkMatrix* localMatrix) const; |
| 420 |
404 SK_TO_STRING_VIRT() | 421 SK_TO_STRING_VIRT() |
405 SK_DEFINE_FLATTENABLE_TYPE(SkShader) | 422 SK_DEFINE_FLATTENABLE_TYPE(SkShader) |
406 | 423 |
407 protected: | 424 protected: |
408 SkShader(SkReadBuffer& ); | 425 SkShader(SkReadBuffer& ); |
409 virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE; | 426 virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE; |
410 | 427 |
411 bool computeTotalInverse(const ContextRec&, SkMatrix* totalInverse) const; | 428 bool computeTotalInverse(const ContextRec&, SkMatrix* totalInverse) const; |
412 | 429 |
413 /** | 430 /** |
414 * Your subclass must also override contextSize() if it overrides onCreateC
ontext(). | 431 * Your subclass must also override contextSize() if it overrides onCreateC
ontext(). |
415 * Base class impl returns NULL. | 432 * Base class impl returns NULL. |
416 */ | 433 */ |
417 virtual Context* onCreateContext(const ContextRec&, void* storage) const; | 434 virtual Context* onCreateContext(const ContextRec&, void* storage) const; |
418 | 435 |
419 private: | 436 private: |
420 SkMatrix fLocalMatrix; | 437 SkMatrix fLocalMatrix; |
421 | 438 |
422 typedef SkFlattenable INHERITED; | 439 typedef SkFlattenable INHERITED; |
423 }; | 440 }; |
424 | 441 |
425 #endif | 442 #endif |
OLD | NEW |