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

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

Issue 374923002: Goodbye GrEffectRef. (Closed) Base URL: https://skia.googlesource.com/skia.git@noref3
Patch Set: Address comments 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 | « src/core/SkShader.cpp ('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 775 matching lines...) Expand 10 before | Expand all | Expand 10 after
786 786
787 /** 787 /**
788 * GrEffect that implements the all the separable xfer modes that cannot be expr essed as Coeffs. 788 * GrEffect that implements the all the separable xfer modes that cannot be expr essed as Coeffs.
789 */ 789 */
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 GrEffect* 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 return SkNEW_ARGS(XferEffect, (mode, background)); 800 return SkNEW_ARGS(XferEffect, (mode, background));
801 } 801 }
802 } 802 }
803 803
804 virtual void getConstantColorComponents(GrColor* color, 804 virtual void getConstantColorComponents(GrColor* color,
805 uint32_t* validFlags) const SK_OVERR IDE { 805 uint32_t* validFlags) const SK_OVERR IDE {
806 *validFlags = 0; 806 *validFlags = 0;
(...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after
1216 } 1216 }
1217 1217
1218 SkXfermode::Mode fMode; 1218 SkXfermode::Mode fMode;
1219 GrCoordTransform fBackgroundTransform; 1219 GrCoordTransform fBackgroundTransform;
1220 GrTextureAccess fBackgroundAccess; 1220 GrTextureAccess fBackgroundAccess;
1221 1221
1222 typedef GrEffect INHERITED; 1222 typedef GrEffect INHERITED;
1223 }; 1223 };
1224 1224
1225 GR_DEFINE_EFFECT_TEST(XferEffect); 1225 GR_DEFINE_EFFECT_TEST(XferEffect);
1226 GrEffectRef* XferEffect::TestCreate(SkRandom* rand, 1226 GrEffect* XferEffect::TestCreate(SkRandom* rand,
1227 GrContext*, 1227 GrContext*,
1228 const GrDrawTargetCaps&, 1228 const GrDrawTargetCaps&,
1229 GrTexture*[]) { 1229 GrTexture*[]) {
1230 int mode = rand->nextRangeU(SkXfermode::kLastCoeffMode + 1, SkXfermode::kLas tSeparableMode); 1230 int mode = rand->nextRangeU(SkXfermode::kLastCoeffMode + 1, SkXfermode::kLas tSeparableMode);
1231 1231
1232 return SkNEW_ARGS(XferEffect, (static_cast<SkXfermode::Mode>(mode), NULL)); 1232 return SkNEW_ARGS(XferEffect, (static_cast<SkXfermode::Mode>(mode), NULL));
1233 } 1233 }
1234 1234
1235 #endif 1235 #endif
1236 1236
1237 /////////////////////////////////////////////////////////////////////////////// 1237 ///////////////////////////////////////////////////////////////////////////////
1238 /////////////////////////////////////////////////////////////////////////////// 1238 ///////////////////////////////////////////////////////////////////////////////
1239 1239
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
1354 A = SkAlphaBlend(A, dstA, SkAlpha255To256(a)); 1354 A = SkAlphaBlend(A, dstA, SkAlpha255To256(a));
1355 } 1355 }
1356 dst[i] = SkToU8(A); 1356 dst[i] = SkToU8(A);
1357 } 1357 }
1358 } 1358 }
1359 } 1359 }
1360 } 1360 }
1361 } 1361 }
1362 1362
1363 #if SK_SUPPORT_GPU 1363 #if SK_SUPPORT_GPU
1364 bool SkProcCoeffXfermode::asNewEffect(GrEffectRef** effect, 1364 bool SkProcCoeffXfermode::asNewEffect(GrEffect** effect, GrTexture* background) const {
1365 GrTexture* background) const {
1366 if (XferEffect::IsSupportedMode(fMode)) { 1365 if (XferEffect::IsSupportedMode(fMode)) {
1367 if (NULL != effect) { 1366 if (NULL != effect) {
1368 *effect = XferEffect::Create(fMode, background); 1367 *effect = XferEffect::Create(fMode, background);
1369 SkASSERT(NULL != *effect); 1368 SkASSERT(NULL != *effect);
1370 } 1369 }
1371 return true; 1370 return true;
1372 } 1371 }
1373 return false; 1372 return false;
1374 } 1373 }
1375 #endif 1374 #endif
(...skipping 578 matching lines...) Expand 10 before | Expand all | Expand 10 after
1954 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkSrcXfermode) 1953 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkSrcXfermode)
1955 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkDstInXfermode) 1954 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkDstInXfermode)
1956 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkDstOutXfermode) 1955 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkDstOutXfermode)
1957 #if !SK_ARM_NEON_IS_NONE 1956 #if !SK_ARM_NEON_IS_NONE
1958 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkNEONProcCoeffXfermode) 1957 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkNEONProcCoeffXfermode)
1959 #endif 1958 #endif
1960 #if defined(SK_CPU_X86) && !defined(SK_BUILD_FOR_IOS) 1959 #if defined(SK_CPU_X86) && !defined(SK_BUILD_FOR_IOS)
1961 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkSSE2ProcCoeffXfermode) 1960 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkSSE2ProcCoeffXfermode)
1962 #endif 1961 #endif
1963 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END 1962 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END
OLDNEW
« no previous file with comments | « src/core/SkShader.cpp ('k') | src/effects/SkAlphaThresholdFilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698