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>
This commit is contained in:
Brian Salomon 2017-02-21 16:32:20 -05:00 committed by Skia Commit-Bot
parent 5d5601c429
commit 94cce4cb2c
7 changed files with 31 additions and 26 deletions

View File

@ -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",

View File

@ -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;

View File

@ -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;
}