543 MipLevelHelper upper;
544 std::tie(upper.pm, upper.inv) = access->level();
553 if (!mRec.
apply(rec, upper.inv)) {
557 upper.allocAndInit(alloc,
sampling, fTileModeX, fTileModeY);
559 MipLevelHelper lower;
562 if (lowerWeight > 0) {
563 std::tie(lower.pm, lower.inv) = access->lowerLevel();
566 mipmapCtx->
scaleX =
static_cast<float>(lower.pm.width()) / upper.pm.width();
567 mipmapCtx->
scaleY =
static_cast<float>(lower.pm.height()) / upper.pm.height();
569 lower.allocAndInit(alloc,
sampling, fTileModeX, fTileModeY);
571 p->append(SkRasterPipelineOp::mipmap_linear_init, mipmapCtx);
576 auto append_tiling_and_gather = [&](
const MipLevelHelper* level) {
578 p->append(SkRasterPipelineOp::decal_x_and_y, level->decalCtx);
580 switch (fTileModeX) {
584 p->append(SkRasterPipelineOp::mirror_x, level->limitX);
587 p->append(SkRasterPipelineOp::repeat_x, level->limitX);
590 p->append(SkRasterPipelineOp::decal_x, level->decalCtx);
593 switch (fTileModeY) {
597 p->append(SkRasterPipelineOp::mirror_y, level->limitY);
600 p->append(SkRasterPipelineOp::repeat_y, level->limitY);
603 p->append(SkRasterPipelineOp::decal_y, level->decalCtx);
608 void* ctx = level->gather;
609 switch (level->pm.colorType()) {
621 p->append(SkRasterPipelineOp::gather_1010102, ctx);
625 p->append(SkRasterPipelineOp::gather_16161616, ctx);
632 p->append(SkRasterPipelineOp::gather_10101010_xr, ctx);
633 p->append(SkRasterPipelineOp::swap_rb);
638 p->append(SkRasterPipelineOp::alpha_to_gray );
break;
641 p->append(SkRasterPipelineOp::alpha_to_red );
break;
644 p->append(SkRasterPipelineOp::force_opaque );
break;
647 p->append(SkRasterPipelineOp::gather_1010102, ctx);
648 p->append(SkRasterPipelineOp::swap_rb);
652 p->append(SkRasterPipelineOp::gather_1010102, ctx);
653 p->append(SkRasterPipelineOp::force_opaque);
657 p->append(SkRasterPipelineOp::gather_1010102_xr, ctx);
658 p->append(SkRasterPipelineOp::force_opaque);
659 p->append(SkRasterPipelineOp::swap_rb);
663 p->append(SkRasterPipelineOp::gather_1010102, ctx);
664 p->append(SkRasterPipelineOp::force_opaque);
665 p->append(SkRasterPipelineOp::swap_rb);
669 p->append(SkRasterPipelineOp::gather_8888, ctx);
670 p->append(SkRasterPipelineOp::swap_rb);
674 p->append(SkRasterPipelineOp::gather_8888, ctx);
680 if (level->decalCtx) {
681 p->append(SkRasterPipelineOp::check_decal_mask, level->decalCtx);
685 auto append_misc = [&] {
702 ? SkRasterPipelineOp::clamp_01
703 : SkRasterPipelineOp::clamp_gamut);
723 p->append(SkRasterPipelineOp::bilerp_clamp_8888, upper.gather);
725 p->append(SkRasterPipelineOp::swap_rb);
727 return append_misc();
734 p->append(SkRasterPipelineOp::bicubic_clamp_8888, upper.gather);
736 p->append(SkRasterPipelineOp::swap_rb);
738 return append_misc();
746 const MipLevelHelper* level) {
747 p->append(setup_x, sampler);
748 p->append(setup_y, sampler);
749 append_tiling_and_gather(level);
750 p->append(SkRasterPipelineOp::accumulate, sampler);
753 auto sample_level = [&](
const MipLevelHelper* level) {
757 p->append(SkRasterPipelineOp::bicubic_setup, sampler);
759 sample(SkRasterPipelineOp::bicubic_n3x, SkRasterPipelineOp::bicubic_n3y, level);
760 sample(SkRasterPipelineOp::bicubic_n1x, SkRasterPipelineOp::bicubic_n3y, level);
761 sample(SkRasterPipelineOp::bicubic_p1x, SkRasterPipelineOp::bicubic_n3y, level);
762 sample(SkRasterPipelineOp::bicubic_p3x, SkRasterPipelineOp::bicubic_n3y, level);
764 sample(SkRasterPipelineOp::bicubic_n3x, SkRasterPipelineOp::bicubic_n1y, level);
765 sample(SkRasterPipelineOp::bicubic_n1x, SkRasterPipelineOp::bicubic_n1y, level);
766 sample(SkRasterPipelineOp::bicubic_p1x, SkRasterPipelineOp::bicubic_n1y, level);
767 sample(SkRasterPipelineOp::bicubic_p3x, SkRasterPipelineOp::bicubic_n1y, level);
769 sample(SkRasterPipelineOp::bicubic_n3x, SkRasterPipelineOp::bicubic_p1y, level);
770 sample(SkRasterPipelineOp::bicubic_n1x, SkRasterPipelineOp::bicubic_p1y, level);
771 sample(SkRasterPipelineOp::bicubic_p1x, SkRasterPipelineOp::bicubic_p1y, level);
772 sample(SkRasterPipelineOp::bicubic_p3x, SkRasterPipelineOp::bicubic_p1y, level);
774 sample(SkRasterPipelineOp::bicubic_n3x, SkRasterPipelineOp::bicubic_p3y, level);
775 sample(SkRasterPipelineOp::bicubic_n1x, SkRasterPipelineOp::bicubic_p3y, level);
776 sample(SkRasterPipelineOp::bicubic_p1x, SkRasterPipelineOp::bicubic_p3y, level);
777 sample(SkRasterPipelineOp::bicubic_p3x, SkRasterPipelineOp::bicubic_p3y, level);
779 p->append(SkRasterPipelineOp::move_dst_src);
781 p->append(SkRasterPipelineOp::bilinear_setup, sampler);
783 sample(SkRasterPipelineOp::bilinear_nx, SkRasterPipelineOp::bilinear_ny, level);
784 sample(SkRasterPipelineOp::bilinear_px, SkRasterPipelineOp::bilinear_ny, level);
785 sample(SkRasterPipelineOp::bilinear_nx, SkRasterPipelineOp::bilinear_py, level);
786 sample(SkRasterPipelineOp::bilinear_px, SkRasterPipelineOp::bilinear_py, level);
788 p->append(SkRasterPipelineOp::move_dst_src);
790 append_tiling_and_gather(level);
794 sample_level(&upper);
797 p->append(SkRasterPipelineOp::mipmap_linear_update, mipmapCtx);
798 sample_level(&lower);
799 p->append(SkRasterPipelineOp::mipmap_linear_finish, mipmapCtx);
802 return append_misc();