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 #ifndef SkLinearBitmapPipeline_sampler_DEFINED | 8 #ifndef SkLinearBitmapPipeline_sampler_DEFINED |
9 #define SkLinearBitmapPipeline_sampler_DEFINED | 9 #define SkLinearBitmapPipeline_sampler_DEFINED |
10 | 10 |
(...skipping 759 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
770 | 770 |
771 void get4Pixels(const void* vsrc, int index, Sk4f* px0, Sk4f* px1, Sk4f* px2
, Sk4f* px3) { | 771 void get4Pixels(const void* vsrc, int index, Sk4f* px0, Sk4f* px1, Sk4f* px2
, Sk4f* px3) { |
772 const uint32_t* src = static_cast<const uint32_t*>(vsrc); | 772 const uint32_t* src = static_cast<const uint32_t*>(vsrc); |
773 *px0 = this->getPixelAt(src, index + 0); | 773 *px0 = this->getPixelAt(src, index + 0); |
774 *px1 = this->getPixelAt(src, index + 1); | 774 *px1 = this->getPixelAt(src, index + 1); |
775 *px2 = this->getPixelAt(src, index + 2); | 775 *px2 = this->getPixelAt(src, index + 2); |
776 *px3 = this->getPixelAt(src, index + 3); | 776 *px3 = this->getPixelAt(src, index + 3); |
777 } | 777 } |
778 | 778 |
779 Sk4f getPixelAt(const void* vsrc, int index) { | 779 Sk4f getPixelAt(const void* vsrc, int index) { |
780 const uint64_t* src = static_cast<const uint64_t*>(vsrc); | 780 const uint64_t* src = static_cast<const uint64_t*>(vsrc) + index; |
781 return SkHalfToFloat_01(*src); | 781 return SkHalfToFloat_01(*src); |
782 } | 782 } |
783 | 783 |
784 const void* row(int y) { return fSrc + y * fWidth[0]; } | 784 const void* row(int y) { return fSrc + y * fWidth[0]; } |
785 | 785 |
786 private: | 786 private: |
787 const uint64_t* const fSrc; | 787 const uint64_t* const fSrc; |
788 const Sk4i fWidth; | 788 const Sk4i fWidth; |
789 }; | 789 }; |
790 | 790 |
791 } // namespace | 791 } // namespace |
792 | 792 |
793 #endif // SkLinearBitmapPipeline_sampler_DEFINED | 793 #endif // SkLinearBitmapPipeline_sampler_DEFINED |
OLD | NEW |