| 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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 | 47 |
| 48 class SkLinearBitmapPipeline::PixelPlacerInterface { | 48 class SkLinearBitmapPipeline::PixelPlacerInterface { |
| 49 public: | 49 public: |
| 50 virtual ~PixelPlacerInterface() { } | 50 virtual ~PixelPlacerInterface() { } |
| 51 virtual void setDestination(SkPM4f* dst) = 0; | 51 virtual void setDestination(SkPM4f* dst) = 0; |
| 52 virtual void VECTORCALL placePixel(Sk4f pixel0) = 0; | 52 virtual void VECTORCALL placePixel(Sk4f pixel0) = 0; |
| 53 virtual void VECTORCALL place4Pixels(Sk4f p0, Sk4f p1, Sk4f p2, Sk4f p3) = 0
; | 53 virtual void VECTORCALL place4Pixels(Sk4f p0, Sk4f p1, Sk4f p2, Sk4f p3) = 0
; |
| 54 }; | 54 }; |
| 55 | 55 |
| 56 namespace { | 56 namespace { |
| 57 | |
| 58 // PointProcessor uses a strategy to help complete the work of the different sta
ges. The strategy | 57 // PointProcessor uses a strategy to help complete the work of the different sta
ges. The strategy |
| 59 // must implement the following methods: | 58 // must implement the following methods: |
| 60 // * processPoints(xs, ys) - must mutate the xs and ys for the stage. | 59 // * processPoints(xs, ys) - must mutate the xs and ys for the stage. |
| 61 // * maybeProcessSpan(span, next) - This represents a horizontal series of pixel
s | 60 // * maybeProcessSpan(span, next) - This represents a horizontal series of pixel
s |
| 62 // to work over. | 61 // to work over. |
| 63 // span - encapsulation of span. | 62 // span - encapsulation of span. |
| 64 // next - a pointer to the next stage. | 63 // next - a pointer to the next stage. |
| 65 // maybeProcessSpan - returns false if it can not process the span and needs t
o fallback to | 64 // maybeProcessSpan - returns false if it can not process the span and needs t
o fallback to |
| 66 // point lists for processing. | 65 // point lists for processing. |
| 67 template<typename Strategy, typename Next> | 66 template<typename Strategy, typename Next> |
| (...skipping 557 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 625 | 624 |
| 626 void SkLinearBitmapPipeline::shadeSpan4f(int x, int y, SkPM4f* dst, int count) { | 625 void SkLinearBitmapPipeline::shadeSpan4f(int x, int y, SkPM4f* dst, int count) { |
| 627 SkASSERT(count > 0); | 626 SkASSERT(count > 0); |
| 628 fPixelStage->setDestination(dst); | 627 fPixelStage->setDestination(dst); |
| 629 // The count and length arguments start out in a precise relation in order t
o keep the | 628 // The count and length arguments start out in a precise relation in order t
o keep the |
| 630 // math correct through the different stages. Count is the number of pixel t
o produce. | 629 // math correct through the different stages. Count is the number of pixel t
o produce. |
| 631 // Since the code samples at pixel centers, length is the distance from the
center of the | 630 // Since the code samples at pixel centers, length is the distance from the
center of the |
| 632 // first pixel to the center of the last pixel. This implies that length is
count-1. | 631 // first pixel to the center of the last pixel. This implies that length is
count-1. |
| 633 fFirstStage->pointSpan(Span{SkPoint{x + 0.5f, y + 0.5f}, count - 1.0f, count
}); | 632 fFirstStage->pointSpan(Span{SkPoint{x + 0.5f, y + 0.5f}, count - 1.0f, count
}); |
| 634 } | 633 } |
| OLD | NEW |