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

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

Issue 1436663003: Implement multi-color-stops in linear gradients using Sk4f (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fix win warnings Created 5 years, 1 month 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 | « src/effects/gradients/SkGradientShaderPriv.h ('k') | src/effects/gradients/SkLinearGradient.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/effects/gradients/SkLinearGradient.h
diff --git a/src/effects/gradients/SkLinearGradient.h b/src/effects/gradients/SkLinearGradient.h
index 488775ea9330dd35e2a6b30ebb2a377829ffa18d..73efd2e778f2fd49645ff75fd890ed3f19ee3e84 100644
--- a/src/effects/gradients/SkLinearGradient.h
+++ b/src/effects/gradients/SkLinearGradient.h
@@ -9,6 +9,20 @@
#define SkLinearGradient_DEFINED
#include "SkGradientShaderPriv.h"
+#include "SkNx.h"
+
+struct Sk4fStorage {
+ float fArray[4];
+
+ operator Sk4f() const {
+ return Sk4f::Load(fArray);
+ }
+
+ Sk4fStorage& operator=(const Sk4f& src) {
+ src.store(fArray);
+ return *this;
+ }
+};
class SkLinearGradient : public SkGradientShaderBase {
public:
@@ -19,12 +33,23 @@ public:
class LinearGradientContext : public SkGradientShaderBase::GradientShaderBaseContext {
public:
LinearGradientContext(const SkLinearGradient&, const ContextRec&);
- ~LinearGradientContext() {}
void shadeSpan(int x, int y, SkPMColor dstC[], int count) override;
void shadeSpan16(int x, int y, uint16_t dstC[], int count) override;
+ struct Rec {
+ Sk4fStorage fColor;
+ float fPos;
+ float fPosScale;
+ };
private:
+ SkTDArray<Rec> fRecs;
+ bool fApplyAlphaAfterInterp;
+
+ void shade4_clamp(int x, int y, SkPMColor dstC[], int count);
+ template <bool, bool> void shade4_dx_clamp(SkPMColor dstC[], int count, float fx, float dx,
+ float invDx, const float dither[2]);
+
typedef SkGradientShaderBase::GradientShaderBaseContext INHERITED;
};
« no previous file with comments | « src/effects/gradients/SkGradientShaderPriv.h ('k') | src/effects/gradients/SkLinearGradient.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698