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 |
(...skipping 10 matching lines...) Expand all Loading... |
21 | 21 |
22 using Sk4fArg = const Sk4f&; | 22 using Sk4fArg = const Sk4f&; |
23 | 23 |
24 class PointProcessorInterface { | 24 class PointProcessorInterface { |
25 public: | 25 public: |
26 virtual ~PointProcessorInterface() { } | 26 virtual ~PointProcessorInterface() { } |
27 virtual void pointListFew(int n, Sk4fArg xs, Sk4fArg ys) = 0; | 27 virtual void pointListFew(int n, Sk4fArg xs, Sk4fArg ys) = 0; |
28 virtual void pointList4(Sk4fArg xs, Sk4fArg ys) = 0; | 28 virtual void pointList4(Sk4fArg xs, Sk4fArg ys) = 0; |
29 }; | 29 }; |
30 | 30 |
| 31 class BilerpProcessorInterface : public PointProcessorInterface { |
| 32 public: |
| 33 // The x's and y's are setup in the following order: |
| 34 // +--------+--------+ |
| 35 // | | | |
| 36 // | px00 | px10 | |
| 37 // | 0 | 1 | |
| 38 // +--------+--------+ |
| 39 // | | | |
| 40 // | px01 | px11 | |
| 41 // | 2 | 3 | |
| 42 // +--------+--------+ |
| 43 // These pixels coordinates are arranged in the following order in xs and ys
: |
| 44 // px00 px10 px01 px11 |
| 45 virtual void bilerpList(Sk4fArg xs, Sk4fArg ys) = 0; |
| 46 }; |
| 47 |
31 class PixelPlacerInterface { | 48 class PixelPlacerInterface { |
32 public: | 49 public: |
33 virtual ~PixelPlacerInterface() { } | 50 virtual ~PixelPlacerInterface() { } |
34 virtual void setDestination(SkPM4f* dst) = 0; | 51 virtual void setDestination(SkPM4f* dst) = 0; |
35 virtual void placePixel(Sk4fArg pixel0) = 0; | 52 virtual void placePixel(Sk4fArg pixel0) = 0; |
36 virtual void place4Pixels(Sk4fArg p0, Sk4fArg p1, Sk4fArg p2, Sk4fArg p3) =
0; | 53 virtual void place4Pixels(Sk4fArg p0, Sk4fArg p1, Sk4fArg p2, Sk4fArg p3) =
0; |
37 }; | 54 }; |
38 | 55 |
39 class SkLinearBitmapPipeline { | 56 class SkLinearBitmapPipeline { |
40 public: | 57 public: |
41 SkLinearBitmapPipeline( | 58 SkLinearBitmapPipeline( |
42 const SkMatrix& inverse, | 59 const SkMatrix& inverse, |
| 60 SkFilterQuality filterQuality, |
43 SkShader::TileMode xTile, SkShader::TileMode yTile, | 61 SkShader::TileMode xTile, SkShader::TileMode yTile, |
44 const SkImageInfo& srcImageInfo, | 62 const SkImageInfo& srcImageInfo, |
45 const void* srcImageData); | 63 const void* srcImageData); |
46 | 64 |
47 void shadeSpan4f(int x, int y, SkPM4f* dst, int count); | 65 void shadeSpan4f(int x, int y, SkPM4f* dst, int count); |
48 | 66 |
49 template<typename Base, size_t kSize> | 67 template<typename Base, size_t kSize> |
50 class PolymorphicUnion { | 68 class PolymorphicUnion { |
51 public: | 69 public: |
52 PolymorphicUnion() {} | 70 PolymorphicUnion() {} |
(...skipping 13 matching lines...) Expand all Loading... |
66 Base& operator*() const { return *get(); } | 84 Base& operator*() const { return *get(); } |
67 | 85 |
68 private: | 86 private: |
69 struct SK_STRUCT_ALIGN(16) Space { | 87 struct SK_STRUCT_ALIGN(16) Space { |
70 char space[kSize]; | 88 char space[kSize]; |
71 }; | 89 }; |
72 mutable Space fSpace; | 90 mutable Space fSpace; |
73 }; | 91 }; |
74 | 92 |
75 using MatrixStage = PolymorphicUnion<PointProcessorInterface, 112>; | 93 using MatrixStage = PolymorphicUnion<PointProcessorInterface, 112>; |
76 using TileStage = PolymorphicUnion<PointProcessorInterface, 96>; | 94 using FilterStage = PolymorphicUnion<PointProcessorInterface, 8>; |
77 using SampleStage = PolymorphicUnion<PointProcessorInterface, 80>; | 95 using TileStage = PolymorphicUnion<BilerpProcessorInterface, 96>; |
| 96 using SampleStage = PolymorphicUnion<BilerpProcessorInterface, 80>; |
78 using PixelStage = PolymorphicUnion<PixelPlacerInterface, 80>; | 97 using PixelStage = PolymorphicUnion<PixelPlacerInterface, 80>; |
79 | 98 |
80 private: | 99 private: |
81 PointProcessorInterface* fFirstStage; | 100 PointProcessorInterface* fFirstStage; |
82 MatrixStage fMatrixStage; | 101 MatrixStage fMatrixStage; |
| 102 FilterStage fFilterStage; |
83 TileStage fTileXOrBothStage; | 103 TileStage fTileXOrBothStage; |
84 TileStage fTileYStage; | 104 TileStage fTileYStage; |
85 SampleStage fSampleStage; | 105 SampleStage fSampleStage; |
86 PixelStage fPixelStage; | 106 PixelStage fPixelStage; |
87 }; | 107 }; |
88 | 108 |
89 #endif // SkLinearBitmapPipeline_DEFINED | 109 #endif // SkLinearBitmapPipeline_DEFINED |
OLD | NEW |