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

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

Issue 1808963005: 4f linear gradient shader blitters (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: rename trunc_from_255 to quiet confused msvc 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
« no previous file with comments | « src/effects/gradients/Sk4fGradientBase.h ('k') | src/effects/gradients/Sk4fGradientPriv.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/effects/gradients/Sk4fGradientBase.cpp
diff --git a/src/effects/gradients/Sk4fGradientBase.cpp b/src/effects/gradients/Sk4fGradientBase.cpp
index a7298127907f38aff93a2af0c7dc3b8bd650980e..43910108ff79eb3466c7f5ac6ef6579ef5f3c062 100644
--- a/src/effects/gradients/Sk4fGradientBase.cpp
+++ b/src/effects/gradients/Sk4fGradientBase.cpp
@@ -6,7 +6,6 @@
*/
#include "Sk4fGradientBase.h"
-#include "Sk4fGradientPriv.h"
#include <functional>
@@ -277,22 +276,22 @@ GradientShaderBase4fContext::addMirrorIntervals(const SkGradientShaderBase& shad
void SkGradientShaderBase::
GradientShaderBase4fContext::shadeSpan(int x, int y, SkPMColor dst[], int count) {
if (fColorsArePremul) {
- this->shadePremulSpan<SkPMColor, false>(x, y, dst, count);
+ this->shadePremulSpan<SkPMColor, ApplyPremul::False>(x, y, dst, count);
} else {
- this->shadePremulSpan<SkPMColor, true>(x, y, dst, count);
+ this->shadePremulSpan<SkPMColor, ApplyPremul::True>(x, y, dst, count);
}
}
void SkGradientShaderBase::
GradientShaderBase4fContext::shadeSpan4f(int x, int y, SkPM4f dst[], int count) {
if (fColorsArePremul) {
- this->shadePremulSpan<SkPM4f, false>(x, y, dst, count);
+ this->shadePremulSpan<SkPM4f, ApplyPremul::False>(x, y, dst, count);
} else {
- this->shadePremulSpan<SkPM4f, true>(x, y, dst, count);
+ this->shadePremulSpan<SkPM4f, ApplyPremul::True>(x, y, dst, count);
}
}
-template<typename DstType, bool do_premul>
+template<typename DstType, ApplyPremul premul>
void SkGradientShaderBase::
GradientShaderBase4fContext::shadePremulSpan(int x, int y,
DstType dst[],
@@ -303,23 +302,23 @@ GradientShaderBase4fContext::shadePremulSpan(int x, int y,
switch (shader.fTileMode) {
case kClamp_TileMode:
this->shadeSpanInternal<DstType,
- do_premul,
+ premul,
kClamp_TileMode>(x, y, dst, count);
break;
case kRepeat_TileMode:
this->shadeSpanInternal<DstType,
- do_premul,
+ premul,
kRepeat_TileMode>(x, y, dst, count);
break;
case kMirror_TileMode:
this->shadeSpanInternal<DstType,
- do_premul,
+ premul,
kMirror_TileMode>(x, y, dst, count);
break;
}
}
-template<typename DstType, bool do_premul, SkShader::TileMode tileMode>
+template<typename DstType, ApplyPremul premul, SkShader::TileMode tileMode>
void SkGradientShaderBase::
GradientShaderBase4fContext::shadeSpanInternal(int x, int y,
DstType dst[],
@@ -334,7 +333,7 @@ GradientShaderBase4fContext::shadeSpanInternal(int x, int y,
this->mapTs(x, y, ts, n);
for (int i = 0; i < n; ++i) {
const Sk4f c = sampler.sample(ts[i]);
- store<DstType, do_premul>(c, dst++);
+ store<DstType, kLinear_SkColorProfileType, premul>(c, dst++);
}
x += n;
count -= n;
@@ -424,8 +423,8 @@ private:
}
void loadIntervalData(const Interval* i) {
- fCc = dst_swizzle<DstType>(i->fC0) * dst_component_scale<DstType>();
- fDc = dst_swizzle<DstType>(i->fDc) * dst_component_scale<DstType>();
+ fCc = scale_for_dest<DstType, kLinear_SkColorProfileType>(dst_swizzle<DstType>(i->fC0));
+ fDc = scale_for_dest<DstType, kLinear_SkColorProfileType>(dst_swizzle<DstType>(i->fDc));
}
const Interval* fFirstInterval;
« no previous file with comments | « src/effects/gradients/Sk4fGradientBase.h ('k') | src/effects/gradients/Sk4fGradientPriv.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698