Just clamp to limit-epsilon.

I think the -0.5f was an implementation detail of Herb's bilerp that we
don't need here.  It happened to also be clamping us to something less
than limit (limit-0.5), so we do need to replace that with a little
nudge to keep us on tile.

Change-Id: I4ebd32e0ad38c724a17dc8bc35d9ea228eeeca32
Reviewed-on: https://skia-review.googlesource.com/7338
Commit-Queue: Mike Klein <mtklein@chromium.org>
Reviewed-by: Herb Derby <herb@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
This commit is contained in:
Mike Klein 2017-01-20 11:45:01 -05:00 committed by Skia Commit-Bot
parent d2eb581ebc
commit abddea0d8c
2 changed files with 2 additions and 5 deletions

View File

@ -129,10 +129,7 @@ bool SkLinearGradient::onAppendStages(SkRasterPipeline* p, SkColorSpace* cs, SkA
auto* limit = alloc->make<float>(1.0f);
switch (fTileMode) {
case kClamp_TileMode:
*limit += 0.5f; // why is clamp_x offsetting its limit?
p->append(SkRasterPipeline::clamp_x, limit);
break;
case kClamp_TileMode: p->append(SkRasterPipeline:: clamp_x, limit); break;
case kMirror_TileMode: p->append(SkRasterPipeline::mirror_x, limit); break;
case kRepeat_TileMode: p->append(SkRasterPipeline::repeat_x, limit); break;
}

View File

@ -872,7 +872,7 @@ SI SkNf assert_in_tile(const SkNf& v, float limit) {
}
SI SkNf clamp(const SkNf& v, float limit) {
SkNf result = SkNf::Max(0, SkNf::Min(v, limit - 0.5f));
SkNf result = SkNf::Max(0, SkNf::Min(v, nextafterf(limit, 0)));
return assert_in_tile(result, limit);
}
SI SkNf repeat(const SkNf& v, float limit) {