Another trivial cleanup
authorjoshualitt <joshualitt@chromium.org>
Mon, 13 Jul 2015 20:11:40 +0000 (13:11 -0700)
committerCommit bot <commit-bot@chromium.org>
Mon, 13 Jul 2015 20:11:40 +0000 (13:11 -0700)
TBR=bsalomon@google.com
BUG=skia:

Review URL: https://codereview.chromium.org/1229303003

13 files changed:
gyp/gpu.gypi
include/gpu/GrFragmentStage.h [deleted file]
include/gpu/GrPaint.h
include/gpu/GrStagedProcessor.h [new file with mode: 0644]
src/effects/gradients/SkGradientShaderPriv.h
src/gpu/GrPendingFragmentStage.h [deleted file]
src/gpu/GrPipeline.cpp
src/gpu/GrPipeline.h
src/gpu/GrPipelineBuilder.h
src/gpu/GrProcOptInfo.cpp
src/gpu/GrProcOptInfo.h
src/gpu/effects/GrConfigConversionEffect.h
src/gpu/gl/builders/GrGLProgramBuilder.h

index b9cd795..7911353 100644 (file)
@@ -22,7 +22,6 @@
       '<(skia_include_path)/gpu/GrCoordTransform.h',
       '<(skia_include_path)/gpu/GrDrawContext.h',
       '<(skia_include_path)/gpu/GrFragmentProcessor.h',
-      '<(skia_include_path)/gpu/GrFragmentStage.h',
       '<(skia_include_path)/gpu/GrGpuResource.h',
       '<(skia_include_path)/gpu/GrInvariantOutput.h',
       '<(skia_include_path)/gpu/GrPaint.h',
@@ -35,8 +34,9 @@
       '<(skia_include_path)/gpu/GrRect.h',
       '<(skia_include_path)/gpu/GrRenderTarget.h',
       '<(skia_include_path)/gpu/GrResourceKey.h',
-      '<(skia_include_path)/gpu/GrSurface.h',
       '<(skia_include_path)/gpu/GrShaderVar.h',
+      '<(skia_include_path)/gpu/GrStagedProcessor.h',
+      '<(skia_include_path)/gpu/GrSurface.h',
       '<(skia_include_path)/gpu/GrTexture.h',
       '<(skia_include_path)/gpu/GrTextureProvider.h',
       '<(skia_include_path)/gpu/GrTextureAccess.h',
       '<(skia_src_path)/gpu/GrPathUtils.cpp',
       '<(skia_src_path)/gpu/GrPathUtils.h',
       '<(skia_src_path)/gpu/GrPendingProgramElement.h',
-      '<(skia_src_path)/gpu/GrPendingFragmentStage.h',
       '<(skia_src_path)/gpu/GrPipeline.cpp',
       '<(skia_src_path)/gpu/GrPipeline.h',
       '<(skia_src_path)/gpu/GrPipelineBuilder.cpp',
diff --git a/include/gpu/GrFragmentStage.h b/include/gpu/GrFragmentStage.h
deleted file mode 100644 (file)
index ca3be8a..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Copyright 2010 Google Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#ifndef GrFragmentStage_DEFINED
-#define GrFragmentStage_DEFINED
-
-#include "GrFragmentProcessor.h"
-
-/**
- * Wraps a GrFragmentProcessor, basically a copyable SkAutoTUnref
- */
-class GrFragmentStage {
-public:
-    explicit GrFragmentStage(const GrFragmentProcessor* proc) : fProc(SkRef(proc)) {}
-
-    GrFragmentStage(const GrFragmentStage& other) { fProc.reset(SkRef(other.fProc.get())); }
-
-    const GrFragmentProcessor* processor() const { return fProc.get(); }
-
-    bool operator==(const GrFragmentStage& that) const {
-        return this->processor() == that.processor();
-    }
-
-    bool operator!=(const GrFragmentStage& that) const { return !(*this == that); }
-
-protected:
-    SkAutoTUnref<const GrFragmentProcessor> fProc;
-};
-
-#endif
index 22951f9..efb3010 100644 (file)
@@ -11,7 +11,7 @@
 #define GrPaint_DEFINED
 
 #include "GrColor.h"
-#include "GrFragmentStage.h"
+#include "GrStagedProcessor.h"
 #include "GrProcessorDataManager.h"
 #include "GrXferProcessor.h"
 #include "effects/GrPorterDuffXferProcessor.h"
diff --git a/include/gpu/GrStagedProcessor.h b/include/gpu/GrStagedProcessor.h
new file mode 100644 (file)
index 0000000..fcbc5b2
--- /dev/null
@@ -0,0 +1,41 @@
+/*
+ * Copyright 2015 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#ifndef GrStagedProcessorStage_DEFINED
+#define GrStagedProcessorStage_DEFINED
+
+#include "GrFragmentProcessor.h"
+#include "SkRefCnt.h"
+
+/**
+ * Wraps a GrFragmentProcessor, basically a copyable SkAutoTUnref
+ * Templatized based on the ref type so backends can use the same wrapper
+ */
+template<template<typename> class T>
+class GrStagedProcessor {
+public:
+    explicit GrStagedProcessor(const GrFragmentProcessor* proc) : fProc(SkRef(proc)) {}
+
+    GrStagedProcessor(const GrStagedProcessor& other) { fProc.reset(SkRef(other.fProc.get())); }
+
+    const GrFragmentProcessor* processor() const { return fProc.get(); }
+
+    bool operator==(const GrStagedProcessor& that) const {
+        return this->processor() == that.processor();
+    }
+
+    bool operator!=(const GrStagedProcessor& that) const { return !(*this == that); }
+
+    const char* name() const { return fProc->name(); }
+
+protected:
+    T<const GrFragmentProcessor> fProc;
+};
+
+typedef GrStagedProcessor<SkAutoTUnref> GrFragmentStage;
+
+#endif
index 9dc6b66..cb882b2 100644 (file)
@@ -296,7 +296,6 @@ static inline int next_dither_toggle16(int toggle) {
 #include "GrFragmentProcessor.h"
 #include "gl/GrGLProcessor.h"
 
-class GrFragmentStage;
 class GrInvariantOutput;
 
 /*
diff --git a/src/gpu/GrPendingFragmentStage.h b/src/gpu/GrPendingFragmentStage.h
deleted file mode 100644 (file)
index 0bf984a..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Copyright 2014 Google Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#ifndef GrPendingProcessorStage_DEFINED
-#define GrPendingProcessorStage_DEFINED
-
-#include "GrFragmentStage.h"
-#include "GrCoordTransform.h"
-#include "GrFragmentProcessor.h"
-#include "GrPendingProgramElement.h"
-
-/**
- * This a baked variant of GrFragmentStage, as recorded in GrOptDrawState.
- */
-class GrPendingFragmentStage {
-public:
-    GrPendingFragmentStage(const GrFragmentStage& stage) : fProc(stage.processor()) {}
-
-    GrPendingFragmentStage(const GrPendingFragmentStage& that) { *this = that; }
-
-    GrPendingFragmentStage& operator=(const GrPendingFragmentStage& that) {
-        fProc.reset(that.fProc.get());
-        return *this;
-    }
-
-    bool operator==(const GrPendingFragmentStage& that) const {
-        return this->processor()->isEqual(*that.processor());
-    }
-
-    bool operator!=(const GrPendingFragmentStage& that) const { return !(*this == that); }
-
-    /**
-     * For a coord transform on the fragment processor, does it or the coord change matrix (if
-     * relevant) contain perspective?
-     */
-    bool isPerspectiveCoordTransform(int matrixIndex) const {
-        const GrCoordTransform& coordTransform = this->processor()->coordTransform(matrixIndex);
-        uint32_t type = coordTransform.getMatrix().getType();
-        return SkToBool(SkMatrix::kPerspective_Mask & type);
-    }
-
-    const char* name() const { return fProc->name(); }
-
-    const GrFragmentProcessor* processor() const { return fProc.get(); }
-
-protected:
-    GrPendingProgramElement<const GrFragmentProcessor>  fProc;
-};
-#endif
index 8c40438..2c3422a 100644 (file)
@@ -87,20 +87,16 @@ GrPipeline::GrPipeline(const GrPipelineBuilder& pipelineBuilder,
 
     // Copy Stages from PipelineBuilder to Pipeline
     for (int i = firstColorStageIdx; i < pipelineBuilder.numColorFragmentStages(); ++i) {
-        SkNEW_APPEND_TO_TARRAY(&fFragmentStages,
-                               GrPendingFragmentStage,
-                               (pipelineBuilder.fColorStages[i]));
-        usesLocalCoords = usesLocalCoords ||
-                          pipelineBuilder.fColorStages[i].processor()->usesLocalCoords();
+        const GrFragmentProcessor* fp = pipelineBuilder.fColorStages[i].processor();
+        SkNEW_APPEND_TO_TARRAY(&fFragmentStages, GrPendingFragmentStage, (fp));
+        usesLocalCoords = usesLocalCoords || fp->usesLocalCoords();
     }
 
     fNumColorStages = fFragmentStages.count();
     for (int i = firstCoverageStageIdx; i < pipelineBuilder.numCoverageFragmentStages(); ++i) {
-        SkNEW_APPEND_TO_TARRAY(&fFragmentStages,
-                               GrPendingFragmentStage,
-                               (pipelineBuilder.fCoverageStages[i]));
-        usesLocalCoords = usesLocalCoords ||
-                          pipelineBuilder.fCoverageStages[i].processor()->usesLocalCoords();
+        const GrFragmentProcessor* fp = pipelineBuilder.fCoverageStages[i].processor();
+        SkNEW_APPEND_TO_TARRAY(&fFragmentStages, GrPendingFragmentStage, (fp));
+        usesLocalCoords = usesLocalCoords || fp->usesLocalCoords();
     }
 
     // Setup info we need to pass to GrPrimitiveProcessors that are used with this GrPipeline.
index bf8ca8a..fb90d47 100644 (file)
@@ -10,7 +10,8 @@
 
 #include "GrColor.h"
 #include "GrGpu.h"
-#include "GrPendingFragmentStage.h"
+#include "GrStagedProcessor.h"
+#include "GrPendingProgramElement.h"
 #include "GrPrimitiveProcessor.h"
 #include "GrProgramDesc.h"
 #include "GrStencil.h"
@@ -22,6 +23,8 @@ class GrBatch;
 class GrDeviceCoordTexture;
 class GrPipelineBuilder;
 
+typedef GrStagedProcessor<GrPendingProgramElement> GrPendingFragmentStage;
+
 /**
  * Class that holds an optimized version of a GrPipelineBuilder. It is meant to be an immutable
  * class, and contains all data needed to set the state for a gpu draw.
index dd3db6e..2098454 100644 (file)
@@ -12,7 +12,7 @@
 #include "GrCaps.h"
 #include "GrClip.h"
 #include "GrGpuResourceRef.h"
-#include "GrFragmentStage.h"
+#include "GrStagedProcessor.h"
 #include "GrProcOptInfo.h"
 #include "GrProcessorDataManager.h"
 #include "GrRenderTarget.h"
index dc499fa..53f2e02 100644 (file)
@@ -8,8 +8,6 @@
 #include "GrProcOptInfo.h"
 
 #include "GrBatch.h"
-#include "GrFragmentProcessor.h"
-#include "GrFragmentStage.h"
 #include "GrGeometryProcessor.h"
 
 void GrProcOptInfo::calcColorWithBatch(const GrBatch* batch,
index f518172..0430916 100644 (file)
@@ -10,9 +10,9 @@
 
 #include "GrColor.h"
 #include "GrInvariantOutput.h"
+#include "GrStagedProcessor.h"
 
 class GrBatch;
-class GrFragmentStage;
 class GrFragmentProcessor;
 class GrPrimitiveProcessor;
 class GrProcessor;
index f00a284..d87d009 100644 (file)
@@ -10,7 +10,6 @@
 
 #include "GrSingleTextureEffect.h"
 
-class GrFragmentStage;
 class GrInvariantOutput;
 
 /**
index 4b784ac..8143230 100644 (file)
@@ -16,7 +16,6 @@
 #include "../GrGLUniformHandle.h"
 #include "../GrGLPrimitiveProcessor.h"
 #include "../GrGLXferProcessor.h"
-#include "../../GrPendingFragmentStage.h"
 #include "../../GrPipeline.h"
 
 /*