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_DEFINED | 8 #ifndef SkLinearBitmapPipeline_DEFINED |
9 #define SkLinearBitmapPipeline_DEFINED | 9 #define SkLinearBitmapPipeline_DEFINED |
10 | 10 |
11 | 11 |
12 #include "SkColor.h" | 12 #include "SkColor.h" |
13 #include "SkImageInfo.h" | 13 #include "SkImageInfo.h" |
14 #include "SkMatrix.h" | 14 #include "SkMatrix.h" |
15 #include "SkNx.h" | 15 #include "SkNx.h" |
16 #include "SkShader.h" | 16 #include "SkShader.h" |
17 | 17 |
18 using Sk4fArg = const Sk4f&; | 18 using Sk4fArg = const Sk4f&; |
19 | 19 |
20 class PointProcessorInterface { | 20 class PointProcessorInterface { |
21 public: | 21 public: |
22 virtual ~PointProcessorInterface() { } | 22 virtual ~PointProcessorInterface() { } |
23 virtual void pointListFew(int n, Sk4fArg xs, Sk4fArg ys) = 0; | 23 virtual void pointListFew(int n, Sk4fArg xs, Sk4fArg ys) = 0; |
24 virtual void pointList4(Sk4fArg xs, Sk4fArg ys) = 0; | 24 virtual void pointList4(Sk4fArg xs, Sk4fArg ys) = 0; |
| 25 |
| 26 // The pointSpan method efficiently process horizontal spans of pixels. |
| 27 // * start - the point where to start the span. |
| 28 // * length - the number of pixels to traverse in source space. |
| 29 // * count - the number of pixels to produce in destination space. |
| 30 // Both start and length are mapped through the inversion matrix to produce
values in source |
| 31 // space. After the matrix operation, the tilers may break the spans up into
smaller spans. |
| 32 // The tilers can produce spans that seem nonsensical. |
| 33 // * The clamp tiler can create spans with length of 0. This indicates to co
py an edge pixel out |
| 34 // to the edge of the destination scan. |
| 35 // * The mirror tiler can produce spans with negative length. This indicates
that the source |
| 36 // should be traversed in the opposite direction to the destination pixels
. |
| 37 virtual void pointSpan(SkPoint start, SkScalar length, int count) = 0; |
25 }; | 38 }; |
26 | 39 |
27 class BilerpProcessorInterface : public PointProcessorInterface { | 40 class BilerpProcessorInterface : public PointProcessorInterface { |
28 public: | 41 public: |
29 // The x's and y's are setup in the following order: | 42 // The x's and y's are setup in the following order: |
30 // +--------+--------+ | 43 // +--------+--------+ |
31 // | | | | 44 // | | | |
32 // | px00 | px10 | | 45 // | px00 | px10 | |
33 // | 0 | 1 | | 46 // | 0 | 1 | |
34 // +--------+--------+ | 47 // +--------+--------+ |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 PointProcessorInterface* fFirstStage; | 108 PointProcessorInterface* fFirstStage; |
96 MatrixStage fMatrixStage; | 109 MatrixStage fMatrixStage; |
97 FilterStage fFilterStage; | 110 FilterStage fFilterStage; |
98 TileStage fTileXOrBothStage; | 111 TileStage fTileXOrBothStage; |
99 TileStage fTileYStage; | 112 TileStage fTileYStage; |
100 SampleStage fSampleStage; | 113 SampleStage fSampleStage; |
101 PixelStage fPixelStage; | 114 PixelStage fPixelStage; |
102 }; | 115 }; |
103 | 116 |
104 #endif // SkLinearBitmapPipeline_DEFINED | 117 #endif // SkLinearBitmapPipeline_DEFINED |
OLD | NEW |