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 #include "SkXfermode.h" | 10 #include "SkXfermode.h" |
(...skipping 781 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
792 } | 792 } |
793 | 793 |
794 static GrFragmentProcessor* Create(SkXfermode::Mode mode, GrTexture* backgro
und) { | 794 static GrFragmentProcessor* Create(SkXfermode::Mode mode, GrTexture* backgro
und) { |
795 if (!IsSupportedMode(mode)) { | 795 if (!IsSupportedMode(mode)) { |
796 return NULL; | 796 return NULL; |
797 } else { | 797 } else { |
798 return SkNEW_ARGS(XferEffect, (mode, background)); | 798 return SkNEW_ARGS(XferEffect, (mode, background)); |
799 } | 799 } |
800 } | 800 } |
801 | 801 |
| 802 virtual void getConstantColorComponents(GrColor* color, |
| 803 uint32_t* validFlags) const SK_OVERR
IDE { |
| 804 *validFlags = 0; |
| 805 } |
| 806 |
802 virtual const GrBackendFragmentProcessorFactory& getFactory() const SK_OVERR
IDE { | 807 virtual const GrBackendFragmentProcessorFactory& getFactory() const SK_OVERR
IDE { |
803 return GrTBackendFragmentProcessorFactory<XferEffect>::getInstance(); | 808 return GrTBackendFragmentProcessorFactory<XferEffect>::getInstance(); |
804 } | 809 } |
805 | 810 |
806 static const char* Name() { return "XferEffect"; } | 811 static const char* Name() { return "XferEffect"; } |
807 | 812 |
808 SkXfermode::Mode mode() const { return fMode; } | 813 SkXfermode::Mode mode() const { return fMode; } |
809 const GrTextureAccess& backgroundAccess() const { return fBackgroundAccess;
} | 814 const GrTextureAccess& backgroundAccess() const { return fBackgroundAccess;
} |
810 | 815 |
811 class GLProcessor : public GrGLFragmentProcessor { | 816 class GLProcessor : public GrGLFragmentProcessor { |
(...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1204 this->addTextureAccess(&fBackgroundAccess); | 1209 this->addTextureAccess(&fBackgroundAccess); |
1205 } else { | 1210 } else { |
1206 this->setWillReadDstColor(); | 1211 this->setWillReadDstColor(); |
1207 } | 1212 } |
1208 } | 1213 } |
1209 virtual bool onIsEqual(const GrProcessor& other) const SK_OVERRIDE { | 1214 virtual bool onIsEqual(const GrProcessor& other) const SK_OVERRIDE { |
1210 const XferEffect& s = other.cast<XferEffect>(); | 1215 const XferEffect& s = other.cast<XferEffect>(); |
1211 return fMode == s.fMode && | 1216 return fMode == s.fMode && |
1212 fBackgroundAccess.getTexture() == s.fBackgroundAccess.getTexture(
); | 1217 fBackgroundAccess.getTexture() == s.fBackgroundAccess.getTexture(
); |
1213 } | 1218 } |
1214 | |
1215 virtual void onComputeInvariantOutput(InvariantOutput* inout) const SK_OVERR
IDE { | |
1216 inout->fValidFlags = 0; | |
1217 inout->fIsSingleComponent = false; | |
1218 } | |
1219 | 1219 |
1220 SkXfermode::Mode fMode; | 1220 SkXfermode::Mode fMode; |
1221 GrCoordTransform fBackgroundTransform; | 1221 GrCoordTransform fBackgroundTransform; |
1222 GrTextureAccess fBackgroundAccess; | 1222 GrTextureAccess fBackgroundAccess; |
1223 | 1223 |
1224 typedef GrFragmentProcessor INHERITED; | 1224 typedef GrFragmentProcessor INHERITED; |
1225 }; | 1225 }; |
1226 | 1226 |
1227 GR_DEFINE_FRAGMENT_PROCESSOR_TEST(XferEffect); | 1227 GR_DEFINE_FRAGMENT_PROCESSOR_TEST(XferEffect); |
1228 GrFragmentProcessor* XferEffect::TestCreate(SkRandom* rand, | 1228 GrFragmentProcessor* XferEffect::TestCreate(SkRandom* rand, |
(...skipping 726 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1955 } else { | 1955 } else { |
1956 proc16 = rec.fProc16_General; | 1956 proc16 = rec.fProc16_General; |
1957 } | 1957 } |
1958 } | 1958 } |
1959 return proc16; | 1959 return proc16; |
1960 } | 1960 } |
1961 | 1961 |
1962 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkXfermode) | 1962 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkXfermode) |
1963 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkProcCoeffXfermode) | 1963 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkProcCoeffXfermode) |
1964 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END | 1964 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END |
OLD | NEW |