Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(322)

Side by Side Diff: src/core/SkXfermode.cpp

Issue 371103003: Remove GrEffect::CreateEffectRef and GrEffect::AutoEffectRef. (Closed) Base URL: https://skia.googlesource.com/skia.git@no_ref2
Patch Set: Address comments and update for new YUV effect Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « include/gpu/GrEffect.h ('k') | src/effects/SkAlphaThresholdFilter.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
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
OLDNEW
« no previous file with comments | « include/gpu/GrEffect.h ('k') | src/effects/SkAlphaThresholdFilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698