| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2016 Google Inc. | 2 * Copyright 2016 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #include "SkLinearBitmapPipeline.h" | 8 #include "SkLinearBitmapPipeline.h" |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 public: | 85 public: |
| 86 template <typename... Args> | 86 template <typename... Args> |
| 87 MatrixStage(Next* next, Args&&... args) | 87 MatrixStage(Next* next, Args&&... args) |
| 88 : fNext{next} | 88 : fNext{next} |
| 89 , fStrategy{std::forward<Args>(args)...}{ } | 89 , fStrategy{std::forward<Args>(args)...}{ } |
| 90 | 90 |
| 91 MatrixStage(Next* next, const MatrixStage& stage) | 91 MatrixStage(Next* next, const MatrixStage& stage) |
| 92 : fNext{next} | 92 : fNext{next} |
| 93 , fStrategy{stage.fStrategy} { } | 93 , fStrategy{stage.fStrategy} { } |
| 94 | 94 |
| 95 void VECTORCALL pointListFew(int n, Sk4s xs, Sk4s ys) override { | 95 void SK_VECTORCALL pointListFew(int n, Sk4s xs, Sk4s ys) override { |
| 96 fStrategy.processPoints(&xs, &ys); | 96 fStrategy.processPoints(&xs, &ys); |
| 97 fNext->pointListFew(n, xs, ys); | 97 fNext->pointListFew(n, xs, ys); |
| 98 } | 98 } |
| 99 | 99 |
| 100 void VECTORCALL pointList4(Sk4s xs, Sk4s ys) override { | 100 void SK_VECTORCALL pointList4(Sk4s xs, Sk4s ys) override { |
| 101 fStrategy.processPoints(&xs, &ys); | 101 fStrategy.processPoints(&xs, &ys); |
| 102 fNext->pointList4(xs, ys); | 102 fNext->pointList4(xs, ys); |
| 103 } | 103 } |
| 104 | 104 |
| 105 // The span you pass must not be empty. | 105 // The span you pass must not be empty. |
| 106 void pointSpan(Span span) override { | 106 void pointSpan(Span span) override { |
| 107 SkASSERT(!span.isEmpty()); | 107 SkASSERT(!span.isEmpty()); |
| 108 if (!fStrategy.maybeProcessSpan(span, fNext)) { | 108 if (!fStrategy.maybeProcessSpan(span, fNext)) { |
| 109 span_fallback(span, this); | 109 span_fallback(span, this); |
| 110 } | 110 } |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 NearestTileStage(Next* next, SkISize dimensions) | 171 NearestTileStage(Next* next, SkISize dimensions) |
| 172 : fNext{next} | 172 : fNext{next} |
| 173 , fXStrategy{dimensions.width()} | 173 , fXStrategy{dimensions.width()} |
| 174 , fYStrategy{dimensions.height()}{ } | 174 , fYStrategy{dimensions.height()}{ } |
| 175 | 175 |
| 176 NearestTileStage(Next* next, const NearestTileStage& stage) | 176 NearestTileStage(Next* next, const NearestTileStage& stage) |
| 177 : fNext{next} | 177 : fNext{next} |
| 178 , fXStrategy{stage.fXStrategy} | 178 , fXStrategy{stage.fXStrategy} |
| 179 , fYStrategy{stage.fYStrategy} { } | 179 , fYStrategy{stage.fYStrategy} { } |
| 180 | 180 |
| 181 void VECTORCALL pointListFew(int n, Sk4s xs, Sk4s ys) override { | 181 void SK_VECTORCALL pointListFew(int n, Sk4s xs, Sk4s ys) override { |
| 182 fXStrategy.tileXPoints(&xs); | 182 fXStrategy.tileXPoints(&xs); |
| 183 fYStrategy.tileYPoints(&ys); | 183 fYStrategy.tileYPoints(&ys); |
| 184 fNext->pointListFew(n, xs, ys); | 184 fNext->pointListFew(n, xs, ys); |
| 185 } | 185 } |
| 186 | 186 |
| 187 void VECTORCALL pointList4(Sk4s xs, Sk4s ys) override { | 187 void SK_VECTORCALL pointList4(Sk4s xs, Sk4s ys) override { |
| 188 fXStrategy.tileXPoints(&xs); | 188 fXStrategy.tileXPoints(&xs); |
| 189 fYStrategy.tileYPoints(&ys); | 189 fYStrategy.tileYPoints(&ys); |
| 190 fNext->pointList4(xs, ys); | 190 fNext->pointList4(xs, ys); |
| 191 } | 191 } |
| 192 | 192 |
| 193 // The span you pass must not be empty. | 193 // The span you pass must not be empty. |
| 194 void pointSpan(Span span) override { | 194 void pointSpan(Span span) override { |
| 195 SkASSERT(!span.isEmpty()); | 195 SkASSERT(!span.isEmpty()); |
| 196 SkPoint start; SkScalar length; int count; | 196 SkPoint start; SkScalar length; int count; |
| 197 std::tie(start, length, count) = span; | 197 std::tie(start, length, count) = span; |
| (...skipping 22 matching lines...) Expand all Loading... |
| 220 , fXStrategy{dimensions.width()} | 220 , fXStrategy{dimensions.width()} |
| 221 , fYStrategy{dimensions.height()} { } | 221 , fYStrategy{dimensions.height()} { } |
| 222 | 222 |
| 223 BilerpTileStage(Next* next, const BilerpTileStage& stage) | 223 BilerpTileStage(Next* next, const BilerpTileStage& stage) |
| 224 : fNext{next} | 224 : fNext{next} |
| 225 , fXMax{stage.fXMax} | 225 , fXMax{stage.fXMax} |
| 226 , fYMax{stage.fYMax} | 226 , fYMax{stage.fYMax} |
| 227 , fXStrategy{stage.fXStrategy} | 227 , fXStrategy{stage.fXStrategy} |
| 228 , fYStrategy{stage.fYStrategy} { } | 228 , fYStrategy{stage.fYStrategy} { } |
| 229 | 229 |
| 230 void VECTORCALL pointListFew(int n, Sk4s xs, Sk4s ys) override { | 230 void SK_VECTORCALL pointListFew(int n, Sk4s xs, Sk4s ys) override { |
| 231 fXStrategy.tileXPoints(&xs); | 231 fXStrategy.tileXPoints(&xs); |
| 232 fYStrategy.tileYPoints(&ys); | 232 fYStrategy.tileYPoints(&ys); |
| 233 // TODO: check to see if xs and ys are in range then just call pointList
Few on next. | 233 // TODO: check to see if xs and ys are in range then just call pointList
Few on next. |
| 234 if (n >= 1) this->bilerpPoint(xs[0], ys[0]); | 234 if (n >= 1) this->bilerpPoint(xs[0], ys[0]); |
| 235 if (n >= 2) this->bilerpPoint(xs[1], ys[1]); | 235 if (n >= 2) this->bilerpPoint(xs[1], ys[1]); |
| 236 if (n >= 3) this->bilerpPoint(xs[2], ys[2]); | 236 if (n >= 3) this->bilerpPoint(xs[2], ys[2]); |
| 237 } | 237 } |
| 238 | 238 |
| 239 void VECTORCALL pointList4(Sk4s xs, Sk4s ys) override { | 239 void SK_VECTORCALL pointList4(Sk4s xs, Sk4s ys) override { |
| 240 fXStrategy.tileXPoints(&xs); | 240 fXStrategy.tileXPoints(&xs); |
| 241 fYStrategy.tileYPoints(&ys); | 241 fYStrategy.tileYPoints(&ys); |
| 242 // TODO: check to see if xs and ys are in range then just call pointList
4 on next. | 242 // TODO: check to see if xs and ys are in range then just call pointList
4 on next. |
| 243 this->bilerpPoint(xs[0], ys[0]); | 243 this->bilerpPoint(xs[0], ys[0]); |
| 244 this->bilerpPoint(xs[1], ys[1]); | 244 this->bilerpPoint(xs[1], ys[1]); |
| 245 this->bilerpPoint(xs[2], ys[2]); | 245 this->bilerpPoint(xs[2], ys[2]); |
| 246 this->bilerpPoint(xs[3], ys[3]); | 246 this->bilerpPoint(xs[3], ys[3]); |
| 247 } | 247 } |
| 248 | 248 |
| 249 struct Wrapper { | 249 struct Wrapper { |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 414 | 414 |
| 415 // RGBA8888UnitRepeatSrc - A sampler that takes advantage of the fact the the sr
c and destination | 415 // RGBA8888UnitRepeatSrc - A sampler that takes advantage of the fact the the sr
c and destination |
| 416 // are the same format and do not need in transformations in pixel space. Theref
ore, there is no | 416 // are the same format and do not need in transformations in pixel space. Theref
ore, there is no |
| 417 // need to convert them to HiFi pixel format. | 417 // need to convert them to HiFi pixel format. |
| 418 class RGBA8888UnitRepeatSrc final : public SkLinearBitmapPipeline::SampleProcess
orInterface, | 418 class RGBA8888UnitRepeatSrc final : public SkLinearBitmapPipeline::SampleProcess
orInterface, |
| 419 public SkLinearBitmapPipeline::DestinationIn
terface { | 419 public SkLinearBitmapPipeline::DestinationIn
terface { |
| 420 public: | 420 public: |
| 421 RGBA8888UnitRepeatSrc(const uint32_t* src, int32_t width) | 421 RGBA8888UnitRepeatSrc(const uint32_t* src, int32_t width) |
| 422 : fSrc{src}, fWidth{width} { } | 422 : fSrc{src}, fWidth{width} { } |
| 423 | 423 |
| 424 void VECTORCALL pointListFew(int n, Sk4s xs, Sk4s ys) override { | 424 void SK_VECTORCALL pointListFew(int n, Sk4s xs, Sk4s ys) override { |
| 425 SkASSERT(fDest + n <= fEnd); | 425 SkASSERT(fDest + n <= fEnd); |
| 426 // At this point xs and ys should be >= 0, so trunc is the same as floor
. | 426 // At this point xs and ys should be >= 0, so trunc is the same as floor
. |
| 427 Sk4i iXs = SkNx_cast<int>(xs); | 427 Sk4i iXs = SkNx_cast<int>(xs); |
| 428 Sk4i iYs = SkNx_cast<int>(ys); | 428 Sk4i iYs = SkNx_cast<int>(ys); |
| 429 | 429 |
| 430 if (n >= 1) *fDest++ = *this->pixelAddress(iXs[0], iYs[0]); | 430 if (n >= 1) *fDest++ = *this->pixelAddress(iXs[0], iYs[0]); |
| 431 if (n >= 2) *fDest++ = *this->pixelAddress(iXs[1], iYs[1]); | 431 if (n >= 2) *fDest++ = *this->pixelAddress(iXs[1], iYs[1]); |
| 432 if (n >= 3) *fDest++ = *this->pixelAddress(iXs[2], iYs[2]); | 432 if (n >= 3) *fDest++ = *this->pixelAddress(iXs[2], iYs[2]); |
| 433 } | 433 } |
| 434 | 434 |
| 435 void VECTORCALL pointList4(Sk4s xs, Sk4s ys) override { | 435 void SK_VECTORCALL pointList4(Sk4s xs, Sk4s ys) override { |
| 436 SkASSERT(fDest + 4 <= fEnd); | 436 SkASSERT(fDest + 4 <= fEnd); |
| 437 Sk4i iXs = SkNx_cast<int>(xs); | 437 Sk4i iXs = SkNx_cast<int>(xs); |
| 438 Sk4i iYs = SkNx_cast<int>(ys); | 438 Sk4i iYs = SkNx_cast<int>(ys); |
| 439 *fDest++ = *this->pixelAddress(iXs[0], iYs[0]); | 439 *fDest++ = *this->pixelAddress(iXs[0], iYs[0]); |
| 440 *fDest++ = *this->pixelAddress(iXs[1], iYs[1]); | 440 *fDest++ = *this->pixelAddress(iXs[1], iYs[1]); |
| 441 *fDest++ = *this->pixelAddress(iXs[2], iYs[2]); | 441 *fDest++ = *this->pixelAddress(iXs[2], iYs[2]); |
| 442 *fDest++ = *this->pixelAddress(iXs[3], iYs[3]); | 442 *fDest++ = *this->pixelAddress(iXs[3], iYs[3]); |
| 443 } | 443 } |
| 444 | 444 |
| 445 void pointSpan(Span span) override { | 445 void pointSpan(Span span) override { |
| (...skipping 14 matching lines...) Expand all Loading... |
| 460 int32_t y = SkScalarTruncToInt(span.startY()); | 460 int32_t y = SkScalarTruncToInt(span.startY()); |
| 461 const uint32_t* src = this->pixelAddress(x, y); | 461 const uint32_t* src = this->pixelAddress(x, y); |
| 462 uint32_t* dest = fDest; | 462 uint32_t* dest = fDest; |
| 463 while (repeatCount --> 0) { | 463 while (repeatCount --> 0) { |
| 464 memmove(dest, src, span.count() * sizeof(uint32_t)); | 464 memmove(dest, src, span.count() * sizeof(uint32_t)); |
| 465 dest += span.count(); | 465 dest += span.count(); |
| 466 } | 466 } |
| 467 fDest = dest; | 467 fDest = dest; |
| 468 } | 468 } |
| 469 | 469 |
| 470 void VECTORCALL bilerpEdge(Sk4s xs, Sk4s ys) override { SkFAIL("Not Implemen
ted"); } | 470 void SK_VECTORCALL bilerpEdge(Sk4s xs, Sk4s ys) override { SkFAIL("Not Imple
mented"); } |
| 471 | 471 |
| 472 void bilerpSpan(Span span, SkScalar y) override { SkFAIL("Not Implemented");
} | 472 void bilerpSpan(Span span, SkScalar y) override { SkFAIL("Not Implemented");
} |
| 473 | 473 |
| 474 void setDestination(void* dst, int count) override { | 474 void setDestination(void* dst, int count) override { |
| 475 fDest = static_cast<uint32_t*>(dst); | 475 fDest = static_cast<uint32_t*>(dst); |
| 476 fEnd = fDest + count; | 476 fEnd = fDest + count; |
| 477 } | 477 } |
| 478 | 478 |
| 479 private: | 479 private: |
| 480 const uint32_t* pixelAddress(int32_t x, int32_t y) { | 480 const uint32_t* pixelAddress(int32_t x, int32_t y) { |
| 481 return &fSrc[fWidth * y + x]; | 481 return &fSrc[fWidth * y + x]; |
| 482 } | 482 } |
| 483 const uint32_t* const fSrc; | 483 const uint32_t* const fSrc; |
| 484 const int32_t fWidth; | 484 const int32_t fWidth; |
| 485 uint32_t* fDest; | 485 uint32_t* fDest; |
| 486 uint32_t* fEnd; | 486 uint32_t* fEnd; |
| 487 }; | 487 }; |
| 488 | 488 |
| 489 // RGBA8888UnitRepeatSrc - A sampler that takes advantage of the fact the the sr
c and destination | 489 // RGBA8888UnitRepeatSrc - A sampler that takes advantage of the fact the the sr
c and destination |
| 490 // are the same format and do not need in transformations in pixel space. Theref
ore, there is no | 490 // are the same format and do not need in transformations in pixel space. Theref
ore, there is no |
| 491 // need to convert them to HiFi pixel format. | 491 // need to convert them to HiFi pixel format. |
| 492 class RGBA8888UnitRepeatSrcOver final : public SkLinearBitmapPipeline::SamplePro
cessorInterface, | 492 class RGBA8888UnitRepeatSrcOver final : public SkLinearBitmapPipeline::SamplePro
cessorInterface, |
| 493 public SkLinearBitmapPipeline::Destinati
onInterface { | 493 public SkLinearBitmapPipeline::Destinati
onInterface { |
| 494 public: | 494 public: |
| 495 RGBA8888UnitRepeatSrcOver(const uint32_t* src, int32_t width) | 495 RGBA8888UnitRepeatSrcOver(const uint32_t* src, int32_t width) |
| 496 : fSrc{src}, fWidth{width} { } | 496 : fSrc{src}, fWidth{width} { } |
| 497 | 497 |
| 498 void VECTORCALL pointListFew(int n, Sk4s xs, Sk4s ys) override { | 498 void SK_VECTORCALL pointListFew(int n, Sk4s xs, Sk4s ys) override { |
| 499 SkASSERT(fDest + n <= fEnd); | 499 SkASSERT(fDest + n <= fEnd); |
| 500 // At this point xs and ys should be >= 0, so trunc is the same as floor
. | 500 // At this point xs and ys should be >= 0, so trunc is the same as floor
. |
| 501 Sk4i iXs = SkNx_cast<int>(xs); | 501 Sk4i iXs = SkNx_cast<int>(xs); |
| 502 Sk4i iYs = SkNx_cast<int>(ys); | 502 Sk4i iYs = SkNx_cast<int>(ys); |
| 503 | 503 |
| 504 if (n >= 1) blendPixelAt(iXs[0], iYs[0]); | 504 if (n >= 1) blendPixelAt(iXs[0], iYs[0]); |
| 505 if (n >= 2) blendPixelAt(iXs[1], iYs[1]); | 505 if (n >= 2) blendPixelAt(iXs[1], iYs[1]); |
| 506 if (n >= 3) blendPixelAt(iXs[2], iYs[2]); | 506 if (n >= 3) blendPixelAt(iXs[2], iYs[2]); |
| 507 } | 507 } |
| 508 | 508 |
| 509 void VECTORCALL pointList4(Sk4s xs, Sk4s ys) override { | 509 void SK_VECTORCALL pointList4(Sk4s xs, Sk4s ys) override { |
| 510 SkASSERT(fDest + 4 <= fEnd); | 510 SkASSERT(fDest + 4 <= fEnd); |
| 511 Sk4i iXs = SkNx_cast<int>(xs); | 511 Sk4i iXs = SkNx_cast<int>(xs); |
| 512 Sk4i iYs = SkNx_cast<int>(ys); | 512 Sk4i iYs = SkNx_cast<int>(ys); |
| 513 blendPixelAt(iXs[0], iYs[0]); | 513 blendPixelAt(iXs[0], iYs[0]); |
| 514 blendPixelAt(iXs[1], iYs[1]); | 514 blendPixelAt(iXs[1], iYs[1]); |
| 515 blendPixelAt(iXs[2], iYs[2]); | 515 blendPixelAt(iXs[2], iYs[2]); |
| 516 blendPixelAt(iXs[3], iYs[3]); | 516 blendPixelAt(iXs[3], iYs[3]); |
| 517 } | 517 } |
| 518 | 518 |
| 519 void pointSpan(Span span) override { | 519 void pointSpan(Span span) override { |
| (...skipping 11 matching lines...) Expand all Loading... |
| 531 int32_t y = (int32_t)span.startY(); | 531 int32_t y = (int32_t)span.startY(); |
| 532 const uint32_t* beginSpan = this->pixelAddress(x, y); | 532 const uint32_t* beginSpan = this->pixelAddress(x, y); |
| 533 | 533 |
| 534 SkOpts::srcover_srgb_srgb(fDest, beginSpan, span.count() * repeatCount,
span.count()); | 534 SkOpts::srcover_srgb_srgb(fDest, beginSpan, span.count() * repeatCount,
span.count()); |
| 535 | 535 |
| 536 fDest += span.count() * repeatCount; | 536 fDest += span.count() * repeatCount; |
| 537 | 537 |
| 538 SkASSERT(fDest <= fEnd); | 538 SkASSERT(fDest <= fEnd); |
| 539 } | 539 } |
| 540 | 540 |
| 541 void VECTORCALL bilerpEdge(Sk4s xs, Sk4s ys) override { SkFAIL("Not Implemen
ted"); } | 541 void SK_VECTORCALL bilerpEdge(Sk4s xs, Sk4s ys) override { SkFAIL("Not Imple
mented"); } |
| 542 | 542 |
| 543 void bilerpSpan(Span span, SkScalar y) override { SkFAIL("Not Implemented");
} | 543 void bilerpSpan(Span span, SkScalar y) override { SkFAIL("Not Implemented");
} |
| 544 | 544 |
| 545 void setDestination(void* dst, int count) override { | 545 void setDestination(void* dst, int count) override { |
| 546 SkASSERT(count > 0); | 546 SkASSERT(count > 0); |
| 547 fDest = static_cast<uint32_t*>(dst); | 547 fDest = static_cast<uint32_t*>(dst); |
| 548 fEnd = fDest + count; | 548 fEnd = fDest + count; |
| 549 } | 549 } |
| 550 | 550 |
| 551 private: | 551 private: |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 641 } | 641 } |
| 642 } | 642 } |
| 643 | 643 |
| 644 ////////////////////////////////////////////////////////////////////////////////
//////////////////// | 644 ////////////////////////////////////////////////////////////////////////////////
//////////////////// |
| 645 // Pixel Blender Stage | 645 // Pixel Blender Stage |
| 646 template <SkAlphaType alphaType> | 646 template <SkAlphaType alphaType> |
| 647 class SrcFPPixel final : public SkLinearBitmapPipeline::BlendProcessorInterface
{ | 647 class SrcFPPixel final : public SkLinearBitmapPipeline::BlendProcessorInterface
{ |
| 648 public: | 648 public: |
| 649 SrcFPPixel(float postAlpha) : fPostAlpha{postAlpha} { } | 649 SrcFPPixel(float postAlpha) : fPostAlpha{postAlpha} { } |
| 650 SrcFPPixel(const SrcFPPixel& Blender) : fPostAlpha(Blender.fPostAlpha) {} | 650 SrcFPPixel(const SrcFPPixel& Blender) : fPostAlpha(Blender.fPostAlpha) {} |
| 651 void VECTORCALL blendPixel(Sk4f pixel) override { | 651 void SK_VECTORCALL blendPixel(Sk4f pixel) override { |
| 652 SkASSERT(fDst + 1 <= fEnd ); | 652 SkASSERT(fDst + 1 <= fEnd ); |
| 653 SrcPixel(fDst, pixel, 0); | 653 SrcPixel(fDst, pixel, 0); |
| 654 fDst += 1; | 654 fDst += 1; |
| 655 } | 655 } |
| 656 | 656 |
| 657 void VECTORCALL blend4Pixels(Sk4f p0, Sk4f p1, Sk4f p2, Sk4f p3) override { | 657 void SK_VECTORCALL blend4Pixels(Sk4f p0, Sk4f p1, Sk4f p2, Sk4f p3) override
{ |
| 658 SkASSERT(fDst + 4 <= fEnd); | 658 SkASSERT(fDst + 4 <= fEnd); |
| 659 SkPM4f* dst = fDst; | 659 SkPM4f* dst = fDst; |
| 660 SrcPixel(dst, p0, 0); | 660 SrcPixel(dst, p0, 0); |
| 661 SrcPixel(dst, p1, 1); | 661 SrcPixel(dst, p1, 1); |
| 662 SrcPixel(dst, p2, 2); | 662 SrcPixel(dst, p2, 2); |
| 663 SrcPixel(dst, p3, 3); | 663 SrcPixel(dst, p3, 3); |
| 664 fDst += 4; | 664 fDst += 4; |
| 665 } | 665 } |
| 666 | 666 |
| 667 void setDestination(void* dst, int count) override { | 667 void setDestination(void* dst, int count) override { |
| 668 fDst = static_cast<SkPM4f*>(dst); | 668 fDst = static_cast<SkPM4f*>(dst); |
| 669 fEnd = fDst + count; | 669 fEnd = fDst + count; |
| 670 } | 670 } |
| 671 | 671 |
| 672 private: | 672 private: |
| 673 void VECTORCALL SrcPixel(SkPM4f* dst, Sk4f pixel, int index) { | 673 void SK_VECTORCALL SrcPixel(SkPM4f* dst, Sk4f pixel, int index) { |
| 674 Sk4f newPixel = pixel; | 674 Sk4f newPixel = pixel; |
| 675 if (alphaType == kUnpremul_SkAlphaType) { | 675 if (alphaType == kUnpremul_SkAlphaType) { |
| 676 newPixel = Premultiply(pixel); | 676 newPixel = Premultiply(pixel); |
| 677 } | 677 } |
| 678 newPixel = newPixel * fPostAlpha; | 678 newPixel = newPixel * fPostAlpha; |
| 679 newPixel.store(dst + index); | 679 newPixel.store(dst + index); |
| 680 } | 680 } |
| 681 static Sk4f VECTORCALL Premultiply(Sk4f pixel) { | 681 static Sk4f SK_VECTORCALL Premultiply(Sk4f pixel) { |
| 682 float alpha = pixel[3]; | 682 float alpha = pixel[3]; |
| 683 return pixel * Sk4f{alpha, alpha, alpha, 1.0f}; | 683 return pixel * Sk4f{alpha, alpha, alpha, 1.0f}; |
| 684 } | 684 } |
| 685 | 685 |
| 686 SkPM4f* fDst; | 686 SkPM4f* fDst; |
| 687 SkPM4f* fEnd; | 687 SkPM4f* fEnd; |
| 688 Sk4f fPostAlpha; | 688 Sk4f fPostAlpha; |
| 689 }; | 689 }; |
| 690 | 690 |
| 691 static SkLinearBitmapPipeline::BlendProcessorInterface* choose_blender_for_shadi
ng( | 691 static SkLinearBitmapPipeline::BlendProcessorInterface* choose_blender_for_shadi
ng( |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 821 void SkLinearBitmapPipeline::blitSpan(int x, int y, void* dst, int count) { | 821 void SkLinearBitmapPipeline::blitSpan(int x, int y, void* dst, int count) { |
| 822 SkASSERT(count > 0); | 822 SkASSERT(count > 0); |
| 823 fLastStage->setDestination(dst, count); | 823 fLastStage->setDestination(dst, count); |
| 824 | 824 |
| 825 // The count and length arguments start out in a precise relation in order t
o keep the | 825 // The count and length arguments start out in a precise relation in order t
o keep the |
| 826 // math correct through the different stages. Count is the number of pixel t
o produce. | 826 // math correct through the different stages. Count is the number of pixel t
o produce. |
| 827 // Since the code samples at pixel centers, length is the distance from the
center of the | 827 // Since the code samples at pixel centers, length is the distance from the
center of the |
| 828 // first pixel to the center of the last pixel. This implies that length is
count-1. | 828 // first pixel to the center of the last pixel. This implies that length is
count-1. |
| 829 fFirstStage->pointSpan(Span{{x + 0.5f, y + 0.5f}, count - 1.0f, count}); | 829 fFirstStage->pointSpan(Span{{x + 0.5f, y + 0.5f}, count - 1.0f, count}); |
| 830 } | 830 } |
| OLD | NEW |