OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2006 The Android Open Source Project | 3 * Copyright 2006 The Android Open Source Project |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 | 9 |
10 #ifndef SkComposeShader_DEFINED | 10 #ifndef SkComposeShader_DEFINED |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 Context* onCreateContext(const ContextRec&, void*) const override; | 77 Context* onCreateContext(const ContextRec&, void*) const override; |
78 | 78 |
79 private: | 79 private: |
80 SkShader* fShaderA; | 80 SkShader* fShaderA; |
81 SkShader* fShaderB; | 81 SkShader* fShaderB; |
82 SkXfermode* fMode; | 82 SkXfermode* fMode; |
83 | 83 |
84 typedef SkShader INHERITED; | 84 typedef SkShader INHERITED; |
85 }; | 85 }; |
86 | 86 |
| 87 #if SK_SUPPORT_GPU |
| 88 |
| 89 #include "SkString.h" |
| 90 #include "../gpu/GrFragmentProcessor.h" |
| 91 |
| 92 ///////////////////////////////////////////////////////////////////// |
| 93 |
| 94 class GrComposeEffect : public GrFragmentProcessor { |
| 95 public: |
| 96 |
| 97 static GrFragmentProcessor* Create(const GrFragmentProcessor* fpA, |
| 98 const GrFragmentProcessor* fpB, |
| 99 SkXfermode::Mode mode); |
| 100 const char* name() const override {return fName.c_str(); } |
| 101 void onGetGLProcessorKey(const GrGLSLCaps& caps, GrProcessorKeyBuilder* b) c
onst override; |
| 102 |
| 103 SkXfermode::Mode getMode() const { return fMode; } |
| 104 int getShaderAChildIndex() const { return fShaderAChildIndex; } |
| 105 int getShaderBChildIndex() const { return fShaderBChildIndex; } |
| 106 |
| 107 protected: |
| 108 bool onIsEqual(const GrFragmentProcessor&) const override; |
| 109 void onComputeInvariantOutput(GrInvariantOutput* inout) const override; |
| 110 |
| 111 private: |
| 112 GrComposeEffect(const GrFragmentProcessor* fpA, const GrFragmentProcessor* f
pB, |
| 113 SkXfermode::Mode mode); |
| 114 |
| 115 GrGLFragmentProcessor* onCreateGLInstance() const override; |
| 116 |
| 117 SkString fName; |
| 118 int fShaderAChildIndex; |
| 119 int fShaderBChildIndex; |
| 120 SkXfermode::Mode fMode; |
| 121 |
| 122 GR_DECLARE_FRAGMENT_PROCESSOR_TEST; |
| 123 |
| 124 typedef GrFragmentProcessor INHERITED; |
| 125 }; |
| 126 |
87 #endif | 127 #endif |
| 128 |
| 129 #endif |
OLD | NEW |