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 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
352 /** | 352 /** |
353 * Return a shader that will apply the specified localMatrix to this shader
. | 353 * Return a shader that will apply the specified localMatrix to this shader
. |
354 * The specified matrix will be applied before any matrix associated with t
his shader. | 354 * The specified matrix will be applied before any matrix associated with t
his shader. |
355 */ | 355 */ |
356 sk_sp<SkShader> makeWithLocalMatrix(const SkMatrix&) const; | 356 sk_sp<SkShader> makeWithLocalMatrix(const SkMatrix&) const; |
357 | 357 |
358 /** | 358 /** |
359 * Create a new shader that produces the same colors as invoking this shade
r and then applying | 359 * Create a new shader that produces the same colors as invoking this shade
r and then applying |
360 * the colorfilter. | 360 * the colorfilter. |
361 */ | 361 */ |
362 sk_sp<SkShader> makeWithColorFilter(sk_sp<SkColorFilter>) const; | 362 sk_sp<SkShader> makeWithColorFilter(SkColorFilter*) const; |
363 | 363 |
364 ////////////////////////////////////////////////////////////////////////// | 364 ////////////////////////////////////////////////////////////////////////// |
365 // Factory methods for stock shaders | 365 // Factory methods for stock shaders |
366 | 366 |
367 /** | 367 /** |
368 * Call this to create a new "empty" shader, that will not draw anything. | 368 * Call this to create a new "empty" shader, that will not draw anything. |
369 */ | 369 */ |
370 static sk_sp<SkShader> MakeEmptyShader(); | 370 static sk_sp<SkShader> MakeEmptyShader(); |
371 | 371 |
372 /** | 372 /** |
(...skipping 13 matching lines...) Expand all Loading... |
386 return MakeBitmapShader(src, tmx, tmy, localMatrix).release(); | 386 return MakeBitmapShader(src, tmx, tmy, localMatrix).release(); |
387 } | 387 } |
388 static SkShader* CreateComposeShader(SkShader* dst, SkShader* src, SkXfermod
e::Mode mode); | 388 static SkShader* CreateComposeShader(SkShader* dst, SkShader* src, SkXfermod
e::Mode mode); |
389 static SkShader* CreateComposeShader(SkShader* dst, SkShader* src, SkXfermod
e* xfer); | 389 static SkShader* CreateComposeShader(SkShader* dst, SkShader* src, SkXfermod
e* xfer); |
390 static SkShader* CreatePictureShader(const SkPicture* src, TileMode tmx, Til
eMode tmy, | 390 static SkShader* CreatePictureShader(const SkPicture* src, TileMode tmx, Til
eMode tmy, |
391 const SkMatrix* localMatrix, const SkRe
ct* tile); | 391 const SkMatrix* localMatrix, const SkRe
ct* tile); |
392 | 392 |
393 SkShader* newWithLocalMatrix(const SkMatrix& matrix) const { | 393 SkShader* newWithLocalMatrix(const SkMatrix& matrix) const { |
394 return this->makeWithLocalMatrix(matrix).release(); | 394 return this->makeWithLocalMatrix(matrix).release(); |
395 } | 395 } |
396 SkShader* newWithColorFilter(SkColorFilter* filter) const; | 396 SkShader* newWithColorFilter(SkColorFilter* filter) const { |
| 397 return this->makeWithColorFilter(filter).release(); |
| 398 } |
397 #endif | 399 #endif |
398 | 400 |
399 /** | 401 /** |
400 * Create a new compose shader, given shaders dst, src, and a combining xfe
rmode mode. | 402 * Create a new compose shader, given shaders dst, src, and a combining xfe
rmode mode. |
401 * The xfermode is called with the output of the two shaders, and its outpu
t is returned. | 403 * The xfermode is called with the output of the two shaders, and its outpu
t is returned. |
402 * If xfer is null, SkXfermode::kSrcOver_Mode is assumed. | 404 * If xfer is null, SkXfermode::kSrcOver_Mode is assumed. |
403 * | 405 * |
404 * The caller is responsible for managing its reference-count for the xfer
(if not null). | 406 * The caller is responsible for managing its reference-count for the xfer
(if not null). |
405 */ | 407 */ |
406 static sk_sp<SkShader> MakeComposeShader(sk_sp<SkShader> dst, sk_sp<SkShader
> src, | 408 static sk_sp<SkShader> MakeComposeShader(sk_sp<SkShader> dst, sk_sp<SkShader
> src, |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
485 SkMatrix fLocalMatrix; | 487 SkMatrix fLocalMatrix; |
486 | 488 |
487 // So the SkLocalMatrixShader can whack fLocalMatrix in its SkReadBuffer con
structor. | 489 // So the SkLocalMatrixShader can whack fLocalMatrix in its SkReadBuffer con
structor. |
488 friend class SkLocalMatrixShader; | 490 friend class SkLocalMatrixShader; |
489 friend class SkBitmapProcShader; // for computeTotalInverse() | 491 friend class SkBitmapProcShader; // for computeTotalInverse() |
490 | 492 |
491 typedef SkFlattenable INHERITED; | 493 typedef SkFlattenable INHERITED; |
492 }; | 494 }; |
493 | 495 |
494 #endif | 496 #endif |
OLD | NEW |