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

Unified Diff: src/effects/gradients/Sk4fGradientBase.h

Issue 1688543002: Initial linear gradient 4f impl (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: Created 4 years, 10 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 | « gyp/gmslides.gypi ('k') | src/effects/gradients/Sk4fGradientBase.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/effects/gradients/Sk4fGradientBase.h
diff --git a/src/effects/gradients/Sk4fGradientBase.h b/src/effects/gradients/Sk4fGradientBase.h
new file mode 100644
index 0000000000000000000000000000000000000000..7870bc3ccf3a550809ccc54c336bb673593e2274
--- /dev/null
+++ b/src/effects/gradients/Sk4fGradientBase.h
@@ -0,0 +1,61 @@
+/*
+ * Copyright 2016 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#ifndef Sk4fGradientBase_DEFINED
+#define Sk4fGradientBase_DEFINED
+
+#include "SkColor.h"
+#include "SkGradientShaderPriv.h"
+#include "SkMatrix.h"
+#include "SkNx.h"
+#include "SkPM4f.h"
+#include "SkShader.h"
+#include "SkTArray.h"
+
+class SkGradientShaderBase::
+GradientShaderBase4fContext : public SkShader::Context {
+public:
+ GradientShaderBase4fContext(const SkGradientShaderBase&,
+ const ContextRec&);
+
+ uint32_t getFlags() const override { return fFlags; }
+
+protected:
+ struct Interval {
+ Interval(SkPMColor c0, SkScalar p0,
+ SkPMColor c1, SkScalar p1,
+ const Sk4f& componentScale);
+ Interval(const Sk4f& c0, const Sk4f& dc,
+ SkScalar p0, SkScalar p1);
+
+ bool isZeroRamp() const { return fZeroRamp; }
+
+ // true when fx is in [p0,p1)
+ bool contains(SkScalar fx) const;
+
+ SkPM4f fC0, fDc;
+ SkScalar fP0, fP1;
+ bool fZeroRamp;
+ };
+
+ const Interval* findInterval(SkScalar fx) const;
+
+ SkSTArray<8, Interval, true> fIntervals;
+ SkMatrix fDstToPos;
+ SkMatrix::MapXYProc fDstToPosProc;
+ uint8_t fDstToPosClass;
+ uint8_t fFlags;
+ bool fDither;
+ bool fColorsArePremul;
+
+private:
+ using INHERITED = SkShader::Context;
+
+ mutable const Interval* fCachedInterval;
+};
+
+#endif // Sk4fGradientBase_DEFINED
« no previous file with comments | « gyp/gmslides.gypi ('k') | src/effects/gradients/Sk4fGradientBase.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698