Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(15)

Unified Diff: include/gpu/GrProcessor.h

Issue 608253002: Add isSingleComponent bool to getConstantColorComponent (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/core/SkXfermode.cpp » ('j') | src/gpu/GrDrawState.cpp » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/gpu/GrProcessor.h
diff --git a/include/gpu/GrProcessor.h b/include/gpu/GrProcessor.h
index 7053872bbe4a75d6e0039c0c646daf00af8043a9..3060b2bdf78bc25d07e1cba636c55ac5d8e82f36 100644
--- a/include/gpu/GrProcessor.h
+++ b/include/gpu/GrProcessor.h
@@ -40,11 +40,19 @@ public:
/**
* This function is used to perform optimizations. When called the color and validFlags params
* indicate whether the input components to this effect in the FS will have known values.
- * validFlags is a bitfield of GrColorComponentFlags. The function updates both params to
- * indicate known values of its output. A component of the color param only has meaning if the
- * corresponding bit in validFlags is set.
+ * validFlags is a bitfield of GrColorComponentFlags. The isSingleComponent param indicates
+ * whether the input will be 1 or 4 bytes. The function updates all params to indicate known
+ * values of its output. A component of the color param only has meaning if the corresponding
+ * bit in validFlags is set. If an effect sets isSingleComponent to true, then validFlags must
+ * be all 1's or all 0's. If it is all 1's then all color components must be equal.
bsalomon 2014/09/29 15:28:04 all 1's isn't quit right (since this is a uint32_t
egdaniel 2014/09/29 15:50:20 Done.
*/
- virtual void getConstantColorComponents(GrColor* color, uint32_t* validFlags) const = 0;
+ void getConstantColorComponents(GrColor* color, uint32_t* validFlags,
+ bool* isSingleComponent) const {
+ this->onGetConstantColorComponents(color, validFlags, isSingleComponent);
+#ifdef SK_DEBUG
+ this->validateComponents(*color, *validFlags, *isSingleComponent);
+#endif
+ }
/** This object, besides creating back-end-specific helper objects, is used for run-time-type-
identification. The factory should be an instance of templated class,
@@ -153,11 +161,19 @@ protected:
private:
SkDEBUGCODE(void assertEquality(const GrProcessor& other) const;)
+ SkDEBUGCODE(void validateComponents(GrColor color, uint32_t validFlags,
+ bool isSingleComponent) const;)
+
/** Subclass implements this to support isEqual(). It will only be called if it is known that
the two effects are of the same subclass (i.e. they return the same object from
getFactory()).*/
virtual bool onIsEqual(const GrProcessor& other) const = 0;
+ /**
+ * Subclass implements this to support getConstantColorComponents(...).
+ */
+ virtual void onGetConstantColorComponents(GrColor* color, uint32_t* validFlags,
+ bool* isSingleComponent) const = 0;
friend class GrGeometryProcessor; // to set fRequiresVertexShader and build fVertexAttribTypes.
SkSTArray<4, const GrCoordTransform*, true> fCoordTransforms;
« no previous file with comments | « no previous file | src/core/SkXfermode.cpp » ('j') | src/gpu/GrDrawState.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698