| 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 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 337 * @param src The bitmap to use inside the shader | 337 * @param src The bitmap to use inside the shader |
| 338 * @param tmx The tiling mode to use when sampling the bitmap in the x-dir
ection. | 338 * @param tmx The tiling mode to use when sampling the bitmap in the x-dir
ection. |
| 339 * @param tmy The tiling mode to use when sampling the bitmap in the y-dir
ection. | 339 * @param tmy The tiling mode to use when sampling the bitmap in the y-dir
ection. |
| 340 * @return Returns a new shader object. Note: this function never retur
ns null. | 340 * @return Returns a new shader object. Note: this function never retur
ns null. |
| 341 */ | 341 */ |
| 342 static SkShader* CreateBitmapShader(const SkBitmap& src, | 342 static SkShader* CreateBitmapShader(const SkBitmap& src, |
| 343 TileMode tmx, TileMode tmy); | 343 TileMode tmx, TileMode tmy); |
| 344 | 344 |
| 345 SkDEVCODE(virtual void toString(SkString* str) const;) | 345 SkDEVCODE(virtual void toString(SkString* str) const;) |
| 346 | 346 |
| 347 SK_DEFINE_FLATTENABLE_TYPE(SkShader) |
| 348 |
| 347 protected: | 349 protected: |
| 348 enum MatrixClass { | 350 enum MatrixClass { |
| 349 kLinear_MatrixClass, // no perspective | 351 kLinear_MatrixClass, // no perspective |
| 350 kFixedStepInX_MatrixClass, // fast perspective, need to call fixedS
tepInX() each scanline | 352 kFixedStepInX_MatrixClass, // fast perspective, need to call fixedS
tepInX() each scanline |
| 351 kPerspective_MatrixClass // slow perspective, need to mappoints e
ach pixel | 353 kPerspective_MatrixClass // slow perspective, need to mappoints e
ach pixel |
| 352 }; | 354 }; |
| 353 static MatrixClass ComputeMatrixClass(const SkMatrix&); | 355 static MatrixClass ComputeMatrixClass(const SkMatrix&); |
| 354 | 356 |
| 355 // These can be called by your subclass after setContext() has been called | 357 // These can be called by your subclass after setContext() has been called |
| 356 uint8_t getPaintAlpha() const { return fPaintAlpha; } | 358 uint8_t getPaintAlpha() const { return fPaintAlpha; } |
| (...skipping 12 matching lines...) Expand all Loading... |
| 369 SkDEBUGCODE(SkBool8 fInSetContext;) | 371 SkDEBUGCODE(SkBool8 fInSetContext;) |
| 370 | 372 |
| 371 static SkShader* CreateBitmapShader(const SkBitmap& src, | 373 static SkShader* CreateBitmapShader(const SkBitmap& src, |
| 372 TileMode, TileMode, | 374 TileMode, TileMode, |
| 373 void* storage, size_t storageSize); | 375 void* storage, size_t storageSize); |
| 374 friend class SkAutoBitmapShaderInstall; | 376 friend class SkAutoBitmapShaderInstall; |
| 375 typedef SkFlattenable INHERITED; | 377 typedef SkFlattenable INHERITED; |
| 376 }; | 378 }; |
| 377 | 379 |
| 378 #endif | 380 #endif |
| OLD | NEW |