Remove unused premul/unpremul FP code

Bug: skia:
Change-Id: I911ee066ce4d0175cee3ee3868a86955d486687c
Reviewed-on: https://skia-review.googlesource.com/159060
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Auto-Submit: Brian Osman <brianosman@google.com>
diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp
index fb8ffb2..c3ce355 100644
--- a/src/gpu/GrContext.cpp
+++ b/src/gpu/GrContext.cpp
@@ -525,7 +525,7 @@
             GrPaint paint;
             paint.setPorterDuffXPFactory(SkBlendMode::kSrc);
             auto fp = fContext->createUPMToPMEffect(
-                    GrSimpleTextureEffect::Make(std::move(tempProxy), SkMatrix::I()), true);
+                    GrSimpleTextureEffect::Make(std::move(tempProxy), SkMatrix::I()));
             if (srcColorType == GrColorType::kBGRA_8888) {
                 fp = GrFragmentProcessor::SwizzleOutput(std::move(fp), GrSwizzle::BGRA());
             }
@@ -696,8 +696,7 @@
             paint.setPorterDuffXPFactory(SkBlendMode::kSrc);
             auto fp = fContext->createPMToUPMEffect(
                     GrSimpleTextureEffect::Make(sk_ref_sp(srcProxy->asTextureProxy()),
-                                                SkMatrix::I()),
-                    true);
+                                                SkMatrix::I()));
             if (dstColorType == GrColorType::kBGRA_8888) {
                 fp = GrFragmentProcessor::SwizzleOutput(std::move(fp), GrSwizzle::BGRA());
                 dstColorType = GrColorType::kRGBA_8888;
@@ -1053,39 +1052,25 @@
 }
 
 std::unique_ptr<GrFragmentProcessor> GrContext::createPMToUPMEffect(
-        std::unique_ptr<GrFragmentProcessor> fp, bool useConfigConversionEffect) {
+        std::unique_ptr<GrFragmentProcessor> fp) {
     ASSERT_SINGLE_OWNER
-    // We have specialized effects that guarantee round-trip conversion for some formats
-    if (useConfigConversionEffect) {
-        // We should have already called this->validPMUPMConversionExists() in this case
-        SkASSERT(fDidTestPMConversions);
-        // ...and it should have succeeded
-        SkASSERT(this->validPMUPMConversionExists());
+    // We should have already called this->validPMUPMConversionExists() in this case
+    SkASSERT(fDidTestPMConversions);
+    // ...and it should have succeeded
+    SkASSERT(this->validPMUPMConversionExists());
 
-        return GrConfigConversionEffect::Make(std::move(fp), PMConversion::kToUnpremul);
-    } else {
-        // For everything else (sRGB, half-float, etc...), it doesn't make sense to try and
-        // explicitly round the results. Just do the obvious, naive thing in the shader.
-        return GrFragmentProcessor::UnpremulOutput(std::move(fp));
-    }
+    return GrConfigConversionEffect::Make(std::move(fp), PMConversion::kToUnpremul);
 }
 
 std::unique_ptr<GrFragmentProcessor> GrContext::createUPMToPMEffect(
-        std::unique_ptr<GrFragmentProcessor> fp, bool useConfigConversionEffect) {
+        std::unique_ptr<GrFragmentProcessor> fp) {
     ASSERT_SINGLE_OWNER
-    // We have specialized effects that guarantee round-trip conversion for these formats
-    if (useConfigConversionEffect) {
-        // We should have already called this->validPMUPMConversionExists() in this case
-        SkASSERT(fDidTestPMConversions);
-        // ...and it should have succeeded
-        SkASSERT(this->validPMUPMConversionExists());
+    // We should have already called this->validPMUPMConversionExists() in this case
+    SkASSERT(fDidTestPMConversions);
+    // ...and it should have succeeded
+    SkASSERT(this->validPMUPMConversionExists());
 
-        return GrConfigConversionEffect::Make(std::move(fp), PMConversion::kToPremul);
-    } else {
-        // For everything else (sRGB, half-float, etc...), it doesn't make sense to try and
-        // explicitly round the results. Just do the obvious, naive thing in the shader.
-        return GrFragmentProcessor::PremulOutput(std::move(fp));
-    }
+    return GrConfigConversionEffect::Make(std::move(fp), PMConversion::kToPremul);
 }
 
 bool GrContext::validPMUPMConversionExists() {
diff --git a/src/gpu/GrFragmentProcessor.cpp b/src/gpu/GrFragmentProcessor.cpp
index ca59082..dde1875 100644
--- a/src/gpu/GrFragmentProcessor.cpp
+++ b/src/gpu/GrFragmentProcessor.cpp
@@ -12,7 +12,6 @@
 #include "effects/GrConstColorProcessor.h"
 #include "effects/GrPremulInputFragmentProcessor.h"
 #include "effects/GrXfermodeFragmentProcessor.h"
-#include "effects/GrUnpremulInputFragmentProcessor.h"
 #include "glsl/GrGLSLFragmentProcessor.h"
 #include "glsl/GrGLSLFragmentShaderBuilder.h"
 #include "glsl/GrGLSLProgramDataManager.h"
@@ -151,26 +150,6 @@
     return GrFragmentProcessor::RunInSeries(fpPipeline, 2);
 }
 
-std::unique_ptr<GrFragmentProcessor> GrFragmentProcessor::PremulOutput(
-        std::unique_ptr<GrFragmentProcessor> fp) {
-    if (!fp) {
-        return nullptr;
-    }
-    std::unique_ptr<GrFragmentProcessor> fpPipeline[] = { std::move(fp),
-                                                          GrPremulInputFragmentProcessor::Make() };
-    return GrFragmentProcessor::RunInSeries(fpPipeline, 2);
-}
-
-std::unique_ptr<GrFragmentProcessor> GrFragmentProcessor::UnpremulOutput(
-        std::unique_ptr<GrFragmentProcessor> fp) {
-    if (!fp) {
-        return nullptr;
-    }
-    std::unique_ptr<GrFragmentProcessor> fpPipeline[] = { std::move(fp),
-                                                          GrUnpremulInputFragmentProcessor::Make() };
-    return GrFragmentProcessor::RunInSeries(fpPipeline, 2);
-}
-
 std::unique_ptr<GrFragmentProcessor> GrFragmentProcessor::SwizzleOutput(
         std::unique_ptr<GrFragmentProcessor> fp, const GrSwizzle& swizzle) {
     class SwizzleFragmentProcessor : public GrFragmentProcessor {
diff --git a/src/gpu/GrFragmentProcessor.h b/src/gpu/GrFragmentProcessor.h
index 2b4f425..f82146d 100644
--- a/src/gpu/GrFragmentProcessor.h
+++ b/src/gpu/GrFragmentProcessor.h
@@ -73,19 +73,6 @@
     static std::unique_ptr<GrFragmentProcessor> PremulInput(std::unique_ptr<GrFragmentProcessor>);
 
     /**
-     *  Returns a fragment processor that calls the passed in fragment processor, and then premuls
-     *  the output.
-     */
-    static std::unique_ptr<GrFragmentProcessor> PremulOutput(std::unique_ptr<GrFragmentProcessor>);
-
-    /**
-     *  Returns a fragment processor that calls the passed in fragment processor, and then unpremuls
-     *  the output.
-     */
-    static std::unique_ptr<GrFragmentProcessor> UnpremulOutput(
-            std::unique_ptr<GrFragmentProcessor>);
-
-    /**
      *  Returns a fragment processor that calls the passed in fragment processor, and then swizzles
      *  the output.
      */
diff --git a/src/gpu/effects/GrUnpremulInputFragmentProcessor.cpp b/src/gpu/effects/GrUnpremulInputFragmentProcessor.cpp
deleted file mode 100644
index ab922a5..0000000
--- a/src/gpu/effects/GrUnpremulInputFragmentProcessor.cpp
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright 2018 Google Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-/**************************************************************************************************
- *** This file was autogenerated from GrUnpremulInputFragmentProcessor.fp; do not modify.
- **************************************************************************************************/
-#include "GrUnpremulInputFragmentProcessor.h"
-#include "glsl/GrGLSLFragmentProcessor.h"
-#include "glsl/GrGLSLFragmentShaderBuilder.h"
-#include "glsl/GrGLSLProgramBuilder.h"
-#include "GrTexture.h"
-#include "SkSLCPP.h"
-#include "SkSLUtil.h"
-class GrGLSLUnpremulInputFragmentProcessor : public GrGLSLFragmentProcessor {
-public:
-    GrGLSLUnpremulInputFragmentProcessor() {}
-    void emitCode(EmitArgs& args) override {
-        GrGLSLFPFragmentBuilder* fragBuilder = args.fFragBuilder;
-        const GrUnpremulInputFragmentProcessor& _outer =
-                args.fFp.cast<GrUnpremulInputFragmentProcessor>();
-        (void)_outer;
-        fragBuilder->codeAppendf(
-                "%s = %s;\nhalf invAlpha = %s.w <= 0.0 ? 0.0 : 1.0 / %s.w;\n%s.xyz *= invAlpha;\n",
-                args.fOutputColor, args.fInputColor, args.fInputColor, args.fInputColor,
-                args.fOutputColor);
-    }
-
-private:
-    void onSetData(const GrGLSLProgramDataManager& pdman,
-                   const GrFragmentProcessor& _proc) override {}
-};
-GrGLSLFragmentProcessor* GrUnpremulInputFragmentProcessor::onCreateGLSLInstance() const {
-    return new GrGLSLUnpremulInputFragmentProcessor();
-}
-void GrUnpremulInputFragmentProcessor::onGetGLSLProcessorKey(const GrShaderCaps& caps,
-                                                             GrProcessorKeyBuilder* b) const {}
-bool GrUnpremulInputFragmentProcessor::onIsEqual(const GrFragmentProcessor& other) const {
-    const GrUnpremulInputFragmentProcessor& that = other.cast<GrUnpremulInputFragmentProcessor>();
-    (void)that;
-    return true;
-}
-GrUnpremulInputFragmentProcessor::GrUnpremulInputFragmentProcessor(
-        const GrUnpremulInputFragmentProcessor& src)
-        : INHERITED(kGrUnpremulInputFragmentProcessor_ClassID, src.optimizationFlags()) {}
-std::unique_ptr<GrFragmentProcessor> GrUnpremulInputFragmentProcessor::clone() const {
-    return std::unique_ptr<GrFragmentProcessor>(new GrUnpremulInputFragmentProcessor(*this));
-}
diff --git a/src/gpu/effects/GrUnpremulInputFragmentProcessor.fp b/src/gpu/effects/GrUnpremulInputFragmentProcessor.fp
deleted file mode 100644
index 51a517f..0000000
--- a/src/gpu/effects/GrUnpremulInputFragmentProcessor.fp
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * Copyright 2018 Google Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-@optimizationFlags {
-    kPreservesOpaqueInput_OptimizationFlag | kConstantOutputForConstantInput_OptimizationFlag
-}
-
-void main() {
-    sk_OutColor = sk_InColor;
-    half invAlpha = sk_InColor.a <= 0 ? 0 : 1 / sk_InColor.a;
-    sk_OutColor.rgb *= invAlpha;
-}
-
-@class {
-    SkPMColor4f constantOutputForConstantInput(const SkPMColor4f& input) const override {
-        SkColor4f upm = input.unpremul();
-        return { upm.fR, upm.fG, upm.fB, upm.fA };
-    }
-}
\ No newline at end of file
diff --git a/src/gpu/effects/GrUnpremulInputFragmentProcessor.h b/src/gpu/effects/GrUnpremulInputFragmentProcessor.h
deleted file mode 100644
index 71106a6..0000000
--- a/src/gpu/effects/GrUnpremulInputFragmentProcessor.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright 2018 Google Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-/**************************************************************************************************
- *** This file was autogenerated from GrUnpremulInputFragmentProcessor.fp; do not modify.
- **************************************************************************************************/
-#ifndef GrUnpremulInputFragmentProcessor_DEFINED
-#define GrUnpremulInputFragmentProcessor_DEFINED
-#include "SkTypes.h"
-#include "GrFragmentProcessor.h"
-#include "GrCoordTransform.h"
-class GrUnpremulInputFragmentProcessor : public GrFragmentProcessor {
-public:
-    SkPMColor4f constantOutputForConstantInput(const SkPMColor4f& input) const override {
-        SkColor4f upm = input.unpremul();
-        return {upm.fR, upm.fG, upm.fB, upm.fA};
-    }
-    static std::unique_ptr<GrFragmentProcessor> Make() {
-        return std::unique_ptr<GrFragmentProcessor>(new GrUnpremulInputFragmentProcessor());
-    }
-    GrUnpremulInputFragmentProcessor(const GrUnpremulInputFragmentProcessor& src);
-    std::unique_ptr<GrFragmentProcessor> clone() const override;
-    const char* name() const override { return "UnpremulInputFragmentProcessor"; }
-
-private:
-    GrUnpremulInputFragmentProcessor()
-            : INHERITED(kGrUnpremulInputFragmentProcessor_ClassID,
-                        (OptimizationFlags)kPreservesOpaqueInput_OptimizationFlag |
-                                kConstantOutputForConstantInput_OptimizationFlag) {}
-    GrGLSLFragmentProcessor* onCreateGLSLInstance() const override;
-    void onGetGLSLProcessorKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const override;
-    bool onIsEqual(const GrFragmentProcessor&) const override;
-    GR_DECLARE_FRAGMENT_PROCESSOR_TEST
-    typedef GrFragmentProcessor INHERITED;
-};
-#endif