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 "SkPM4f.h" | 10 #include "SkPM4f.h" |
(...skipping 566 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
577 Sk4i iXs = SkNx_cast<int>(xs); | 577 Sk4i iXs = SkNx_cast<int>(xs); |
578 Sk4i iYs = SkNx_cast<int>(ys); | 578 Sk4i iYs = SkNx_cast<int>(ys); |
579 *fDest++ = *this->pixelAddress(iXs[0], iYs[0]); | 579 *fDest++ = *this->pixelAddress(iXs[0], iYs[0]); |
580 *fDest++ = *this->pixelAddress(iXs[1], iYs[1]); | 580 *fDest++ = *this->pixelAddress(iXs[1], iYs[1]); |
581 *fDest++ = *this->pixelAddress(iXs[2], iYs[2]); | 581 *fDest++ = *this->pixelAddress(iXs[2], iYs[2]); |
582 *fDest++ = *this->pixelAddress(iXs[3], iYs[3]); | 582 *fDest++ = *this->pixelAddress(iXs[3], iYs[3]); |
583 } | 583 } |
584 | 584 |
585 void pointSpan(Span span) override { | 585 void pointSpan(Span span) override { |
586 SkASSERT(fDest + span.count() <= fEnd); | 586 SkASSERT(fDest + span.count() <= fEnd); |
587 int32_t x = (int32_t)span.startX(); | 587 if (span.length() != 0.0f) { |
588 int32_t y = (int32_t)span.startY(); | 588 int32_t x = (int32_t)span.startX(); |
Brian Osman
2016/04/25 20:00:18
Should these be using SkScalarFloorToInt, just to
herb_g
2016/04/25 20:36:36
At this point, I know that startX > 0, so I want t
| |
589 const uint32_t* src = this->pixelAddress(x, y); | 589 int32_t y = (int32_t)span.startY(); |
590 memmove(fDest, src, span.count() * sizeof(uint32_t)); | 590 const uint32_t* src = this->pixelAddress(x, y); |
591 fDest += span.count(); | 591 memmove(fDest, src, span.count() * sizeof(uint32_t)); |
592 fDest += span.count(); | |
593 } | |
592 } | 594 } |
593 | 595 |
594 void repeatSpan(Span span, int32_t repeatCount) override { | 596 void repeatSpan(Span span, int32_t repeatCount) override { |
595 SkASSERT(fDest + span.count() * repeatCount <= fEnd); | 597 SkASSERT(fDest + span.count() * repeatCount <= fEnd); |
596 | 598 |
597 int32_t x = (int32_t)span.startX(); | 599 int32_t x = (int32_t)span.startX(); |
598 int32_t y = (int32_t)span.startY(); | 600 int32_t y = (int32_t)span.startY(); |
599 const uint32_t* src = this->pixelAddress(x, y); | 601 const uint32_t* src = this->pixelAddress(x, y); |
600 uint32_t* dest = fDest; | 602 uint32_t* dest = fDest; |
601 while (repeatCount --> 0) { | 603 while (repeatCount --> 0) { |
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
847 void SkLinearBitmapPipeline::blitSpan(int x, int y, void* dst, int count) { | 849 void SkLinearBitmapPipeline::blitSpan(int x, int y, void* dst, int count) { |
848 SkASSERT(count > 0); | 850 SkASSERT(count > 0); |
849 fLastStage->setDestination(dst, count); | 851 fLastStage->setDestination(dst, count); |
850 | 852 |
851 // The count and length arguments start out in a precise relation in order t o keep the | 853 // The count and length arguments start out in a precise relation in order t o keep the |
852 // math correct through the different stages. Count is the number of pixel t o produce. | 854 // math correct through the different stages. Count is the number of pixel t o produce. |
853 // Since the code samples at pixel centers, length is the distance from the center of the | 855 // Since the code samples at pixel centers, length is the distance from the center of the |
854 // first pixel to the center of the last pixel. This implies that length is count-1. | 856 // first pixel to the center of the last pixel. This implies that length is count-1. |
855 fFirstStage->pointSpan(Span{{x + 0.5f, y + 0.5f}, count - 1.0f, count}); | 857 fFirstStage->pointSpan(Span{{x + 0.5f, y + 0.5f}, count - 1.0f, count}); |
856 } | 858 } |
OLD | NEW |