add tilers against 1

Change-Id: I2482972a43cb89a93cbfb9e708614e0334002e53
Reviewed-on: https://skia-review.googlesource.com/17483
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Mike Klein <mtklein@chromium.org>
This commit is contained in:
Mike Klein 2017-05-22 13:15:25 -04:00 committed by Skia Commit-Bot
parent b7b7e5fba0
commit 8110b849d6
5 changed files with 3248 additions and 2756 deletions

View File

@ -90,8 +90,9 @@
M(parametric_a) \
M(table_r) M(table_g) M(table_b) M(table_a) \
M(lab_to_xyz) \
M(clamp_x) M(mirror_x) M(repeat_x) \
M(clamp_y) M(mirror_y) M(repeat_y) \
M(clamp_x) M(mirror_x) M(repeat_x) \
M(clamp_y) M(mirror_y) M(repeat_y) \
M(clamp_x_1) M(mirror_x_1) M(repeat_x_1) \
M(gather_a8) M(gather_g8) M(gather_i8) \
M(gather_565) M(gather_4444) M(gather_8888) M(gather_f16) \
M(bilinear_nx) M(bilinear_px) M(bilinear_ny) M(bilinear_py) \

View File

@ -433,15 +433,15 @@ bool SkGradientShaderBase::onAppendStages(SkRasterPipeline* p,
p->extend(subclass);
switch(fTileMode) {
case kMirror_TileMode: p->append(SkRasterPipeline::mirror_x, alloc->make<float>(1)); break;
case kRepeat_TileMode: p->append(SkRasterPipeline::repeat_x, alloc->make<float>(1)); break;
case kMirror_TileMode: p->append(SkRasterPipeline::mirror_x_1); break;
case kRepeat_TileMode: p->append(SkRasterPipeline::repeat_x_1); break;
case kClamp_TileMode:
if (!fOrigPos) {
// We clamp only when the stops are evenly spaced.
// If not, there may be hard stops, and clamping ruins hard stops at 0 and/or 1.
// In that case, we must make sure we're using the general "gradient" stage,
// which is the only stage that will correctly handle unclamped t.
p->append(SkRasterPipeline::clamp_x, alloc->make<float>(1));
p->append(SkRasterPipeline::clamp_x_1);
}
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1014,6 +1014,10 @@ STAGE(repeat_y) { g = repeat(g, *(const float*)ctx); }
STAGE(mirror_x) { r = mirror(r, *(const float*)ctx); }
STAGE(mirror_y) { g = mirror(g, *(const float*)ctx); }
STAGE( clamp_x_1) { r = min(max(0, r), 1); }
STAGE(repeat_x_1) { r = r - floor_(r); }
STAGE(mirror_x_1) { r = abs_( (r-1.0f) - two(floor_((r-1.0f)*0.5f)) - 1.0f ); }
STAGE(luminance_to_alpha) {
a = r*0.2126f + g*0.7152f + b*0.0722f;
r = g = b = 0;