remove unneeded methods

Bug: skia:
Change-Id: I7256abb1a56abf961e66c399e868a8eb2478c02b
Reviewed-on: https://skia-review.googlesource.com/19396
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
This commit is contained in:
Mike Reed 2017-06-10 14:07:36 -04:00 committed by Skia Commit-Bot
parent 5eee919c46
commit 2f07c28a86
5 changed files with 7 additions and 108 deletions

View File

@ -24,11 +24,6 @@ static inline void SkBlendMode_AppendStages(SkBlendMode mode, SkRasterPipeline*
SkBlendMode_AppendClampIfNeeded(mode, p);
}
#if SK_SUPPORT_GPU
#include "GrXferProcessor.h"
const GrXPFactory* SkBlendMode_AsXPFactory(SkBlendMode);
#endif
enum class SkBlendModeCoeff {
kZero, /** 0 */
kOne, /** 1 */
@ -48,4 +43,9 @@ bool SkBlendMode_AsCoeff(SkBlendMode mode, SkBlendModeCoeff* src, SkBlendModeCoe
SkPM4f SkBlendMode_Apply(SkBlendMode, const SkPM4f& src, const SkPM4f& dst);
#if SK_SUPPORT_GPU
#include "GrXferProcessor.h"
const GrXPFactory* SkBlendMode_AsXPFactory(SkBlendMode);
#endif
#endif

View File

@ -655,37 +655,9 @@ const SkXfermodeProc gProcs[] = {
luminosity_modeproc,
};
bool SkXfermode::asMode(SkBlendMode* mode) const {
return false;
}
#if SK_SUPPORT_GPU
sk_sp<GrFragmentProcessor> SkXfermode::makeFragmentProcessorForImageFilter(
sk_sp<GrFragmentProcessor>) const {
// This should never be called.
// TODO: make pure virtual in SkXfermode once Android update lands
SkASSERT(0);
return nullptr;
}
const GrXPFactory* SkXfermode::asXPFactory() const {
// This should never be called.
// TODO: make pure virtual in SkXfermode once Android update lands
SkASSERT(0);
return nullptr;
}
#endif
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
bool SkProcCoeffXfermode::asMode(SkBlendMode* mode) const {
if (mode) {
*mode = fMode;
}
return true;
}
void SkProcCoeffXfermode::xfer32(SkPMColor* SK_RESTRICT dst,
const SkPMColor* SK_RESTRICT src, int count,
const SkAlpha* SK_RESTRICT aa) const {
@ -714,25 +686,6 @@ void SkProcCoeffXfermode::xfer32(SkPMColor* SK_RESTRICT dst,
}
}
#if SK_SUPPORT_GPU
sk_sp<GrFragmentProcessor> SkProcCoeffXfermode::makeFragmentProcessorForImageFilter(
sk_sp<GrFragmentProcessor> dst) const {
SkASSERT(dst);
return GrXfermodeFragmentProcessor::MakeFromDstProcessor(std::move(dst), fMode);
}
const GrXPFactory* SkProcCoeffXfermode::asXPFactory() const {
if (SkBlendMode_AsCoeff(fMode, nullptr, nullptr)) {
const GrXPFactory* result(GrPorterDuffXPFactory::Get(fMode));
SkASSERT(result);
return result;
}
SkASSERT(GrCustomXfermode::IsSupportedMode(fMode));
return GrCustomXfermode::Get(fMode);
}
#endif
const char* SkBlendMode_Name(SkBlendMode mode) {
SkASSERT((unsigned) mode <= (unsigned)SkBlendMode::kLastMode);
const char* gModeStrings[] = {

View File

@ -23,13 +23,6 @@ public:
virtual void xfer32(SkPMColor dst[], const SkPMColor src[], int count,
const SkAlpha aa[]) const = 0;
/**
* If the xfermode is one of the modes in the Mode enum, then asMode()
* returns true and sets (if not null) mode accordingly. Otherwise it
* returns false and ignores the mode parameter.
*/
virtual bool asMode(SkBlendMode* mode) const;
/** Return an SkXfermode object for the specified mode.
*/
static sk_sp<SkXfermode> Make(SkBlendMode);
@ -49,12 +42,6 @@ public:
return xfer.get();
}
SkBlendMode blend() const {
SkBlendMode mode;
SkAssertResult(this->asMode(&mode));
return mode;
}
static SkXfermodeProc GetProc(SkBlendMode);
enum SrcColorOpacity {
@ -70,28 +57,8 @@ public:
static bool IsOpaque(SkBlendMode, SrcColorOpacity);
#if SK_SUPPORT_GPU
/** Used by the SkXfermodeImageFilter to blend two colors via a GrFragmentProcessor.
The input to the returned FP is the src color. The dst color is
provided by the dst param which becomes a child FP of the returned FP.
It is legal for the function to return a null output. This indicates that
the output of the blend is simply the src color.
*/
virtual sk_sp<GrFragmentProcessor> makeFragmentProcessorForImageFilter(
sk_sp<GrFragmentProcessor> dst) const;
/** A subclass must implement this factory function to work with the GPU backend.
The xfermode will return a factory for which the caller will get a ref. It is up
to the caller to install it. XferProcessors cannot use a background texture.
*/
virtual const GrXPFactory* asXPFactory() const;
#endif
protected:
SkXfermode() {}
virtual ~SkXfermode() {}
private:
};
#endif

View File

@ -22,14 +22,6 @@ public:
void xfer32(SkPMColor dst[], const SkPMColor src[], int count,
const SkAlpha aa[]) const override;
bool asMode(SkBlendMode* mode) const override;
#if SK_SUPPORT_GPU
sk_sp<GrFragmentProcessor> makeFragmentProcessorForImageFilter(
sk_sp<GrFragmentProcessor>) const override;
const GrXPFactory* asXPFactory() const override;
#endif
protected:
SkBlendMode getMode() const { return fMode; }

View File

@ -221,7 +221,7 @@ void SkXfermodeImageFilter_Base::toString(SkString* str) const {
#if SK_SUPPORT_GPU
#include "SkXfermode_proccoeff.h"
#include "effects/GrXfermodeFragmentProcessor.h"
sk_sp<SkSpecialImage> SkXfermodeImageFilter_Base::filterImageGPU(
SkSpecialImage* source,
@ -315,20 +315,7 @@ sk_sp<SkSpecialImage> SkXfermodeImageFilter_Base::filterImageGPU(
sk_sp<GrFragmentProcessor>
SkXfermodeImageFilter_Base::makeFGFrag(sk_sp<GrFragmentProcessor> bgFP) const {
// A null fMode is interpreted to mean kSrcOver_Mode (to match raster).
SkXfermode* xfer = SkXfermode::Peek(fMode);
sk_sp<SkXfermode> srcover;
if (!xfer) {
// It would be awesome to use SkXfermode::Create here but it knows better
// than us and won't return a kSrcOver_Mode SkXfermode. That means we
// have to get one the hard way.
SkXfermodeProc proc = SkXfermode::GetProc(SkBlendMode::kSrcOver);
srcover.reset(new SkProcCoeffXfermode(proc, SkBlendMode::kSrcOver));
xfer = srcover.get();
}
return xfer->makeFragmentProcessorForImageFilter(std::move(bgFP));
return GrXfermodeFragmentProcessor::MakeFromDstProcessor(std::move(bgFP), fMode);
}
#endif