diff options
author | 2017-02-21 16:32:20 -0500 | |
---|---|---|
committer | 2017-02-21 22:27:17 +0000 | |
commit | 94cce4cb2cf40b5ed3a1928c02618c1a98b1e0fa (patch) | |
tree | bd311de3092f22788eb90123138e444347b752db | |
parent | 5d5601c42982482552b9cde144558ddce9f789da (diff) |
Make GrXferProcessor and related classes private.
Change-Id: I81ea6f5ea5c8b7b23848ef24524a7e48e531efe8
Reviewed-on: https://skia-review.googlesource.com/8819
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
-rw-r--r-- | gn/gpu.gni | 8 | ||||
-rw-r--r-- | include/gpu/GrPaint.h | 24 | ||||
-rw-r--r-- | src/gpu/GrPaint.cpp | 25 | ||||
-rw-r--r-- | src/gpu/GrXferProcessor.h (renamed from include/gpu/GrXferProcessor.h) | 0 | ||||
-rw-r--r-- | src/gpu/effects/GrCoverageSetOpXP.h (renamed from include/gpu/effects/GrCoverageSetOpXP.h) | 0 | ||||
-rw-r--r-- | src/gpu/effects/GrCustomXfermode.h (renamed from include/gpu/effects/GrCustomXfermode.h) | 0 | ||||
-rw-r--r-- | src/gpu/effects/GrPorterDuffXferProcessor.h (renamed from include/gpu/effects/GrPorterDuffXferProcessor.h) | 0 |
7 files changed, 31 insertions, 26 deletions
diff --git a/gn/gpu.gni b/gn/gpu.gni index db3ebc622f..11ac1cf5f4 100644 --- a/gn/gpu.gni +++ b/gn/gpu.gni @@ -39,13 +39,9 @@ skia_gpu_sources = [ "$_include/gpu/GrTestUtils.h", "$_include/gpu/GrTypes.h", "$_include/gpu/GrTypesPriv.h", - "$_include/gpu/GrXferProcessor.h", "$_include/gpu/effects/GrBlurredEdgeFragmentProcessor.h", "$_include/gpu/effects/GrConstColorProcessor.h", - "$_include/gpu/effects/GrCoverageSetOpXP.h", - "$_include/gpu/effects/GrCustomXfermode.h", - "$_include/gpu/effects/GrPorterDuffXferProcessor.h", "$_include/gpu/effects/GrXfermodeFragmentProcessor.h", "$_include/gpu/gl/GrGLAssembleInterface.h", @@ -225,6 +221,7 @@ skia_gpu_sources = [ "$_src/gpu/GrWindowRectangles.h", "$_src/gpu/GrWindowRectsState.h", "$_src/gpu/GrXferProcessor.cpp", + "$_src/gpu/GrXferProcessor.h", "$_src/gpu/GrYUVProvider.cpp", "$_src/gpu/GrYUVProvider.h", @@ -302,7 +299,9 @@ skia_gpu_sources = [ "$_src/gpu/effects/GrConfigConversionEffect.h", "$_src/gpu/effects/GrConstColorProcessor.cpp", "$_src/gpu/effects/GrCoverageSetOpXP.cpp", + "$_src/gpu/effects/GrCoverageSetOpXP.h", "$_src/gpu/effects/GrCustomXfermode.cpp", + "$_src/gpu/effects/GrCustomXfermode.h", "$_src/gpu/effects/GrBezierEffect.cpp", "$_src/gpu/effects/GrBezierEffect.h", "$_src/gpu/effects/GrConvexPolyEffect.cpp", @@ -324,6 +323,7 @@ skia_gpu_sources = [ "$_src/gpu/effects/GrOvalEffect.cpp", "$_src/gpu/effects/GrOvalEffect.h", "$_src/gpu/effects/GrPorterDuffXferProcessor.cpp", + "$_src/gpu/effects/GrPorterDuffXferProcessor.h", "$_src/gpu/effects/GrProxyMove.h", "$_src/gpu/effects/GrRRectEffect.cpp", "$_src/gpu/effects/GrRRectEffect.h", diff --git a/include/gpu/GrPaint.h b/include/gpu/GrPaint.h index edeec3fcb7..dbf75c1815 100644 --- a/include/gpu/GrPaint.h +++ b/include/gpu/GrPaint.h @@ -13,14 +13,13 @@ #include "GrColor.h" #include "GrColorSpaceXform.h" #include "GrFragmentProcessor.h" -#include "GrXferProcessor.h" #include "SkBlendMode.h" #include "SkRefCnt.h" #include "SkRegion.h" #include "SkTLazy.h" -#include "effects/GrPorterDuffXferProcessor.h" class GrTextureProxy; +class GrXPFactory; /** * The paint describes how color and coverage are computed at each pixel by GrContext draw @@ -86,7 +85,7 @@ public: void setXPFactory(const GrXPFactory* xpFactory) { fXPFactory = xpFactory; } - void setPorterDuffXPFactory(SkBlendMode mode) { fXPFactory = GrPorterDuffXPFactory::Get(mode); } + void setPorterDuffXPFactory(SkBlendMode mode); void setCoverageSetOpXPFactory(SkRegion::Op, bool invertCoverage = false); @@ -148,24 +147,7 @@ public: * coverage and color, so the actual values written to pixels with partial coverage may still * not seem constant, even if this function returns true. */ - bool isConstantBlendedColor(GrColor* constantColor) const { - // This used to do a more sophisticated analysis but now it just explicitly looks for common - // cases. - static const GrXPFactory* kSrc = GrPorterDuffXPFactory::Get(SkBlendMode::kSrc); - static const GrXPFactory* kClear = GrPorterDuffXPFactory::Get(SkBlendMode::kClear); - if (kClear == fXPFactory) { - *constantColor = GrColor_TRANSPARENT_BLACK; - return true; - } - if (this->numColorFragmentProcessors()) { - return false; - } - if (kSrc == fXPFactory || (!fXPFactory && fColor.isOpaque())) { - *constantColor = fColor.toGrColor(); - return true; - } - return false; - } + bool isConstantBlendedColor(GrColor* constantColor) const; private: template <bool> class MoveOrImpl; diff --git a/src/gpu/GrPaint.cpp b/src/gpu/GrPaint.cpp index 6d37adf5e9..0282bc38d2 100644 --- a/src/gpu/GrPaint.cpp +++ b/src/gpu/GrPaint.cpp @@ -6,12 +6,16 @@ */ #include "GrPaint.h" - #include "GrProcOptInfo.h" +#include "GrXferProcessor.h" #include "effects/GrCoverageSetOpXP.h" #include "effects/GrPorterDuffXferProcessor.h" #include "effects/GrSimpleTextureEffect.h" +void GrPaint::setPorterDuffXPFactory(SkBlendMode mode) { + fXPFactory = GrPorterDuffXPFactory::Get(mode); +} + void GrPaint::setCoverageSetOpXPFactory(SkRegion::Op regionOp, bool invertCoverage) { fXPFactory = GrCoverageSetOpXPFactory::Get(regionOp, invertCoverage); } @@ -74,3 +78,22 @@ void GrPaint::addCoverageTextureProcessor(GrContext* ctx, sk_sp<GrTextureProxy> this->addCoverageFragmentProcessor(GrSimpleTextureEffect::Make(ctx, std::move(proxy), nullptr, matrix, params)); } + +bool GrPaint::isConstantBlendedColor(GrColor* constantColor) const { + // This used to do a more sophisticated analysis but now it just explicitly looks for common + // cases. + static const GrXPFactory* kSrc = GrPorterDuffXPFactory::Get(SkBlendMode::kSrc); + static const GrXPFactory* kClear = GrPorterDuffXPFactory::Get(SkBlendMode::kClear); + if (kClear == fXPFactory) { + *constantColor = GrColor_TRANSPARENT_BLACK; + return true; + } + if (this->numColorFragmentProcessors()) { + return false; + } + if (kSrc == fXPFactory || (!fXPFactory && fColor.isOpaque())) { + *constantColor = fColor.toGrColor(); + return true; + } + return false; +} diff --git a/include/gpu/GrXferProcessor.h b/src/gpu/GrXferProcessor.h index 9cb7189133..9cb7189133 100644 --- a/include/gpu/GrXferProcessor.h +++ b/src/gpu/GrXferProcessor.h diff --git a/include/gpu/effects/GrCoverageSetOpXP.h b/src/gpu/effects/GrCoverageSetOpXP.h index 7c9f909978..7c9f909978 100644 --- a/include/gpu/effects/GrCoverageSetOpXP.h +++ b/src/gpu/effects/GrCoverageSetOpXP.h diff --git a/include/gpu/effects/GrCustomXfermode.h b/src/gpu/effects/GrCustomXfermode.h index 54309ddafc..54309ddafc 100644 --- a/include/gpu/effects/GrCustomXfermode.h +++ b/src/gpu/effects/GrCustomXfermode.h diff --git a/include/gpu/effects/GrPorterDuffXferProcessor.h b/src/gpu/effects/GrPorterDuffXferProcessor.h index e6e676d6cc..e6e676d6cc 100644 --- a/include/gpu/effects/GrPorterDuffXferProcessor.h +++ b/src/gpu/effects/GrPorterDuffXferProcessor.h |