epoger@google.com | ec3ed6a | 2011-07-28 14:26:00 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2006 The Android Open Source Project |
| 3 | * |
| 4 | * Use of this source code is governed by a BSD-style license that can be |
| 5 | * found in the LICENSE file. |
| 6 | */ |
| 7 | |
reed@google.com | 8d4dc71 | 2014-04-18 15:14:25 +0000 | [diff] [blame] | 8 | #ifndef SkPaintPart_DEFINED |
| 9 | #define SkPaintPart_DEFINED |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 10 | |
| 11 | #include "SkDisplayable.h" |
| 12 | #include "SkMemberInfo.h" |
| 13 | #include "SkPaint.h" |
| 14 | #include "SkShader.h" |
| 15 | #include "SkTypeface.h" |
| 16 | #include "SkXfermode.h" |
| 17 | |
| 18 | class SkDrawPaint; |
| 19 | class SkDrawMatrix; |
| 20 | |
| 21 | class SkPaintPart : public SkDisplayable { |
| 22 | public: |
| 23 | SkPaintPart(); |
| 24 | virtual bool add() = 0; |
| 25 | virtual SkDisplayable* getParent() const; |
| 26 | virtual bool setParent(SkDisplayable* parent); |
| 27 | #ifdef SK_DEBUG |
| 28 | virtual bool isPaintPart() const { return true; } |
| 29 | #endif |
| 30 | protected: |
| 31 | SkDrawPaint* fPaint; |
| 32 | }; |
| 33 | |
| 34 | class SkDrawMaskFilter : public SkPaintPart { |
| 35 | DECLARE_EMPTY_MEMBER_INFO(MaskFilter); |
| 36 | virtual SkMaskFilter* getMaskFilter(); |
| 37 | protected: |
mtklein | 36352bf | 2015-03-25 18:17:31 -0700 | [diff] [blame] | 38 | bool add() override; |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 39 | }; |
| 40 | |
| 41 | class SkDrawPathEffect : public SkPaintPart { |
| 42 | DECLARE_EMPTY_MEMBER_INFO(PathEffect); |
| 43 | virtual SkPathEffect* getPathEffect(); |
| 44 | protected: |
mtklein | 36352bf | 2015-03-25 18:17:31 -0700 | [diff] [blame] | 45 | bool add() override; |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 46 | }; |
| 47 | |
| 48 | class SkDrawShader : public SkPaintPart { |
| 49 | DECLARE_DRAW_MEMBER_INFO(Shader); |
| 50 | SkDrawShader(); |
| 51 | virtual SkShader* getShader(); |
| 52 | protected: |
mtklein | 36352bf | 2015-03-25 18:17:31 -0700 | [diff] [blame] | 53 | bool add() override; |
halcanary | 96fcdcc | 2015-08-27 07:41:13 -0700 | [diff] [blame] | 54 | SkMatrix* getMatrix(); // returns nullptr if matrix is nullptr |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 55 | SkDrawMatrix* matrix; |
| 56 | int /*SkShader::TileMode*/ tileMode; |
| 57 | }; |
| 58 | |
| 59 | class SkDrawTypeface : public SkPaintPart { |
| 60 | DECLARE_DRAW_MEMBER_INFO(Typeface); |
| 61 | SkDrawTypeface(); |
| 62 | #ifdef SK_DUMP_ENABLED |
mtklein | 36352bf | 2015-03-25 18:17:31 -0700 | [diff] [blame] | 63 | void dump(SkAnimateMaker *) override; |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 64 | #endif |
bungeman | 13b9c95 | 2016-05-12 10:09:30 -0700 | [diff] [blame] | 65 | sk_sp<SkTypeface> getTypeface() { return SkTypeface::MakeFromName(fontName.c_str(), style); } |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 66 | protected: |
mtklein | 36352bf | 2015-03-25 18:17:31 -0700 | [diff] [blame] | 67 | bool add() override; |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 68 | SkString fontName; |
| 69 | SkTypeface::Style style; |
| 70 | }; |
| 71 | |
reed@google.com | 8d4dc71 | 2014-04-18 15:14:25 +0000 | [diff] [blame] | 72 | #endif // SkPaintPart_DEFINED |