SkImageShader.cpp 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511
  1. /*
  2. * Copyright 2015 Google Inc.
  3. *
  4. * Use of this source code is governed by a BSD-style license that can be
  5. * found in the LICENSE file.
  6. */
  7. #include "src/core/SkArenaAlloc.h"
  8. #include "src/core/SkBitmapController.h"
  9. #include "src/core/SkBitmapProvider.h"
  10. #include "src/core/SkColorSpacePriv.h"
  11. #include "src/core/SkColorSpaceXformSteps.h"
  12. #include "src/core/SkRasterPipeline.h"
  13. #include "src/core/SkReadBuffer.h"
  14. #include "src/core/SkWriteBuffer.h"
  15. #include "src/image/SkImage_Base.h"
  16. #include "src/shaders/SkBitmapProcShader.h"
  17. #include "src/shaders/SkEmptyShader.h"
  18. #include "src/shaders/SkImageShader.h"
  19. /**
  20. * We are faster in clamp, so always use that tiling when we can.
  21. */
  22. static SkTileMode optimize(SkTileMode tm, int dimension) {
  23. SkASSERT(dimension > 0);
  24. #ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK
  25. // need to update frameworks/base/libs/hwui/tests/unit/SkiaBehaviorTests.cpp:55 to allow
  26. // for transforming to clamp.
  27. return tm;
  28. #else
  29. return dimension == 1 ? SkTileMode::kClamp : tm;
  30. #endif
  31. }
  32. SkImageShader::SkImageShader(sk_sp<SkImage> img,
  33. SkTileMode tmx, SkTileMode tmy,
  34. const SkMatrix* localMatrix,
  35. bool clampAsIfUnpremul)
  36. : INHERITED(localMatrix)
  37. , fImage(std::move(img))
  38. , fTileModeX(optimize(tmx, fImage->width()))
  39. , fTileModeY(optimize(tmy, fImage->height()))
  40. , fClampAsIfUnpremul(clampAsIfUnpremul)
  41. {}
  42. // fClampAsIfUnpremul is always false when constructed through public APIs,
  43. // so there's no need to read or write it here.
  44. sk_sp<SkFlattenable> SkImageShader::CreateProc(SkReadBuffer& buffer) {
  45. auto tmx = buffer.read32LE<SkTileMode>(SkTileMode::kLastTileMode);
  46. auto tmy = buffer.read32LE<SkTileMode>(SkTileMode::kLastTileMode);
  47. SkMatrix localMatrix;
  48. buffer.readMatrix(&localMatrix);
  49. sk_sp<SkImage> img = buffer.readImage();
  50. if (!img) {
  51. return nullptr;
  52. }
  53. return SkImageShader::Make(std::move(img), tmx, tmy, &localMatrix);
  54. }
  55. void SkImageShader::flatten(SkWriteBuffer& buffer) const {
  56. buffer.writeUInt((unsigned)fTileModeX);
  57. buffer.writeUInt((unsigned)fTileModeY);
  58. buffer.writeMatrix(this->getLocalMatrix());
  59. buffer.writeImage(fImage.get());
  60. SkASSERT(fClampAsIfUnpremul == false);
  61. }
  62. bool SkImageShader::isOpaque() const {
  63. return fImage->isOpaque() &&
  64. fTileModeX != SkTileMode::kDecal && fTileModeY != SkTileMode::kDecal;
  65. }
  66. #ifdef SK_ENABLE_LEGACY_SHADERCONTEXT
  67. static bool legacy_shader_can_handle(const SkMatrix& inv) {
  68. if (!inv.isScaleTranslate()) {
  69. return false;
  70. }
  71. // legacy code uses SkFixed 32.32, so ensure the inverse doesn't map device coordinates
  72. // out of range.
  73. const SkScalar max_dev_coord = 32767.0f;
  74. SkRect src;
  75. SkAssertResult(inv.mapRect(&src, SkRect::MakeWH(max_dev_coord, max_dev_coord)));
  76. // take 1/4 of max signed 32bits so we have room to subtract local values
  77. const SkScalar max_fixed32dot32 = SK_MaxS32 * 0.25f;
  78. if (!SkRect::MakeLTRB(-max_fixed32dot32, -max_fixed32dot32,
  79. max_fixed32dot32, max_fixed32dot32).contains(src)) {
  80. return false;
  81. }
  82. // legacy shader impl should be able to handle these matrices
  83. return true;
  84. }
  85. SkShaderBase::Context* SkImageShader::onMakeContext(const ContextRec& rec,
  86. SkArenaAlloc* alloc) const {
  87. if (fImage->alphaType() == kUnpremul_SkAlphaType) {
  88. return nullptr;
  89. }
  90. if (fImage->colorType() != kN32_SkColorType) {
  91. return nullptr;
  92. }
  93. if (fTileModeX != fTileModeY) {
  94. return nullptr;
  95. }
  96. if (fTileModeX == SkTileMode::kDecal || fTileModeY == SkTileMode::kDecal) {
  97. return nullptr;
  98. }
  99. // SkBitmapProcShader stores bitmap coordinates in a 16bit buffer,
  100. // so it can't handle bitmaps larger than 65535.
  101. //
  102. // We back off another bit to 32767 to make small amounts of
  103. // intermediate math safe, e.g. in
  104. //
  105. // SkFixed fx = ...;
  106. // fx = tile(fx + SK_Fixed1);
  107. //
  108. // we want to make sure (fx + SK_Fixed1) never overflows.
  109. if (fImage-> width() > 32767 ||
  110. fImage->height() > 32767) {
  111. return nullptr;
  112. }
  113. SkMatrix inv;
  114. if (!this->computeTotalInverse(*rec.fMatrix, rec.fLocalMatrix, &inv) ||
  115. !legacy_shader_can_handle(inv)) {
  116. return nullptr;
  117. }
  118. if (!rec.isLegacyCompatible(fImage->colorSpace())) {
  119. return nullptr;
  120. }
  121. return SkBitmapProcLegacyShader::MakeContext(*this, fTileModeX, fTileModeY,
  122. SkBitmapProvider(fImage.get()), rec, alloc);
  123. }
  124. #endif
  125. SkImage* SkImageShader::onIsAImage(SkMatrix* texM, SkTileMode xy[]) const {
  126. if (texM) {
  127. *texM = this->getLocalMatrix();
  128. }
  129. if (xy) {
  130. xy[0] = fTileModeX;
  131. xy[1] = fTileModeY;
  132. }
  133. return const_cast<SkImage*>(fImage.get());
  134. }
  135. sk_sp<SkShader> SkImageShader::Make(sk_sp<SkImage> image,
  136. SkTileMode tmx, SkTileMode tmy,
  137. const SkMatrix* localMatrix,
  138. bool clampAsIfUnpremul) {
  139. if (!image) {
  140. return sk_make_sp<SkEmptyShader>();
  141. }
  142. return sk_sp<SkShader>{ new SkImageShader(image, tmx, tmy, localMatrix, clampAsIfUnpremul) };
  143. }
  144. ///////////////////////////////////////////////////////////////////////////////////////////////////
  145. #if SK_SUPPORT_GPU
  146. #include "include/private/GrRecordingContext.h"
  147. #include "src/gpu/GrCaps.h"
  148. #include "src/gpu/GrColorSpaceInfo.h"
  149. #include "src/gpu/GrRecordingContextPriv.h"
  150. #include "src/gpu/SkGr.h"
  151. #include "src/gpu/effects/GrBicubicEffect.h"
  152. #include "src/gpu/effects/generated/GrSimpleTextureEffect.h"
  153. static GrSamplerState::WrapMode tile_mode_to_wrap_mode(const SkTileMode tileMode) {
  154. switch (tileMode) {
  155. case SkTileMode::kClamp:
  156. return GrSamplerState::WrapMode::kClamp;
  157. case SkTileMode::kRepeat:
  158. return GrSamplerState::WrapMode::kRepeat;
  159. case SkTileMode::kMirror:
  160. return GrSamplerState::WrapMode::kMirrorRepeat;
  161. case SkTileMode::kDecal:
  162. return GrSamplerState::WrapMode::kClampToBorder;
  163. }
  164. SK_ABORT("Unknown tile mode.");
  165. return GrSamplerState::WrapMode::kClamp;
  166. }
  167. std::unique_ptr<GrFragmentProcessor> SkImageShader::asFragmentProcessor(
  168. const GrFPArgs& args) const {
  169. const auto lm = this->totalLocalMatrix(args.fPreLocalMatrix, args.fPostLocalMatrix);
  170. SkMatrix lmInverse;
  171. if (!lm->invert(&lmInverse)) {
  172. return nullptr;
  173. }
  174. GrSamplerState::WrapMode wrapModes[] = {tile_mode_to_wrap_mode(fTileModeX),
  175. tile_mode_to_wrap_mode(fTileModeY)};
  176. // If either domainX or domainY are un-ignored, a texture domain effect has to be used to
  177. // implement the decal mode (while leaving non-decal axes alone). The wrap mode originally
  178. // clamp-to-border is reset to clamp since the hw cannot implement it directly.
  179. GrTextureDomain::Mode domainX = GrTextureDomain::kIgnore_Mode;
  180. GrTextureDomain::Mode domainY = GrTextureDomain::kIgnore_Mode;
  181. if (!args.fContext->priv().caps()->clampToBorderSupport()) {
  182. if (wrapModes[0] == GrSamplerState::WrapMode::kClampToBorder) {
  183. domainX = GrTextureDomain::kDecal_Mode;
  184. wrapModes[0] = GrSamplerState::WrapMode::kClamp;
  185. }
  186. if (wrapModes[1] == GrSamplerState::WrapMode::kClampToBorder) {
  187. domainY = GrTextureDomain::kDecal_Mode;
  188. wrapModes[1] = GrSamplerState::WrapMode::kClamp;
  189. }
  190. }
  191. // Must set wrap and filter on the sampler before requesting a texture. In two places below
  192. // we check the matrix scale factors to determine how to interpret the filter quality setting.
  193. // This completely ignores the complexity of the drawVertices case where explicit local coords
  194. // are provided by the caller.
  195. bool doBicubic;
  196. GrSamplerState::Filter textureFilterMode = GrSkFilterQualityToGrFilterMode(
  197. args.fFilterQuality, *args.fViewMatrix, *lm,
  198. args.fContext->priv().options().fSharpenMipmappedTextures, &doBicubic);
  199. GrSamplerState samplerState(wrapModes, textureFilterMode);
  200. SkScalar scaleAdjust[2] = { 1.0f, 1.0f };
  201. sk_sp<GrTextureProxy> proxy(as_IB(fImage)->asTextureProxyRef(args.fContext, samplerState,
  202. scaleAdjust));
  203. if (!proxy) {
  204. return nullptr;
  205. }
  206. GrPixelConfig config = proxy->config();
  207. bool isAlphaOnly = GrPixelConfigIsAlphaOnly(config);
  208. lmInverse.postScale(scaleAdjust[0], scaleAdjust[1]);
  209. std::unique_ptr<GrFragmentProcessor> inner;
  210. if (doBicubic) {
  211. // domainX and domainY will properly apply the decal effect with the texture domain used in
  212. // the bicubic filter if clamp to border was unsupported in hardware
  213. static constexpr auto kDir = GrBicubicEffect::Direction::kXY;
  214. inner = GrBicubicEffect::Make(std::move(proxy), lmInverse, wrapModes, domainX, domainY,
  215. kDir, fImage->alphaType());
  216. } else {
  217. if (domainX != GrTextureDomain::kIgnore_Mode || domainY != GrTextureDomain::kIgnore_Mode) {
  218. SkRect domain = GrTextureDomain::MakeTexelDomain(
  219. SkIRect::MakeWH(proxy->width(), proxy->height()),
  220. domainX, domainY);
  221. inner = GrTextureDomainEffect::Make(std::move(proxy), lmInverse, domain,
  222. domainX, domainY, samplerState);
  223. } else {
  224. inner = GrSimpleTextureEffect::Make(std::move(proxy), lmInverse, samplerState);
  225. }
  226. }
  227. inner = GrColorSpaceXformEffect::Make(std::move(inner), fImage->colorSpace(),
  228. fImage->alphaType(),
  229. args.fDstColorSpaceInfo->colorSpace());
  230. if (isAlphaOnly) {
  231. return inner;
  232. } else if (args.fInputColorIsOpaque) {
  233. return GrFragmentProcessor::OverrideInput(std::move(inner), SK_PMColor4fWHITE, false);
  234. }
  235. return GrFragmentProcessor::MulChildByInputAlpha(std::move(inner));
  236. }
  237. #endif
  238. ///////////////////////////////////////////////////////////////////////////////////////////////////
  239. #include "src/core/SkImagePriv.h"
  240. sk_sp<SkShader> SkMakeBitmapShader(const SkBitmap& src, SkTileMode tmx, SkTileMode tmy,
  241. const SkMatrix* localMatrix, SkCopyPixelsMode cpm) {
  242. return SkImageShader::Make(SkMakeImageFromRasterBitmap(src, cpm),
  243. tmx, tmy, localMatrix);
  244. }
  245. sk_sp<SkShader> SkMakeBitmapShaderForPaint(const SkPaint& paint, const SkBitmap& src,
  246. SkTileMode tmx, SkTileMode tmy,
  247. const SkMatrix* localMatrix, SkCopyPixelsMode mode) {
  248. auto s = SkMakeBitmapShader(src, tmx, tmy, localMatrix, mode);
  249. if (!s) {
  250. return nullptr;
  251. }
  252. if (src.colorType() == kAlpha_8_SkColorType && paint.getShader()) {
  253. // Compose the image shader with the paint's shader. Alpha images+shaders should output the
  254. // texture's alpha multiplied by the shader's color. DstIn (d*sa) will achieve this with
  255. // the source image and dst shader (MakeBlend takes dst first, src second).
  256. s = SkShaders::Blend(SkBlendMode::kDstIn, paint.refShader(), std::move(s));
  257. }
  258. return s;
  259. }
  260. void SkShaderBase::RegisterFlattenables() { SK_REGISTER_FLATTENABLE(SkImageShader); }
  261. bool SkImageShader::onAppendStages(const SkStageRec& rec) const {
  262. SkRasterPipeline* p = rec.fPipeline;
  263. SkArenaAlloc* alloc = rec.fAlloc;
  264. SkMatrix matrix;
  265. if (!this->computeTotalInverse(rec.fCTM, rec.fLocalM, &matrix)) {
  266. return false;
  267. }
  268. auto quality = rec.fPaint.getFilterQuality();
  269. SkBitmapProvider provider(fImage.get());
  270. const auto* state = SkBitmapController::RequestBitmap(provider, matrix, quality, alloc);
  271. if (!state) {
  272. return false;
  273. }
  274. const SkPixmap& pm = state->pixmap();
  275. matrix = state->invMatrix();
  276. quality = state->quality();
  277. auto info = pm.info();
  278. // When the matrix is just an integer translate, bilerp == nearest neighbor.
  279. if (quality == kLow_SkFilterQuality &&
  280. matrix.getType() <= SkMatrix::kTranslate_Mask &&
  281. matrix.getTranslateX() == (int)matrix.getTranslateX() &&
  282. matrix.getTranslateY() == (int)matrix.getTranslateY()) {
  283. quality = kNone_SkFilterQuality;
  284. }
  285. // See skia:4649 and the GM image_scale_aligned.
  286. if (quality == kNone_SkFilterQuality) {
  287. if (matrix.getScaleX() >= 0) {
  288. matrix.setTranslateX(nextafterf(matrix.getTranslateX(),
  289. floorf(matrix.getTranslateX())));
  290. }
  291. if (matrix.getScaleY() >= 0) {
  292. matrix.setTranslateY(nextafterf(matrix.getTranslateY(),
  293. floorf(matrix.getTranslateY())));
  294. }
  295. }
  296. p->append(SkRasterPipeline::seed_shader);
  297. p->append_matrix(alloc, matrix);
  298. auto gather = alloc->make<SkRasterPipeline_GatherCtx>();
  299. gather->pixels = pm.addr();
  300. gather->stride = pm.rowBytesAsPixels();
  301. gather->width = pm.width();
  302. gather->height = pm.height();
  303. auto limit_x = alloc->make<SkRasterPipeline_TileCtx>(),
  304. limit_y = alloc->make<SkRasterPipeline_TileCtx>();
  305. limit_x->scale = pm.width();
  306. limit_x->invScale = 1.0f / pm.width();
  307. limit_y->scale = pm.height();
  308. limit_y->invScale = 1.0f / pm.height();
  309. SkRasterPipeline_DecalTileCtx* decal_ctx = nullptr;
  310. bool decal_x_and_y = fTileModeX == SkTileMode::kDecal && fTileModeY == SkTileMode::kDecal;
  311. if (fTileModeX == SkTileMode::kDecal || fTileModeY == SkTileMode::kDecal) {
  312. decal_ctx = alloc->make<SkRasterPipeline_DecalTileCtx>();
  313. decal_ctx->limit_x = limit_x->scale;
  314. decal_ctx->limit_y = limit_y->scale;
  315. }
  316. auto append_tiling_and_gather = [&] {
  317. if (decal_x_and_y) {
  318. p->append(SkRasterPipeline::decal_x_and_y, decal_ctx);
  319. } else {
  320. switch (fTileModeX) {
  321. case SkTileMode::kClamp: /* The gather_xxx stage will clamp for us. */ break;
  322. case SkTileMode::kMirror: p->append(SkRasterPipeline::mirror_x, limit_x); break;
  323. case SkTileMode::kRepeat: p->append(SkRasterPipeline::repeat_x, limit_x); break;
  324. case SkTileMode::kDecal: p->append(SkRasterPipeline::decal_x, decal_ctx); break;
  325. }
  326. switch (fTileModeY) {
  327. case SkTileMode::kClamp: /* The gather_xxx stage will clamp for us. */ break;
  328. case SkTileMode::kMirror: p->append(SkRasterPipeline::mirror_y, limit_y); break;
  329. case SkTileMode::kRepeat: p->append(SkRasterPipeline::repeat_y, limit_y); break;
  330. case SkTileMode::kDecal: p->append(SkRasterPipeline::decal_y, decal_ctx); break;
  331. }
  332. }
  333. void* ctx = gather;
  334. switch (info.colorType()) {
  335. case kAlpha_8_SkColorType: p->append(SkRasterPipeline::gather_a8, ctx); break;
  336. case kRGB_565_SkColorType: p->append(SkRasterPipeline::gather_565, ctx); break;
  337. case kARGB_4444_SkColorType: p->append(SkRasterPipeline::gather_4444, ctx); break;
  338. case kRGBA_8888_SkColorType: p->append(SkRasterPipeline::gather_8888, ctx); break;
  339. case kRGBA_1010102_SkColorType: p->append(SkRasterPipeline::gather_1010102, ctx); break;
  340. case kRGBA_F16Norm_SkColorType:
  341. case kRGBA_F16_SkColorType: p->append(SkRasterPipeline::gather_f16, ctx); break;
  342. case kRGBA_F32_SkColorType: p->append(SkRasterPipeline::gather_f32, ctx); break;
  343. case kGray_8_SkColorType: p->append(SkRasterPipeline::gather_a8, ctx);
  344. p->append(SkRasterPipeline::alpha_to_gray ); break;
  345. case kRGB_888x_SkColorType: p->append(SkRasterPipeline::gather_8888, ctx);
  346. p->append(SkRasterPipeline::force_opaque ); break;
  347. case kRGB_101010x_SkColorType: p->append(SkRasterPipeline::gather_1010102, ctx);
  348. p->append(SkRasterPipeline::force_opaque ); break;
  349. case kBGRA_8888_SkColorType: p->append(SkRasterPipeline::gather_8888, ctx);
  350. p->append(SkRasterPipeline::swap_rb ); break;
  351. case kUnknown_SkColorType: SkASSERT(false);
  352. }
  353. if (decal_ctx) {
  354. p->append(SkRasterPipeline::check_decal_mask, decal_ctx);
  355. }
  356. };
  357. auto append_misc = [&] {
  358. // TODO: if ref.fDstCS isn't null, we'll premul here then immediately unpremul
  359. // to do the color space transformation. Might be possible to streamline.
  360. if (info.colorType() == kAlpha_8_SkColorType) {
  361. // The color for A8 images comes from the (sRGB) paint color.
  362. p->append_set_rgb(alloc, rec.fPaint.getColor4f());
  363. p->append(SkRasterPipeline::premul);
  364. } else if (info.alphaType() == kUnpremul_SkAlphaType) {
  365. // Convert unpremul images to premul before we carry on with the rest of the pipeline.
  366. p->append(SkRasterPipeline::premul);
  367. }
  368. if (quality > kLow_SkFilterQuality) {
  369. // Bicubic filtering naturally produces out of range values on both sides.
  370. p->append(SkRasterPipeline::clamp_0);
  371. p->append(fClampAsIfUnpremul ? SkRasterPipeline::clamp_1
  372. : SkRasterPipeline::clamp_a);
  373. }
  374. if (rec.fDstCS) {
  375. // If color managed, convert from premul source all the way to premul dst color space.
  376. auto srcCS = info.colorSpace();
  377. if (!srcCS || info.colorType() == kAlpha_8_SkColorType) {
  378. // We treat untagged images as sRGB.
  379. // A8 images get their r,g,b from the paint color, so they're also sRGB.
  380. srcCS = sk_srgb_singleton();
  381. }
  382. alloc->make<SkColorSpaceXformSteps>(srcCS , kPremul_SkAlphaType,
  383. rec.fDstCS, kPremul_SkAlphaType)
  384. ->apply(p, info.colorType());
  385. }
  386. return true;
  387. };
  388. // We've got a fast path for 8888 bilinear clamp/clamp sampling.
  389. auto ct = info.colorType();
  390. if (true
  391. && (ct == kRGBA_8888_SkColorType || ct == kBGRA_8888_SkColorType)
  392. && quality == kLow_SkFilterQuality
  393. && fTileModeX == SkTileMode::kClamp && fTileModeY == SkTileMode::kClamp) {
  394. p->append(SkRasterPipeline::bilerp_clamp_8888, gather);
  395. if (ct == kBGRA_8888_SkColorType) {
  396. p->append(SkRasterPipeline::swap_rb);
  397. }
  398. return append_misc();
  399. }
  400. SkRasterPipeline_SamplerCtx* sampler = nullptr;
  401. if (quality != kNone_SkFilterQuality) {
  402. sampler = alloc->make<SkRasterPipeline_SamplerCtx>();
  403. }
  404. auto sample = [&](SkRasterPipeline::StockStage setup_x,
  405. SkRasterPipeline::StockStage setup_y) {
  406. p->append(setup_x, sampler);
  407. p->append(setup_y, sampler);
  408. append_tiling_and_gather();
  409. p->append(SkRasterPipeline::accumulate, sampler);
  410. };
  411. if (quality == kNone_SkFilterQuality) {
  412. append_tiling_and_gather();
  413. } else if (quality == kLow_SkFilterQuality) {
  414. p->append(SkRasterPipeline::save_xy, sampler);
  415. sample(SkRasterPipeline::bilinear_nx, SkRasterPipeline::bilinear_ny);
  416. sample(SkRasterPipeline::bilinear_px, SkRasterPipeline::bilinear_ny);
  417. sample(SkRasterPipeline::bilinear_nx, SkRasterPipeline::bilinear_py);
  418. sample(SkRasterPipeline::bilinear_px, SkRasterPipeline::bilinear_py);
  419. p->append(SkRasterPipeline::move_dst_src);
  420. } else {
  421. p->append(SkRasterPipeline::save_xy, sampler);
  422. sample(SkRasterPipeline::bicubic_n3x, SkRasterPipeline::bicubic_n3y);
  423. sample(SkRasterPipeline::bicubic_n1x, SkRasterPipeline::bicubic_n3y);
  424. sample(SkRasterPipeline::bicubic_p1x, SkRasterPipeline::bicubic_n3y);
  425. sample(SkRasterPipeline::bicubic_p3x, SkRasterPipeline::bicubic_n3y);
  426. sample(SkRasterPipeline::bicubic_n3x, SkRasterPipeline::bicubic_n1y);
  427. sample(SkRasterPipeline::bicubic_n1x, SkRasterPipeline::bicubic_n1y);
  428. sample(SkRasterPipeline::bicubic_p1x, SkRasterPipeline::bicubic_n1y);
  429. sample(SkRasterPipeline::bicubic_p3x, SkRasterPipeline::bicubic_n1y);
  430. sample(SkRasterPipeline::bicubic_n3x, SkRasterPipeline::bicubic_p1y);
  431. sample(SkRasterPipeline::bicubic_n1x, SkRasterPipeline::bicubic_p1y);
  432. sample(SkRasterPipeline::bicubic_p1x, SkRasterPipeline::bicubic_p1y);
  433. sample(SkRasterPipeline::bicubic_p3x, SkRasterPipeline::bicubic_p1y);
  434. sample(SkRasterPipeline::bicubic_n3x, SkRasterPipeline::bicubic_p3y);
  435. sample(SkRasterPipeline::bicubic_n1x, SkRasterPipeline::bicubic_p3y);
  436. sample(SkRasterPipeline::bicubic_p1x, SkRasterPipeline::bicubic_p3y);
  437. sample(SkRasterPipeline::bicubic_p3x, SkRasterPipeline::bicubic_p3y);
  438. p->append(SkRasterPipeline::move_dst_src);
  439. }
  440. return append_misc();
  441. }