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 579 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
590 newPixel = newPixel * fPostAlpha; | 590 newPixel = newPixel * fPostAlpha; |
591 newPixel.store(dst + index); | 591 newPixel.store(dst + index); |
592 } | 592 } |
593 static Sk4f SK_VECTORCALL Premultiply(Sk4f pixel) { | 593 static Sk4f SK_VECTORCALL Premultiply(Sk4f pixel) { |
594 float alpha = pixel[3]; | 594 float alpha = pixel[3]; |
595 return pixel * Sk4f{alpha, alpha, alpha, 1.0f}; | 595 return pixel * Sk4f{alpha, alpha, alpha, 1.0f}; |
596 } | 596 } |
597 | 597 |
598 SkPM4f* fDst; | 598 SkPM4f* fDst; |
599 SkPM4f* fEnd; | 599 SkPM4f* fEnd; |
600 Sk4f fPostAlpha; | 600 float fPostAlpha; |
601 }; | 601 }; |
602 | 602 |
603 static SkLinearBitmapPipeline::BlendProcessorInterface* choose_blender_for_shadi
ng( | 603 static SkLinearBitmapPipeline::BlendProcessorInterface* choose_blender_for_shadi
ng( |
604 SkAlphaType alphaType, | 604 SkAlphaType alphaType, |
605 float postAlpha, | 605 float postAlpha, |
606 SkLinearBitmapPipeline::BlenderStage* blenderStage) { | 606 SkLinearBitmapPipeline::BlenderStage* blenderStage) { |
607 if (alphaType == kUnpremul_SkAlphaType) { | 607 if (alphaType == kUnpremul_SkAlphaType) { |
608 blenderStage->initSink<SrcFPPixel<kUnpremul_SkAlphaType>>(postAlpha); | 608 blenderStage->initSink<SrcFPPixel<kUnpremul_SkAlphaType>>(postAlpha); |
609 } else { | 609 } else { |
610 // kOpaque_SkAlphaType is treated the same as kPremul_SkAlphaType | 610 // kOpaque_SkAlphaType is treated the same as kPremul_SkAlphaType |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
734 void SkLinearBitmapPipeline::blitSpan(int x, int y, void* dst, int count) { | 734 void SkLinearBitmapPipeline::blitSpan(int x, int y, void* dst, int count) { |
735 SkASSERT(count > 0); | 735 SkASSERT(count > 0); |
736 fLastStage->setDestination(dst, count); | 736 fLastStage->setDestination(dst, count); |
737 | 737 |
738 // The count and length arguments start out in a precise relation in order t
o keep the | 738 // The count and length arguments start out in a precise relation in order t
o keep the |
739 // math correct through the different stages. Count is the number of pixel t
o produce. | 739 // math correct through the different stages. Count is the number of pixel t
o produce. |
740 // Since the code samples at pixel centers, length is the distance from the
center of the | 740 // Since the code samples at pixel centers, length is the distance from the
center of the |
741 // first pixel to the center of the last pixel. This implies that length is
count-1. | 741 // first pixel to the center of the last pixel. This implies that length is
count-1. |
742 fFirstStage->pointSpan(Span{{x + 0.5f, y + 0.5f}, count - 1.0f, count}); | 742 fFirstStage->pointSpan(Span{{x + 0.5f, y + 0.5f}, count - 1.0f, count}); |
743 } | 743 } |
OLD | NEW |