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

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

Issue 1783823002: Generic 4f gradient T sampler fallback (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: review comments Created 4 years, 9 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
Index: src/effects/gradients/Sk4fGradientBase.h
diff --git a/src/effects/gradients/Sk4fGradientBase.h b/src/effects/gradients/Sk4fGradientBase.h
index 1fece72b520fd327c3607bb24218cd4b3178aaec..f745f8fc0bce6eb1f49c6eefdea53f55fe3369d8 100644
--- a/src/effects/gradients/Sk4fGradientBase.h
+++ b/src/effects/gradients/Sk4fGradientBase.h
@@ -24,6 +24,9 @@ public:
uint32_t getFlags() const override { return fFlags; }
+ void shadeSpan(int x, int y, SkPMColor dst[], int count) override;
+ void shadeSpan4f(int x, int y, SkPM4f dst[], int count) override;
+
protected:
struct Interval {
Interval(SkPMColor c0, SkScalar p0,
@@ -32,14 +35,15 @@ protected:
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;
};
+ virtual void mapTs(int x, int y, SkScalar ts[], int count) const = 0;
+
+ void buildIntervals(const SkGradientShaderBase&, const ContextRec&, bool reverse);
+
SkSTArray<8, Interval, true> fIntervals;
SkMatrix fDstToPos;
SkMatrix::MapXYProc fDstToPosProc;
@@ -50,6 +54,18 @@ protected:
private:
using INHERITED = SkShader::Context;
+
+ void addMirrorIntervals(const SkGradientShaderBase&,
+ const Sk4f& componentScale, bool reverse);
+
+ template<typename DstType, SkShader::TileMode tileMode>
+ class TSampler;
+
+ template <typename DstType, bool do_premul>
+ void shadePremulSpan(int x, int y, DstType[], int count) const;
+
+ template <typename DstType, bool do_premul, SkShader::TileMode tileMode>
+ void shadeSpanInternal(int x, int y, DstType[], int count) const;
};
#endif // Sk4fGradientBase_DEFINED

Powered by Google App Engine
This is Rietveld 408576698