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

Unified Diff: src/effects/gradients/Sk4fLinearGradient.cpp

Issue 2416233002: Faster 4f gradient premul path (Closed)
Patch Set: Created 4 years, 2 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 | « src/effects/gradients/Sk4fLinearGradient.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/effects/gradients/Sk4fLinearGradient.cpp
diff --git a/src/effects/gradients/Sk4fLinearGradient.cpp b/src/effects/gradients/Sk4fLinearGradient.cpp
index cd1f770ef98306f20ac452b729e2950998b3eed1..6d5e5dde9672f3efdc24ddd864a9846b7d06d804 100644
--- a/src/effects/gradients/Sk4fLinearGradient.cpp
+++ b/src/effects/gradients/Sk4fLinearGradient.cpp
@@ -240,12 +240,12 @@ LinearGradient4fContext::shadeSpanInternal(int x, int y,
&pt);
const SkScalar fx = pinFx<tileMode>(pt.x());
const SkScalar dx = fDstToPos.getScaleX();
- LinearIntervalProcessor<dstType, tileMode> proc(fIntervals.begin(),
- fIntervals.end() - 1,
- this->findInterval(fx),
- fx,
- dx,
- SkScalarNearlyZero(dx * count));
+ LinearIntervalProcessor<dstType, premul, tileMode> proc(fIntervals.begin(),
+ fIntervals.end() - 1,
+ this->findInterval(fx),
+ fx,
+ dx,
+ SkScalarNearlyZero(dx * count));
while (count > 0) {
// What we really want here is SkTPin(advance, 1, count)
// but that's a significant perf hit for >> stops; investigate.
@@ -274,7 +274,7 @@ LinearGradient4fContext::shadeSpanInternal(int x, int y,
}
}
-template<DstType dstType, SkShader::TileMode tileMode>
+template<DstType dstType, ApplyPremul premul, SkShader::TileMode tileMode>
class SkLinearGradient::
LinearGradient4fContext::LinearIntervalProcessor {
public:
@@ -322,8 +322,8 @@ public:
private:
void compute_interval_props(SkScalar t) {
- const Sk4f dC = DstTraits<dstType>::load(fInterval->fDc);
- fCc = DstTraits<dstType>::load(fInterval->fC0);
+ const Sk4f dC = DstTraits<dstType, premul>::load(fInterval->fDc);
+ fCc = DstTraits<dstType, premul>::load(fInterval->fC0);
fCc = fCc + dC * Sk4f(t);
fDcDx = dC * fDx;
fZeroRamp = fIsVertical || fInterval->isZeroRamp();
« no previous file with comments | « src/effects/gradients/Sk4fLinearGradient.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698