| 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 779 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 790 class XferEffect : public GrEffect { | 790 class XferEffect : public GrEffect { |
| 791 public: | 791 public: |
| 792 static bool IsSupportedMode(SkXfermode::Mode mode) { | 792 static bool IsSupportedMode(SkXfermode::Mode mode) { |
| 793 return mode > SkXfermode::kLastCoeffMode && mode <= SkXfermode::kLastMod
e; | 793 return mode > SkXfermode::kLastCoeffMode && mode <= SkXfermode::kLastMod
e; |
| 794 } | 794 } |
| 795 | 795 |
| 796 static GrEffectRef* Create(SkXfermode::Mode mode, GrTexture* background) { | 796 static GrEffectRef* Create(SkXfermode::Mode mode, GrTexture* background) { |
| 797 if (!IsSupportedMode(mode)) { | 797 if (!IsSupportedMode(mode)) { |
| 798 return NULL; | 798 return NULL; |
| 799 } else { | 799 } else { |
| 800 AutoEffectUnref effect(SkNEW_ARGS(XferEffect, (mode, background))); | 800 return SkNEW_ARGS(XferEffect, (mode, background)); |
| 801 return CreateEffectRef(effect); | |
| 802 } | 801 } |
| 803 } | 802 } |
| 804 | 803 |
| 805 virtual void getConstantColorComponents(GrColor* color, | 804 virtual void getConstantColorComponents(GrColor* color, |
| 806 uint32_t* validFlags) const SK_OVERR
IDE { | 805 uint32_t* validFlags) const SK_OVERR
IDE { |
| 807 *validFlags = 0; | 806 *validFlags = 0; |
| 808 } | 807 } |
| 809 | 808 |
| 810 virtual const GrBackendEffectFactory& getFactory() const SK_OVERRIDE { | 809 virtual const GrBackendEffectFactory& getFactory() const SK_OVERRIDE { |
| 811 return GrTBackendEffectFactory<XferEffect>::getInstance(); | 810 return GrTBackendEffectFactory<XferEffect>::getInstance(); |
| (...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1223 typedef GrEffect INHERITED; | 1222 typedef GrEffect INHERITED; |
| 1224 }; | 1223 }; |
| 1225 | 1224 |
| 1226 GR_DEFINE_EFFECT_TEST(XferEffect); | 1225 GR_DEFINE_EFFECT_TEST(XferEffect); |
| 1227 GrEffectRef* XferEffect::TestCreate(SkRandom* rand, | 1226 GrEffectRef* XferEffect::TestCreate(SkRandom* rand, |
| 1228 GrContext*, | 1227 GrContext*, |
| 1229 const GrDrawTargetCaps&, | 1228 const GrDrawTargetCaps&, |
| 1230 GrTexture*[]) { | 1229 GrTexture*[]) { |
| 1231 int mode = rand->nextRangeU(SkXfermode::kLastCoeffMode + 1, SkXfermode::kLas
tSeparableMode); | 1230 int mode = rand->nextRangeU(SkXfermode::kLastCoeffMode + 1, SkXfermode::kLas
tSeparableMode); |
| 1232 | 1231 |
| 1233 AutoEffectUnref gEffect(SkNEW_ARGS(XferEffect, (static_cast<SkXfermode::Mode
>(mode), NULL))); | 1232 return SkNEW_ARGS(XferEffect, (static_cast<SkXfermode::Mode>(mode), NULL)); |
| 1234 return CreateEffectRef(gEffect); | |
| 1235 } | 1233 } |
| 1236 | 1234 |
| 1237 #endif | 1235 #endif |
| 1238 | 1236 |
| 1239 /////////////////////////////////////////////////////////////////////////////// | 1237 /////////////////////////////////////////////////////////////////////////////// |
| 1240 /////////////////////////////////////////////////////////////////////////////// | 1238 /////////////////////////////////////////////////////////////////////////////// |
| 1241 | 1239 |
| 1242 SkProcCoeffXfermode::SkProcCoeffXfermode(SkReadBuffer& buffer) : INHERITED(buffe
r) { | 1240 SkProcCoeffXfermode::SkProcCoeffXfermode(SkReadBuffer& buffer) : INHERITED(buffe
r) { |
| 1243 uint32_t mode32 = buffer.read32() % SK_ARRAY_COUNT(gProcCoeffs); | 1241 uint32_t mode32 = buffer.read32() % SK_ARRAY_COUNT(gProcCoeffs); |
| 1244 if (mode32 >= SK_ARRAY_COUNT(gProcCoeffs)) { | 1242 if (mode32 >= SK_ARRAY_COUNT(gProcCoeffs)) { |
| (...skipping 711 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1956 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkSrcXfermode) | 1954 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkSrcXfermode) |
| 1957 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkDstInXfermode) | 1955 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkDstInXfermode) |
| 1958 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkDstOutXfermode) | 1956 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkDstOutXfermode) |
| 1959 #if !SK_ARM_NEON_IS_NONE | 1957 #if !SK_ARM_NEON_IS_NONE |
| 1960 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkNEONProcCoeffXfermode) | 1958 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkNEONProcCoeffXfermode) |
| 1961 #endif | 1959 #endif |
| 1962 #if defined(SK_CPU_X86) && !defined(SK_BUILD_FOR_IOS) | 1960 #if defined(SK_CPU_X86) && !defined(SK_BUILD_FOR_IOS) |
| 1963 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkSSE2ProcCoeffXfermode) | 1961 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkSSE2ProcCoeffXfermode) |
| 1964 #endif | 1962 #endif |
| 1965 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END | 1963 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END |
| OLD | NEW |